(Owed by: 春夜喜雨 http://blog.csdn.net/chunyexiyu)
参考:https://en.wikipedia.org/wiki/System_call
总述内容主要来自于wikepedia中的介绍,主要回答三个问题:
- 什么是系统调用?
- 系统调用的数目有多少?
- 系统调用函数的通常分类是什么?
关于系统调用
计算机中系统调用,指计算机程序执行时请求操作系统内核提供的服务。调用通常可能涉及硬件相关服务(例如涉及硬盘驱动)、或创建和执行一个新进程、或与基础内核服务通信(比如进程调度)。系统调用在进程与操作系统之间提供了一个必要的接口。
在大多数系统中,系统调用仅在用户空间进程中使用;但在一些系统如IBM的OS/360和它的继承者系统中,特权系统代码也启用了系统调用。
from wikepdia ---
In computing, a system call (commonly abbreviated to syscall) is the programmatic way in which a computer program requests a service from the kernel of the operating system on which it is executed. This may include hardware-related services (for example, accessing a hard disk drive), creation and execution of new processes, and communication with integral kernel services such as process scheduling. System calls provide an essential interface between a process and the operating system.
In most systems, system calls can only be made from userspace processes, while in some systems, OS/360 and successors for example, privileged system code also issues system calls.
系统调用数量
在Unix、类Unix和其它POSIX兼容操作系统中,通用系统调用有open, read, write, close, wait, exec, for, exit, kill。许多现代操作系统有数百个系统调用。例如Linux和OpenBSD分别有超过300个不同的调用,NetBSD有接近500个,FreeBSD有超过500个,Win7有接近700个,而早期Plan9只有51个系统调用,MINIX只有53个系统调用。
from wikepedia ---
On Unix, Unix-like and other POSIX-compliant operating systems, popular system calls are open, read, write, close, wait, exec, fork, exit, and kill. Many modern operating systems have hundreds of system calls. For example, Linux and OpenBSD each have over 300 different calls, NetBSD has close to 500,FreeBSD has over 500,Windows 7 has close to 700, while Plan 9 has 51.
系统调用分类
在wikepedia中系统调用划分了6个大类,分别为:ProcessControl进程控制,FileManagement文件管理,DeviceManagement设备管理, InformationMaintenance信息维护,Communication通信,Protection保护 共计6个大类。
进程控制
分成6个小类
- create process 进程创建 (fork in unix-like os,NTCreateProcess in windows)
- terminal process 终止进程 (kill in unix-like os)
- load, execute 加载程序文件、执行程序(execve, exec in unix)
- get/set process attribute 获取/设置进程属性
- wait for time, wait event, signal event 等待时间、事件、信号
- allocate and free memory 分配和释放内存
文件管理
分成4个小类
- create file/delete file 创建/删除文件
- open, close 打开/关闭文件
- read, write, reposition 读/写/重定位
- get/set file attribute 获取/设置文件属性
设备管理
分成4个小类
- request device,release device请求设备,释放设备
- read, write, reposition 读/写/重定位
- get/set device attribute 获取/设置设备属性
- logically attach/detach devices 逻辑附加/去除设备
信息维护
分成2个小类
- get/set total system information(including time, date, computer name, enterprise etc.)获取/设置完整的系统信息。
- get/set process, file, or device metadata(include author, opener, creation time and date etc.) 获取/设置进程、文件、设备的元数据(描述数据的数据)。
通信
分成4个小类
- create, delete communication connection 创建/删除通信连接
- send, receive message 发送/接收信息
- transfer status information 转移状态信息
- attach/detach remote device 附加/去除远程设备
保护
1个小类:获取/设置文件权限
(Owed by: 春夜喜雨 http://blog.csdn.net/chunyexiyu)