Definition: Multiprogramming is a technique where multiple programs are loaded into memory simultaneously, and the CPU switches between them based on a predefined scheduling algorithm.
Focus: The primary focus of multiprogramming is to maximize CPU utilization and keep the CPU busy at all times by having multiple programs in memory.
Memory Sharing: Multiple programs share the same memory, and the CPU switches between them to execute their instructions.
Independent Execution: Programs run independently of each other, and each program has its own address space and execution context.
CPU Switching Overhead: The CPU spends time switching between different programs, which can lead to some overhead.
Multitasking:
Definition: Multitasking is an advanced form of multiprogramming where the CPU rapidly switches between multiple running processes to give the illusion that they are executing simultaneously.
Focus: The primary focus of multitasking is to provide the appearance of parallel execution, allowing users to interact with multiple applications seemingly at the same time.
Time Sharing: The CPU time is divided into small time slices (time quanta), and each process is given a fair share of CPU time during its time slice.
Context Switching: The CPU rapidly switches between processes, saving and restoring their execution state during context switches.
User Interaction: Multitasking allows users to interact with different applications concurrently, enhancing user productivity.