In the present computer, many parallel application processes are required to execute to run the system. This is now the function of the OS to control & control all the processes efficiently and effectively which is conversely the paramount function of the operating system.
To execute multiple programs multi-programming system is used. This type of operating system is capable of executing more than one program on the CPU. Because of this, the system is completely utilized. If only a single program is being executed and other programs wait for getting their turn.
When a system is running, multiple processes wait to get performed i.e., they wait for their chance to utilize the CPU and start their execution. Sometimes such processes are called jobs. These processes are kept in a job pool. This is done because the main memory is very little to adjust all of these processes together into it. So, they are stored in the job pool which consists of all the processes waiting for allocation in the CPU and main memory. After accommodating these processes together, the CPU selects a job from the waiting list and transfers it from the job pool to the main memory for starting the execution. The processor continues to execute one job unless it is intervened by any external element or it goes for an Input/Output task.
The main components of a multi-programming system are command processor, I/O control system, file system, and transient area.
The parts of the transient area are sub-segmented to store individual programs and further resource management routines are connected with the basic function of the operating system.
When two or more programs are present in computer memory, concurrently, the processor is shared between them and it is called multiprogramming. By organizing jobs in a single shared processor, CPU utilization is increased so that the CPU always has one program to execute. By identifying and executing jobs on behalf of their priority the Response Time is lowered.
Types of Operating System
- Simple Batch System
- Multiprogramming Batch System
- Multiprocessor System
- Desktop System
- Distributed Operating System
- Clustered System
- Realtime Operating System
- Handheld System
Working of Non-multiprogram System
While in this type of system, when a job departs the CPU going for other tasks, the CPU becomes inactive i.e., it waits for the next job or till the old one resumes. Overall, the CPU remains idle for some time which is a drawback because more jobs that are delayed to get carried out might not even get odds as the CPU is still allocated to the previous job. This is a problem because the jobs which are prepared to get executed are not assigned to the CPU which is not utilized in its present job. After all, the job is busy taking input/output tasks. To improve the efficiency of the system altogether the theory of multi programming was devised.
Working of Multi-Program System
In this, just as the job proceeds for a task the OS pauses the job and selects an additional job from the job pool, and gives the CPU to the new job to start its processing. The foregoing job continues its input/output task while the new job performs its execution.
Now let’s consider the next job also proceeds for a task the CPU then selects the further next job and starts executing it. And just as any of the previous jobs completes their Input/Output operation they return and the CPU is assigned to it. So, no CPU time is squandered.
Thus, the overall target of a multi programming system is to keep the CPU occupied till some jobs are present in the job pool. Thus, multiple programs can be carried out on a single processor machine & the CPU never remains inactive.
Difference between Multiprogramming and Multiprocessing
Computer systems with two or more than two CPUs (Processor) are called Multiprocessing systems. So, with the availability of multiple processors, multiple processes can be executed at the same time. These multiprocessors work by sharing memory, clock & peripheral devices. A computer system can be both multi-programmed & multi-processing at the same time. The difference between multiprocessing and multi programming is that in multi programming, the system keeps programs in the main memory and executes them using a single CPU only while Multiprocessing means executing multiple processes at the same time on multiple processors. Multi programming is carried out by switching from one process to another while Multiprocessing is carried out by the means of parallel processing.
Advantages of Multiprogramming Operating System
- CPU utilization increases and Idle time reduces.
- Smart utilization of Resources.
- Reduction in response time.
- The time required for Short time jobs is reduced.
- The system can be used by multiple users at once.
- Total read time is reduced while executing a job.
- Helps fast monitoring of tasks as they run parallel.
Disadvantages of Multiprogramming System
- There is a need for CPU scheduling.
- As all types of jobs are stored in main memory, memory management is required.
- Log waiting time is required when the system has a large number of pending jobs.
- Managing all the jobs is very difficult.
- Highly complex.
The post What is Multiprogramming Operating System appeared first on The Crazy Programmer.