11 User Space, Kernel Space, and the System Call API(用户空间,核空间,系统api)

1 The Operating System as a Resource

  1. 操作系统提供了两项基础功能
    1. 抽象:提供了统一接口,而不必关系底层的硬件,提供操作系统API
    2. 隔离:不同的程序相互隔离,互不影响

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
在这里插入图片描述

2.2 How to recognize a system calls using the man pages

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值