In: Computer Science
System calls pass parameters to the kernel using one of three methods: in registers, in a block or table and the address of the block passed as parameter in a register, on the stack. Discuss the advantages and disadvantages of each.
Also, what does it mean when we say “a program is a passive entity while a process is an active entity”?
Also, in detail why does the Operating System switches the process from Running state to Waiting state when it issues any I/O operation.
1) System call:
A system call is an interface to the services of the OS. Application developers often do not have direct access to the system calls, but can access them through an application programming interface (API).
Passing Parameters:
There are 3 main methods.
(a) Parameters can be passed in registers.
Advantage: Easy and simplest method. Also direct way to pass parameters.
Faster. Can be immediately used.
Disadvantage: This is insufficient when there are more parameters than number of registers.
(b) Parameters can be stored in a block and the block address can be passed as a parameter to a register.
Advantage: When there are more parameters than registers, this method can be used.
Disadvantage: Limited to only Linux and Solaris.
(c) Parameters can also be pushed on or popped off the stack by the operating system.
Advantage: It do not limit the number or length of parameters passed. Can pass any number of parameters.
Disadvantage: Code becomes a bit more complex.
2) Program and Process:
Process:
A process is an instance of a computer program that is being sequentially executed by a computer system.
Process is an active entity as it is created during execution and loaded into the main memory.
Process is a dynamic entity.
Program:
A computer program is just a source code compiled into machine instructions, while a process is the actual execution of those instructions.
Program is a passive entity as it resides in the secondary memory.
Program is a static entity.
3) It is due to the Non-Preemptive Scheduling technique in OS.
Here there is no choice. A new process must be selected.
Once a process starts running it keeps running, until it either voluntarily blocks or until it finishes.
Whenever the process requests access to I/O or needs input from the user it enters the blocked or wait state.