PadhaikoAll subjects

Past exam question: 2075 (Past Questions), QE

Operating System · 4 marks

Open in the Padhaiko app

Topic: Process description, states and control · Scheduling algorithms

Question

Differentiate between I/O bound process and CPU bound process? What is process scheduling? Why do we need thread?

Solution

Differentiating I/O-Bound vs. CPU-Bound Processes: Processes alternate between computing on the CPU (CPU bursts) and waiting for I/O operations to complete (I/O bursts). Processes are categorized according to the dominant type of burst they spend their lifetime performing:

FeatureI/O-Bound ProcessCPU-Bound Process
Burst CharacteristicShort CPU bursts, long and frequent I/O bursts.Long CPU bursts, short and infrequent I/O bursts.
System BottleneckSecondary storage, network interface, or user response rate.CPU arithmetic-logic speed and memory bus bandwidth.
Scheduler PriorityHigh priority (giving CPU briefly unblocks subsequent I/O).Low/medium priority (run in background without starving I/O).
CPU Utilization ImpactLow per process; relies on multiprogramming to keep CPU busy.High; tends to monopolize the CPU if un-preempted.
ExamplesText editors, web browsers, database queries, file copy tools.Scientific simulations, 3D rendering, video encoding, cryptography.

Process Scheduling Concept and Objectives: Process scheduling is the foundational operating system mechanism by which the CPU scheduler (short-term scheduler) selects an executable process from the ready queue and allocates the CPU to it.

Why We Need Threads (Lightweight Processes): A thread is the smallest schedulable unit of CPU execution within a process. Multiple threads within the same process share its code section, data section, heap, and open OS resources (e.g., file descriptors), but each maintains its own private Program Counter (PC), register set, and execution stack.

Threads are essential for four primary engineering reasons:

  1. Enhanced Responsiveness: In interactive desktop and web applications, executing long-running operations (such as file downloads or database indexing) in a background worker thread ensures the user interface thread remains completely responsive to user clicks and inputs.
  2. Resource Sharing and Memory Efficiency: Creating multiple processes requires duplicating entire virtual address spaces and page tables. Threads share the parent process's memory space, drastically reducing memory consumption.
  3. Low Creation and Context-Switching Overhead: Creating a thread is roughly 10 to 30 times faster than spawning a new process via fork(). Context-switching between threads of the same process is extremely lightweight because memory mapping tables do not change, avoiding expensive Translation Lookaside Buffer (TLB) flushes.
  4. Multicore Parallelism and Scalability: On modern multi-core and multi-processor hardware, different threads of a single application can execute simultaneously on separate physical CPU cores, achieving true hardware parallelism and linear speedup for compute-intensive tasks.
Answer:

An I/O-bound process is characterized by frequent, short CPU bursts dominated by I/O wait times (e.g., text editors), whereas a CPU-bound process performs long, sustained computational bursts with minimal I/O (e.g., scientific modeling). Process scheduling is the OS mechanism that allocates CPU cores among ready processes to optimize CPU utilization, throughput, latency, and fairness. Threads (lightweight processes) are needed to provide interactive responsiveness, enable efficient memory sharing, minimize creation and context-switch overhead, and exploit true multicore hardware parallelism.

All past exam questions for Operating System