Monday, October 10, 2011

Features and Advantages of Multiprogramming


Explain the features and advantages of multiprogramming.

Multiprogramming is the rapid switching of the CPU between multiple processes in memory. It is done only when the currently running process requests I/O, or terminates. It was commonly used to keep the CPU busy while one or more processes are doing I/O. It is now mostly
superceded by multitasking, in which processes also lose the CPU when their time quantum expires.

Multiprogramming makes efficient use of the CPU by overlapping the demands for the CPU and its I/O devices from various users. It attempts to increase CPU utilization by always having something for the CPU to execute.

The prime reason for multiprogramming is to give the CPU something to do while waiting for I/O to complete. If there is no DMA, the CPU is fully occupied doing I/O, so there is nothing to be gained (at least in terms of CPU utilization) by multiprogramming. No matter how much I/O a program does, the CPU will be 100% busy. 
This of course assumes the major delay is the wait while data is copied. A CPU could do other work if the I/O were slow for other reasons (arriving on a serial line, for instance).

  • I/O operations are exceedingly slow (compared to instruction execution) 
  • A program containing even a very small number of I/O ops, will spend most of its time waiting for them 
  • Hence: poor CPU usage when only one program is present in memory
Requirements for Multi programming

Hardware support: 
I/O interrupts and (possibly) DMA
in order to execute instructions while I/O device is busy

Memory management:
several ready-to-run jobs must be kept in memory
Memory protection (data and programs)

Software support from the OS:
Scheduling (which program is to be run next)
To manage resource contention

Example: 
three jobs are submitted
Almost no contention for resources
All 3 can run in minimum time in a multitasking environment (assuming JOB2/3 have enough CPU time to keep their I/O operations active)

Advantages of Multiprogramming

No comments:

Post a Comment