1 The Operating System as a Resource
- 操作系统提供了两项基础功能
- 抽象:提供了统一接口,而不必关系底层的硬件,提供操作系统API
- 隔离:不同的程序相互隔离,互不影响
1.1 OS System Resources
操作系统:
1. Device Management:Hardware devices, such as keyboard, monitors, printers, hard drives, etc., are resources managed by the computer.user-input through keyboard
2. Process Management : The invocation and execution of a program, a process, is managed by the OS, including managing its current state, running or stopped, as well as the loading of code.executed programs through bash
3. Memory Management : The access to physical and virtual memory is controlled by the OSusing malloc() and calloc()
4. File System Management : The OS is also responsible for ensuring that programs can read and write from the filesystem(用户空间无法直接访问文件系统,要通过核)read, written, and created files
1.2 Kernel Space vs. User Space
1.Kernel Space,执行是privilege,比如申请内存空间
2.User Space,unprivileged,比如两数相加,遍历已申请空间的数组,都是
2 System Calls

2.1 Kernel Traps
1.用户掉用 malloc
2.malloc调用kernel函数sbrk
3.kernel函数sbrk申请空间,并映射给malloc

本文深入探讨了操作系统的四项关键功能:设备管理、进程管理、内存管理和文件系统管理,揭示了它们如何支撑上层应用运行,以及内核空间与用户空间的区别。同时,文章还解释了系统调用的工作原理。

1062

被折叠的 条评论
为什么被折叠?



