Question-1 what is Process? Give the difference between Process and Program.
- Process is a program under execution.
- It is an instance of an executing program, including the current values of the program counter, registers & variables.
- Process is an abstraction of a running program.
|A process is program in execution.||A program is set of instructions.|
|A process is an active/ dynamic entity.||A program is a passive/ static entity.|
|A process has a limited life span. It is created when execution starts and
terminated as execution is finished.
|A program has a longer life span. It is stored on disk forever.|
|A process contains various resources like memory address, disk, printer
etc… as per requirements.
|A program is stored on disk in some file.It does not contain any other resource.|
|A process contains memory address which is called address space.||A program requires memory space on disk to store all instructions.|
Question-2 what is multiprogramming?
A process is just an executing program, including the current values of the program counter, registers, and variables.
- Conceptually, each process has its own virtual CPU.
- In reality, the real CPU switches back and forth from process to process, but to understand the system, it is much easier to think about a collection of processes running in
- (pseudo) parallel, than to try to keep track of how the CPU switches from program to program.
- This rapid switching back and forth is called multiprogramming and the number of processes loaded simultaneously in memory is called degree of multiprogramming.
Question-3 what is context switching?
- Switching the CPU to another process requires saving the state of the old process and loading the saved state for the new process.
- This task is known as a context switch.
- The context of a process is represented in the PCB of a process; it includes the value of the CPU registers, the process state and memory-management information.
- When a context switch occurs, the kernel saves the context of the old process in its PCB and loads the saved context of the new process scheduled to run.
- Context-switch time is pure overhead, because the system does no useful work while switching.
- Its speed varies from machine to machine, depending on the memory speed, the number of registers that must be copied, and the existence of special instructions.
You may be interested in:
Operating System Short Descriptive Questions and Answers