Subscribe by Email


Wednesday, May 15, 2013

Define a system call? List the different types of the system calls?


- A program can request for services from the kernel of the operating system through a system call. 
- These services include all the following:
  1. Hardware related services such as data access from the HDD.
  2. Creation and execution of processes
  3. Communication with integral services of the kernel such as scheduling.
- An essential interface is provided by the system call that lies between the operating system and the process. 
- The modern microprocessor architecture consists of a security model specifying multiple levels of privileges for the execution of the software. 
- For example, a program has limitations of its own address space so even by accident it does not modify or access the programs that are executing or the OS. 
- This way the direct manipulation of the hardware devices (such as the network devices and frame buffer etc.) by the program will also be avoided. 
However, this is not the only case.
- There are situations where the programs really need access to these devices. - This is why the system calls are made available to the programs. 
- System calls ensure that such operations are safely implemented and are well defined. 
- The level at which the operating system executes is the highest privilege level.
- Therefore, the applications requests for the devices to the operating system through the system calls. 
- The execution of the system calls is carried out through the interrupts that would automatically put the CPU at the required level of the privilege. 
- After this, the control is passed on to the kernel. 
- From here the kernel determines whether or not the requested service should be granted to the calling program. 
- If the program is granted the service it requested, a specific instruction set is executed by the kernel which cannot be directly controlled by the calling program.
- These instructions return the privilege level down to that of the program that invoked the call. 
- Finally, the control is returned to the calling program.
- Generally, an API or a library is provided between the operating system and the normal programs. 
- The purpose of this library is to provide wrapper functions for the calls. 
- The names of these functions are same as that of the system calls. 
- The purpose of these functions is to expose a subroutine through which the system call can be used.
- These functions also provide modularity to the system call. 
- But above all, the primary function of the wrapper is placing the arguments in their proper processor registers that are to be passed on to the system call.
- A unique system call number is set that will be called by the kernel. 
- In this way, the portability is increased by the help of this library.
- Making direct system calls in the code of the application is very difficult and so requires embedded assembly code.
- In systems based up on ex-kernel, library is as important as the intermediary as they provide resource management, abstractions and shields the application from a low level kernel. 
- A control transfer involving features specific to the architecture is required for the implementation of the system call. 
- A way of implementing this is by using a software trap. 
- RISC processors can only use the implementation technique via interrupts. 
But there are some other additional techniques for processors with CISC architectures. 
- One example is of the following two sets developed independently by Intel and AMD respectively for serving the same purpose:
SYSRET/ SYSEXIT
SYSCALL/ SYSENTER
- These were actually control transfer instructions and very fast indeed. 


No comments:

Facebook activity