Methodologies for Implementation Of Operating System services

System Call :-

For performing any operation an user must have to request for a service call which is also known as System Call or we can say

Programming interface to the services provided by the operating system

They are typically written in a high level language(c Or C++).

There are two modes in the operation of system which is user mode or system mode

In user mode -> All user processes are executed.

In system mode -> All privileged operations are executed.

The user programs and kernel functions are being executed in their respective space allotted in the main memory partitions.

User mode program need to execute some privileged operations, which are not permitted In user mode function, user mode program must use an interface, which forms the only permitted interface between user mode and kernel mode. This interface is called system calls. System call is an interface between the user program and operating system.

System call expose all kernel functionalities that user mode program require.
Basically the system call is an instruction that request the operating system to perform desired operation that needs hardware access or other privileged operations.

System call generates an interrupt that causes the operating system to gain control of the CPU. The Operating system then finds out the type of system call and the corresponding interrupt Handler routine is executive to perform the operation.

system calls

System call are inherently used for security reason. Due to the use of system calls, an user program is not able to enter operating system or any other's uses region. Similarly Input and Output Devices are also safe from any misuse of the user.Thus through the use of system call, kernel, other user program, input output devices are safe and Secure from that malicious user program.

kernal space

Making a system call

Now System calls are directly available used in high level languages like C and C plus plus. So it has become easy to use system calls in programs. For a programmer, some calls are same as calling a procedure or function. The difference between a system call and a normal function call is that a system call enter a kernel but a normal function call does not enter in the kernel.

Executing the system call:

There is a sequence of steps to execute a system call. For this, there is the need to pass various parameters of system call to the operating system. For passing these parameters to the operating system, 3 methods are used as follows-

1) return method, where in the parameters are stored in registers of the CPU.

2) if parameters are not in number, compared to the size of the register, a block of memory is used and address of that block a stored in register.

3) Stack method, where in parameters are pushed on to the stack and popped off by the operating system.

Sequence in which system call is executed:

1) In the user program when the system call is executed, first of all, Its parameters are pushed onto the stack and later on saved in processor registers.

2) The corresponding library procedure for the system call is executed.

3) There is a particular code for average system call by which the kernel identified which system call function or Handler need to be executed. Therefore, library procedure places the system call number in the processor register.

4) Then the library procedure traps to the kernel by executing interrupt instruction, with this interrupt execution, the user mode switches to kernel mode coding program password (PSW) register to 0.

System call Working

5) The hardware save the current contents of CPU register, so that after executing the system call, the execution of the rest of the program can be resumed.

6) The kernel identifies the system call by examining its number and dispatches the control to the corresponding system call Handler.

7) the system call handler executes.

8) On completion of system call Handler, the control is returned to the user program and it resumes its execution.

05- Methodologies For Implementation Of Operating System Service -System Calls





    CLICK HERE TO Download This PDF NOTES




Facebook Likes

Youtube