- Back to Home »
- Definition and Explanation of Multiprogramming in Operating system
Definition and Explanation of Multiprogramming in Operating system:
The operating system can make the computer more productive by switching the CPU among processes. The objective of multiprogramming is to have some process running at all times. This should maximize CPU utilization. If there is only one processor (or CPU) then there will only be one process in a running state at any given time. If there are more processes that need to be run, they will have to wait. There must be some mechanism to select which process (currently in memory) will run next when the CPU becomes available.
The operating system maintains a ready-queue. Processes on this queue are ready to be executed. Whenever a currently executing process needs to wait (does I/O etc.), operating system picks a process from the ready queue and assigns the CPU to that process.
Scheduling is a fundamental operating system function. CPU is an important resource. It is very important to develop good scheduling algorithms.
Example:
Suppose we have two processes A and B. Each process executes for one second then waits for one second. It is repeated 60 times. If we run process A first and then process B, one after the other, it will take four minutes to run the two processes: A takes two minutes to run and then B takes two minutes to run. We actually compute only two minutes of this time. The other two minutes are idle time. Our CPU utilization is only 50%.