- OS - Home
- OS - Overview
- OS - History
- OS - Evolution
- OS - Functions
- OS - Components
- OS - Structure
- OS - Architecture
- OS - Services
- OS - Properties
- Process Management
- Processes in Operating System
- States of a Process
- Process Schedulers
- Process Control Block
- Operations on Processes
- Process Suspension and Process Switching
- Process States and the Machine Cycle
- Inter Process Communication (IPC)
- Remote Procedure Call (RPC)
- Context Switching
- Threads
- Types of Threading
- Multi-threading
- System Calls
- Scheduling Algorithms
- Process Scheduling
- Types of Scheduling
- Scheduling Algorithms Overview
- FCFS Scheduling Algorithm
- SJF Scheduling Algorithm
- Round Robin Scheduling Algorithm
- HRRN Scheduling Algorithm
- Priority Scheduling Algorithm
- Multilevel Queue Scheduling
- Lottery Scheduling Algorithm
- Starvation and Aging
- Turn Around Time & Waiting Time
- Burst Time in SJF Scheduling
- Process Synchronization
- Process Synchronization
- Solutions For Process Synchronization
- Hardware-Based Solution
- Software-Based Solution
- Critical Section Problem
- Critical Section Synchronization
- Mutual Exclusion Synchronization
- Mutual Exclusion Using Interrupt Disabling
- Peterson's Algorithm
- Dekker's Algorithm
- Bakery Algorithm
- Semaphores
- Binary Semaphores
- Counting Semaphores
- Mutex
- Turn Variable
- Bounded Buffer Problem
- Reader Writer Locks
- Test and Set Lock
- Monitors
- Sleep and Wake
- Race Condition
- Classical Synchronization Problems
- Dining Philosophers Problem
- Producer Consumer Problem
- Sleeping Barber Problem
- Reader Writer Problem
- OS Deadlock
- Introduction to Deadlock
- Conditions for Deadlock
- Deadlock Handling
- Deadlock Prevention
- Deadlock Avoidance (Banker's Algorithm)
- Deadlock Detection and Recovery
- Deadlock Ignorance
- Resource Allocation Graph
- Livelock
- Memory Management
- Memory Management
- Logical and Physical Address
- Contiguous Memory Allocation
- Non-Contiguous Memory Allocation
- First Fit Algorithm
- Next Fit Algorithm
- Best Fit Algorithm
- Worst Fit Algorithm
- Buffering
- Fragmentation
- Compaction
- Virtual Memory
- Segmentation
- Paged Segmentation & Segmented Paging
- Buddy System
- Slab Allocation
- Overlays
- Free Space Management
- Locality of Reference
- Paging and Page Replacement
- Paging
- Demand Paging
- Page Table
- Page Replacement Algorithms
- Second Chance Page Replacement
- Optimal Page Replacement Algorithm
- Belady's Anomaly
- Thrashing
- Storage and File Management
- File Systems
- File Attributes
- Structures of Directory
- Linked Index Allocation
- Indexed Allocation
- Disk Scheduling Algorithms
- FCFS Disk Scheduling
- SSTF Disk Scheduling
- SCAN Disk Scheduling
- LOOK Disk Scheduling
- I/O Systems
- I/O Hardware
- I/O Software
- I/O Programmed
- I/O Interrupt-Initiated
- Direct Memory Access
- OS Types
- OS - Types
- OS - Batch Processing
- OS - Multiprogramming
- OS - Multitasking
- OS - Multiprocessing
- OS - Distributed
- OS - Real-Time
- OS - Single User
- OS - Monolithic
- OS - Embedded
- Popular Operating Systems
- OS - Hybrid
- OS - Zephyr
- OS - Nix
- OS - Linux
- OS - Blackberry
- OS - Garuda
- OS - Tails
- OS - Clustered
- OS - Haiku
- OS - AIX
- OS - Solus
- OS - Tizen
- OS - Bharat
- OS - Fire
- OS - Bliss
- OS - VxWorks
- Miscellaneous Topics
- OS - Security
- OS Questions Answers
- OS - Questions Answers
- OS Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
Multiprogramming in Operating System
The multiprogramming operating system was introduced to overcome the limitations of batch processing operating systems in the early 1960s. The main drawback of batch systems was that the CPU remained idle during I/O operations of a job. But with multiprogramming, the CPU can execute another job while one job is waiting for I/O operations to complete.
Read this chapter to learn more about multiprogramming operating systems, its working, advantages, disadvantages, and examples.
- What is Multiprogramming?
- Working of Multiprogramming Operating System
- Advantages of Multiprogramming Operating System
- Disadvantages of Multiprogramming Operating System
- Multiprogramming vs Multitasking Operating Systems
What is Multiprogramming?
Multiprogramming is a method of running multiple programs on a single processor in such a way that the CPU is always busy. Meaning, multiple jobs are kept in the main memory, and the CPU is allocated to them one at a time. When one job is temporarily suspended or waiting for I/O operations, then the CPU will be allocated to another job. This way, the CPU will always have a job to execute.
The operating system that follows the multiprogramming approach is called a multiprogramming operating system Most of the modern operating systems like Windows, Linux, and macOS supports multiprogramming.
Working of Multiprogramming Operating System
The animation below shows the working of a multiprogramming operating system −
In the above animation,
Step 1 − Jobs are loaded into the main memory.
Step 2 − The operating system selects a JOB A from the memory and allocates the CPU to it.
Step 3 − JOB A needed to perform I/O operations, so it is moved to the secondary storage, and the CPU is allocated to JOB B.
Step 4 − JOB B completes its execution and removed from the CPU. Now, JOB A is brought back from secondary storage to main memory, and the CPU is allocated to it.
Step 5 − This process continues until all jobs are executed.
Advantages of Multiprogramming Operating System
Some of the advantages of multiprogramming operating systems are −
- Increased CPU Usage − Multiprogramming ensures that the CPU is always busy by allocating it to another job when one job is waiting for I/O operations.
- Improved System Throughput − Throughput refers to the number of jobs completed in a given time period. Multiprogramming increases system throughput by executing multiple jobs concurrently.
- Reduced Waiting Time − In a multiprogramming operating system, jobs do not have to wait for long periods to get executed. Since multiple jobs are kept in memory, the operating system can quickly allocate the CPU to a job when it is ready to execute.
Disadvantages of Multiprogramming Operating System
Some of the disadvantages of multiprogramming operating systems are −
- Complexity Compared to batch processing operating systems, multiprogramming operating systems are more complex to design and implement. Advanced data structures and algorithms are required to manage multiple jobs in memory.
- Memory Management Multiprogramming requires good memory management techniques to allocate and deallocate memory for multiple jobs.
- Overhead The operating system needs to perform additional tasks like job scheduling, memory management, and context switching. This overhead can reduce the overall system performance.
Multiprogramming vs Multitasking Operating Systems
Multitasking operating systems are modern and advanced versions of multiprogramming operating systems. It supports the execution of multiple tasks or processes simultaneously by rapidly switching between them. Here are some key differences between multiprogramming and multitasking operating systems −
| Aspect | Multiprogramming OS | Multitasking OS |
|---|---|---|
| Definition | In multiprogramming, multiple programs are kept in memory, and the CPU is allocated to one program at a time. | In multitasking, multiple tasks or processes are executed simultaneously by rapidly switching between them. |
| Focus | Multiprogramming focuses on maximizing CPU utilization by keeping it busy with multiple jobs. | Multitasking focuses sharing CPU time among multiple tasks to provide an illusion of simultaneous execution. |
| Context Switching | Context switching is less frequent, happens only in the event of I/O operations or job completion. | Context switching in multitasking is more frequent |
| Number of Cores/CPUs | Works on single-core or single-CPU systems. But can be implemented on multi-core systems as well. | Designed for multi-core or multi-CPU systems. |
| Use Case | Multiprogramming is primarily used in batch processing systems. | Multitasking is commonly used in modern operating systems like Windows, Linux, and macOS. |
Conclusion
Multiprogramming operating systems were introduced to improve efficiency of CPU utilization in batch processing systems. It allows multiple jobs to be kept in memory, and the CPU is allocated to them one at a time. During I/O operations of one job, the CPU is allocated to another job, this way the CPU is always busy. The main advantage of multiprogramming is maximum utilization of CPU, and improved system throughput. However, it also challenges like complexity, memory management, and overhead. Most of the modern operating systems today support multiprogramming and multitasking.