Define System Calls
- The mechanism used by an application program to request service from the operating system. System calls often use a special machine code instruction which causes the processor to change mode (e.g. to "supervisor mode" or "protected mode").
- This allows the OS to perform restricted actions such as accessing hardware devices or the memory management unit.
- The system call provides an interface to the operating system services.
- Application developers often do not have direct access to the system calls, but can access them through an application programming interface (API). The functions that are included in the API invoke the actual system calls. By using the API, certain benefits can be gained:
- Portability: as long a system supports an API, any program using that API can compile and run.
- Ease of Use: using the API can be significantly easier then using the actual system call.
System Call Parameters
Three general methods exist for passing parameters to the OS:
- Parameters can be passed in registers.
- When there are more parameters than registers, parameters can be stored in a block and the block address can be passed as a parameter to a register.
- Parameters can also be pushed on or popped off the stack by the operating system.
Types of System Calls
There are 5 different categories of system calls:
- Process control
- File manipulation
- Device manipulation
- Information maintenance
- Communication
Process Control
- A running program needs to be able to stop execution either normally or abnormally. When execution is stopped abnormally, often a dump of memory is taken and can be examined with a debugger.
File Manipulation
- Some common system calls are create, delete, read, write, reposition, or close. Also, there is a need to determine the file attributes – get and set file attribute. Many times the OS provides an API to make these system calls.
Device Manipulation
- Process usually require several resources to execute, if these resources are available, they will be granted and control returned to the user process. These resources are also thought of as devices. Some are physical, such as a video card, and others are abstract, such as a files.
- User programs request the device, and when finished they release the device. Similar to files, we can read, write, and reposition the device.
Information Maintenance
- Some system calls exist purely for transferring information between the user program and the operating system. An example of this is time, or date.
- The OS also keeps information about all its processes and provides system calls to report this information.
Communication
- There are two models of interprocess communication, the message-passing model and the shared memory model.
- Message-passing uses a common mailbox to pass messages between processes.
- Shared memory use certain system calls to create and gain access to create and gain access to regions of memory owned by other processes. The two processes exchange information by reading and writing in the shared data.
Steps in Making a System Call
There are 11 steps in making the system call read (fd, buffer, nbytes) |
Some System Calls For Process Management
Some System Calls For File Management
Some System Calls For Directory Management
Some System Calls For Miscellaneous Tasks
System Calls (5)
Some Win32 API calls |
Video about System Call in Operating Systems
System Calls: The bridge between OS and applications! Just as hosting mella connects your website to the world, System Calls connect your program to the operating system's services!
ReplyDelete