Article Directory
1. system call 1
1.1 What is a system call, what role?
Operating system as the interface between the user and the computer hardware, the need to provide easy to use up some of the services, including command interface and program interfaces. Wherein the program interface consists of a set ofSystem callscomposition.
"System call" is the operating system to the application program interface (programmer / programmer) to use, can be understood as a special function, the application of an alternative application calls can Calls made to get the system operating system services
User programSystem callsRequest operating system services. System in a variety of shared resources by the operating system, unified control, and therefore in the user program, all resource-related operations (such as memory allocation, I / O operations, file management, etc.), must be called by the operating system the way system service request, on behalf of the completion by the operating system. suchWe can guarantee the stability and security of the systemTo prevent users from illegal operation.
- System call (classified by function)
- Device Management: complete equipment request / release / start functions
- Document Management: to complete the file read / write / create / delete functions
- Process control: the completion of the process of creation / withdrawal / blocking / wake functions
- Process communication: the process is completed between the messaging / signaling functions
- Memory management: Complete memory allocation / recovery and other functions
System call related processing involves the management of system resources, control of the process, need to perform some of these functionsPrivileged instructionTo complete,Associated processing system callsNeedCore stateUnder carried out
.
All operations related resources, will directly affect the operation of other processes, then you need an operating system intervention, the need to implement the system by calling
The difference between calls and library functions 1.2 system
General application | Direct system calls, library functions can also be used. Some library functions to a system call, and some do not involve |
---|---|
Programming language | Provide up to a library function. Sometimes the system call will be packaged into a library function to hide some of the details of the system call, the system calls the upper more convenient |
operating system | The system provides up call |
Bare metal |
Does not involve a system call library functions: as "absolute value" function
.
Relates to a system call library functions: such as "Create a new file" function
Behind the 1.3 system calls
Process :
- Delivery system call parameters
- Into instruction execution (User Mode)
- System calls the appropriate service program (Core state)
- Returned to the user program
Note :
- Into instructionIt is inUser ModeExecution, execution triggered a fall immediately after the commandInternal interruptSo that the CPUInto the core state
- Issues a system call requestIt is inUser Mode,andThe appropriate handling of system callinCore stateCarried out under
- Into instruction is the only one can only execute in user mode, and not in kernel mode execution of instructions.
System call occurs in user mode, the processing of the system call occurs in the kernel mode. Execution instruction into an interrupt is generated within the processor (CPU) from user mode into the core mode.
More than kingly notes were finishing from PubMed ↩︎