Multiprogramming
Multiprogramming
Multi-Programming
When the computer runs more than one program in the main memory, it is termed as Multi-programming. e.g. Running Microsoft
Word, Paint and Chrome on the processor. Multiple programs run on a single processor (CPU), with its maximum utilization. Figure
below shows how CPU does processing for each program with time, thereby optimizing its usage.
o "The concurrent residency of more than one program in the main memory is referred as multiprogramming."
o Since multiple programs are resident in the memory, as soon as the currently executing program finishes its execution, the next
program is dispatched for its consumption.
o Also if the currently executing program asks for input output resources then meanwhile another program is dispatched to the
CPU for execution.
o The main objective of multiprogramming is:
o Maximum CPU utilization.
o Efficient management of the main memory.
o Multiprogramming can be virtually shown as:
Multi-Processing
When we have more than one processor running to complete a task, it is termed as Multi-Processing. It is the property of the hardware
in use. A computer system can have one processor, and termed as uni-processor; or more than one processor and be termed as multi-
processor. e.g. A dual core has two processors, whereas quad core has four processors. Its major advantage is that task can run in
parallel on multiple processors, thus helping to reduce the computational time.
o When one system is connected to more than one processor which collectively work for the completion of the task, it is called
as multiprocessing systems.
o Multiprocessing systems can be divided in two types:
o Symmetric Multiprocessing: The operating system here resides on one processor and the other processors run user's
programs.
o Asymmetric Multiprocessing: The OS runs on any available processor or all the processor simultaneously run the
user program.
o Multiprocessing systems can be virtually represented as:
Multi-Tasking
When multi-programming extends to submitting of more than one job or task by the user or multiple users, it is termed as multi-tasking.
It is the ability of the operating system to accept more than one job, and it can be either from a single or multiple users. While multi-
programming emphasizes sharing the memory by multiple programs, multitasking emphasizes sharing the CPU as well as memory by
multiple programs or tasks. Behind the scenes, CPU might be evaluating each job serially i.e. one job at a time, but the way jobs are
subdivided, distributed and evaluated with time management, gives the user an illusion of parallel submission of job.
o Earlier when computers were invented, a user was allowed to submit only job or task at a time. But later with availability of
high-speed processor, one can submit more than one task.
o So the capability of OS to accept more the one task per user is termed as multitasking.
o Multiple jobs are executed by the CPU simultaneously by switching between them.
o The various job can be accepted from same user or different users. There are 2 types of multitasking systems:
o Single User Multitasking
o Multi User multitasking
o It can be virtually represented as:
Multi-Threading
Every task submitted by the user is subdivided into sub-tasks or threads. When, these multiple sub-tasks run in a multi-tasking
environment, it is called multi-threading. e.g. When we open Microsoft Word and write a sentence as a task, multiple sub-tasks
like reading input from user, auto-save, indentation, spelling check, grammar correction and recommendations also run in
parallel as threads, on various processors. Sometimes multiple requests are submitted by same user and sometimes similar
requests are submitted by multiple users. Multi-threading helps with time and memory optimization, by creating and running
multiple sub-processes or threads of the same process in parallel.
o "Multithreading is a conceptual programming paradigm where a process is divided into a number of sub-processes called as
threads. Each thread is independent and has its own path of execution with enabled inter thread communication."
o "Thread is the path followed while executing a program. Each thread has its own program counter, stack and register."
o A thread is a light weight process.
o It can be virtually represented as:
No Characteristic Multiprogramming Multiprocessing Multithreading Multitasking
1 What it is: The concurrent residency The availability of more A process is divided into several The execution of more than
of more than one program than one processor per different sub-processes called as one task simultaneously is
in the main memory is system, which can threads, which has its own path of called as multitasking.
called as execute several set of execution. This concept is called
multiprogramming. instructions in parallel is as multithreading.
called as
multiprocessing.
2 Number of CPU: One More than one Can be one or more than one One
3 Job processing More time is taken to Less time is taken for job Moderate amount of time is taken Moderate amount of time.
time: process the jobs. processing. for job processing.
4 Number of process One process is executed at More than one process Various components of the same One by one job is being
being executed: a time. can be executed at a time process are being executed at a executed at a time.
time.
6 Number of users: One at a time. Can be one or more than Usually one. More than one.
one.
9 Categories: No further divisions Symmetric & No further divisions. Single User & Multiuser.
Asymmetric.