issue 117apr 27mmxxvi
est. 2017
Sun, 27 Apr 2026
vol. IX · no. 117
PapersAdda
placement intelligence, since 2017
640+ briefs · 24 campuses · by reservation
verified offers · sourced from r/developersIndia
razorpay₹65.00 LPA· iit-d · sde-1google₹54.00 LPA· iiit-h · swe-imicrosoft₹49.50 LPA· iit-b · sdeatlassian₹38.00 LPA· nit-w · sde-1amazon₹44.20 LPA· bits-p · sde-1uber₹42.00 LPA· iit-kgp · sde-1razorpay₹65.00 LPA· iit-d · sde-1google₹54.00 LPA· iiit-h · swe-imicrosoft₹49.50 LPA· iit-b · sdeatlassian₹38.00 LPA· nit-w · sde-1amazon₹44.20 LPA· bits-p · sde-1uber₹42.00 LPA· iit-kgp · sde-1

Top 30 OS Process Scheduling Interview Questions & Answers (2026)

23 min read
Interview Questions
Updated: 8 Jun 2026
Aditya Sharma
Aditya's Edit

PapersAdda 2026 Placement Cycle

By Aditya Sharma·Founder & Editor, PapersAdda

What changed in 2026 drives

Mass-recruiter offer letters are flatter for 2026 batch - the 4-5 LPA ASE band has barely budged in three years while inflation eats real wages. Premium tracks (Digital, Pro, Elite, Specialist) are still where the differential lives, and they are entirely test-driven. If you are aiming higher than the default offer, the coding round is not optional pageantry - it is the entire interview.

What I'd actually study for this

  • 01Two solid coding-round answers (1 medium-hard DSA each, with edge-case discussion) > five half-baked ones
  • 02One real project you can defend end-to-end - file paths, design decisions, and what you would change
  • 03One DBMS schema you actually built (not a textbook ER diagram), with at least 3 join-heavy queries written from memory
  • 04Three behavioural STAR stories: failure recovered, conflict handled, ownership taken

Where most candidates trip up

The single biggest mistake is treating company-specific guides as primary prep and DSA as secondary. It is the opposite. Mass recruiters use the test as a filter, but premium tracks at every IT services company use coding to allocate offer band. Spend 70% of prep time on DSA + system fundamentals, 20% on company-specific patterns, 10% on HR rehearsal. Reverse that ratio and you collect the default offer.

Editorial commentary by Aditya Sharma · written for PapersAdda · not generated, not aggregated.

Last Updated: June 2026 | Level: Beginner to Advanced | Format: Q&A with Diagrams and Calculations

CPU scheduling is tested in virtually every SDE-1, systems, and embedded interview. Candidates report that Microsoft, Amazon, and Qualcomm ask scheduling algorithm questions alongside design-level questions about real-time systems and fairness. Based on public preparation resources and candidate-reported interview accounts, Gantt chart calculations, SRTF and Round Robin derivations, and real-time scheduling theory appear most frequently. This guide covers 30 of the most important process scheduling questions with Gantt charts described in text, calculations, and comparison tables.


Table of Contents

  1. Scheduling Basics (Q1-Q8)
  2. Algorithm Deep Dives (Q9-Q18)
  3. Advanced Scheduling (Q19-Q25)
  4. Real-Time and Linux (Q26-Q30)

Scheduling Basics

Q1. What is CPU scheduling and why is it needed? Easy

CPU scheduling is the OS mechanism that decides which process in the ready queue gets the CPU next, and for how long. It is needed because:

  • Multiple processes compete for a single CPU at any time.
  • The CPU is idle during I/O waits; scheduling fills that idle time.
  • Different processes have different priority and deadline requirements.

Scheduling happens at three levels:

LevelTriggerAction
Long-term (admission)New job arrivesDecides which jobs enter the ready queue
Medium-term (swapping)Memory pressureSwaps processes to/from disk
Short-term (dispatcher)CPU becomes freePicks the next process to run

Short-term scheduling happens most often (milliseconds) and is what most interview questions address.


Q2. What are the key criteria used to evaluate a scheduling algorithm? Easy

CriterionDefinitionOptimize Direction
CPU Utilization% of time CPU is busyMaximize
ThroughputProcesses completed per unit timeMaximize
Turnaround Time (TAT)Completion time minus arrival timeMinimize
Waiting Time (WT)Total time spent in ready queueMinimize
Response TimeTime from submission to first responseMinimize
FairnessEach process gets a fair share of CPUBalance

Key formulas:

TAT = Completion Time - Arrival Time
WT  = TAT - Burst Time
Response Time = First CPU start - Arrival Time

Q3. What is the difference between preemptive and non-preemptive scheduling? Easy

AspectNon-PreemptivePreemptive
CPU releaseOnly when process exits or waits for I/OOS can forcibly reclaim CPU
Context switchLess frequentMore frequent
Starvation riskYes (long jobs block short ones)Reduced (time slices help)
Real-time suitabilityPoorGood
ExamplesFCFS, SJF (non-preemptive), Priority (non-preemptive)Round Robin, SRTF, Priority (preemptive)

Non-preemptive analogy: A customer at a bank counter who must finish before the next is served. Preemptive analogy: An emergency interrupts an ongoing call; the operator pauses and handles the emergency.


Q4. What is a context switch? What information does the OS save? Easy

A context switch is the process of saving the CPU state of a currently running process and loading the state of the next scheduled process.

Information saved in the Process Control Block (PCB):

PCB Contents:
├── Process ID (PID)
├── Program Counter (PC) -- next instruction to execute
├── CPU registers (general-purpose, stack pointer, flags)
├── Memory maps (page tables, segment tables)
├── Open file descriptors
├── Scheduling priority and accounting data
└── I/O status

Context switches have zero useful work done during the switch itself. Heavy preemption means more overhead. This is why time quantum selection in Round Robin is critical.


Q5. What is the dispatcher and how does it differ from the scheduler? Medium

ComponentRoleLatency
SchedulerSelects which process runs next (policy decision)Runs infrequently
DispatcherActually hands CPU to selected process (mechanism)Runs on every context switch

Dispatcher tasks:

  1. Context switch: saves old process state, loads new state.
  2. Switch to user mode (from kernel mode).
  3. Jump to the correct instruction in the program.

Dispatch latency is the time between one process stopping and the next starting. Minimizing this is critical for interactive systems.


Q6. What is convoy effect and which algorithm causes it? Medium

Convoy effect occurs when a single long CPU-bound process holds the CPU, causing all shorter processes behind it to wait. This is characteristic of FCFS (First Come First Served).

Example:

Processes: P1 (burst=24ms), P2 (burst=3ms), P3 (burst=3ms)
Arrival order: P1, P2, P3

Gantt chart:
| P1 (0-24) | P2 (24-27) | P3 (27-30) |

WT: P1=0, P2=24, P3=27
Average WT = (0+24+27)/3 = 17ms  [HIGH -- convoy effect]

If P2,P3 arrived first:
| P2 (0-3) | P3 (3-6) | P1 (6-30) |
Average WT = (6+0+3)/3 = 3ms  [MUCH BETTER]

The convoy effect is one reason FCFS is rarely used alone in production systems.


Q7. What is starvation? How is it prevented? Easy

Starvation is the indefinite postponement of a process because higher-priority processes keep arriving and grabbing the CPU.

Algorithms susceptible to starvation:

  • Priority Scheduling (a low-priority process may never run if high-priority processes keep arriving).
  • SJF/SRTF (very long jobs may never get the CPU).

Solution: Aging Aging gradually increases the priority of a waiting process over time. A process waiting for 15 minutes might have its priority raised by 1 level every 5 minutes, ensuring it eventually runs.


Q8. What is the difference between throughput and turnaround time? Easy

  • Throughput: Number of processes completed per unit time. A high-throughput scheduler runs many short jobs quickly. Batch systems optimize for this.
  • Turnaround time (TAT): How long a specific process takes from arrival to completion. Interactive systems optimize for this (user wants a fast response for their task).

These goals sometimes conflict: a scheduler that always picks the shortest job maximizes throughput but can starve long jobs (high TAT for them).


Algorithm Deep Dives

Q9. Explain FCFS scheduling with an example and Gantt chart. Easy

FCFS (First Come First Served): Non-preemptive. Processes are served in arrival order.

Example:

Process | Arrival | Burst
P1      |   0     |  5
P2      |   1     |  3
P3      |   2     |  8
P4      |   3     |  6

Gantt chart:
| P1(0-5) | P2(5-8) | P3(8-16) | P4(16-22) |

Completion: P1=5, P2=8, P3=16, P4=22
TAT:        P1=5, P2=7, P3=14, P4=19   Average TAT = 11.25
WT:         P1=0, P2=4, P3=6,  P4=13   Average WT  = 5.75

Advantages: Simple, no starvation (eventually every process runs). Disadvantages: Convoy effect, poor average waiting time.


Q10. Explain SJF and SRTF scheduling. Calculate example. Medium

SJF (Shortest Job First): Non-preemptive. Picks the process with the shortest burst time from the ready queue. SRTF (Shortest Remaining Time First): Preemptive version of SJF. When a new process arrives, if its burst is shorter than the remaining time of the current process, a preemption happens.

SJF Example (same processes as Q9):

At t=0: only P1 available. Run P1 (burst=5).
At t=5: P2(3), P3(8), P4(6) available. Pick P2.
At t=8: P3(8), P4(6) available. Pick P4.
At t=14: P3(8) remaining. Run P3.

Gantt: | P1(0-5) | P2(5-8) | P4(8-14) | P3(14-22) |

TAT: P1=5, P2=7, P3=20, P4=11   Average TAT = 10.75
WT:  P1=0, P2=4, P3=12, P4=5    Average WT  = 5.25

SJF gives optimal average waiting time among non-preemptive algorithms for a given set of processes.

Problem: Requires knowing burst times in advance (impractical in general). Solution: predict burst time using exponential averaging:

tau(n+1) = alpha * t(n) + (1 - alpha) * tau(n)
where t(n) = actual burst, tau(n) = predicted burst, alpha in [0,1]

Q11. Explain Round Robin scheduling. How does quantum size affect performance? Medium

Round Robin: Each process gets a fixed time slice (quantum). When the quantum expires, the process is preempted and moved to the back of the ready queue.

Example (quantum = 2ms):

Process | Arrival | Burst
P1      |   0     |  5
P2      |   0     |  3
P3      |   0     |  4

Gantt:
| P1(0-2) | P2(2-4) | P3(4-6) | P1(6-8) | P2(8-9) | P3(9-11) | P1(11-12) |

TAT: P1=12, P2=9, P3=11    Average TAT = 10.67
WT:  P1=7,  P2=6, P3=7     Average WT  = 6.67

Quantum size impact:

QuantumBehavior
Very small (1ms)Behaves like processor sharing; very responsive but context-switch overhead dominates
Very large (infinite)Degenerates to FCFS; no preemption
Rule of thumbQuantum should be > 80% of CPU bursts to minimize context switches while maintaining responsiveness

Typical OS: 10-100ms time quantum.


Q12. Explain Priority Scheduling. What problem does it have and how is it solved? Medium

Each process has a priority number. CPU goes to the highest-priority (lowest number in many OS) process.

Can be preemptive or non-preemptive:

  • Preemptive: A higher-priority arriving process immediately preempts the current.
  • Non-preemptive: Higher-priority process waits for current to finish its burst.

Priority Inversion Problem: A high-priority task waits for a resource held by a low-priority task, but a medium-priority task keeps preempting the low-priority task, blocking the high-priority one indefinitely.

Priority: H > M > L (H=high, M=medium, L=low)

1. L acquires mutex
2. H needs mutex, blocks on L
3. M arrives and preempts L (M > L)
4. H is stuck waiting for M to finish, then L to finish
   Result: H, the highest priority, runs LAST

Solution: Priority Inheritance Protocol (PIP) When L holds a resource that H needs, L temporarily inherits H's priority. This prevents M from preempting L until the mutex is released.

Mars Pathfinder Mission (1997): The spacecraft suffered resets due to priority inversion. VxWorks had priority inheritance disabled. Enabling it remotely from Earth fixed the issue.


Q13. What is Multilevel Queue Scheduling? Medium

The ready queue is split into multiple separate queues, each with its own scheduling algorithm.

Classic setup:

Queue 1: Interactive (foreground) -- Round Robin
Queue 2: Interactive editing     -- Round Robin
Queue 3: Batch background        -- FCFS
Queue 4: System processes        -- FCFS

Priority: Queue 1 > Queue 2 > Queue 3 > Queue 4

Processes are permanently assigned to a queue based on type (interactive, batch, system). Inter-queue scheduling is typically fixed priority (queue 1 must be empty before queue 2 runs).

Problem: Low-queue processes can starve. Solution: Multilevel Feedback Queue.


Q14. What is Multilevel Feedback Queue Scheduling? Hard

MLFQ is like multilevel queue but processes can move between queues based on their CPU usage behavior.

Rules:

  1. Processes start in the highest-priority queue.
  2. If a process uses its full time quantum, it is demoted to the next lower queue.
  3. If a process yields before its quantum expires (I/O bound), it stays or moves up.
  4. To prevent starvation, periodically boost all processes to the top queue.

Behavior:

New process --> Q0 (quantum=8ms)
   if uses full 8ms --> Q1 (quantum=16ms)
   if uses full 16ms --> Q2 (FCFS, unlimited)
   periodically all processes boosted back to Q0

Why it works: CPU-bound processes naturally sink to lower queues (longer quanta, lower priority). I/O-bound interactive processes stay in high queues (short CPU bursts, quick yields), getting fast response times.

MLFQ is the basis of many real OS schedulers including older Windows and macOS versions.


Q15. Calculate waiting time and turnaround time for a given scheduling scenario. Medium

This is a pure calculation question that appears in virtually every written OS exam.

Template approach for any algorithm:

Step 1: Draw the Gantt chart by simulating the algorithm.
Step 2: Note Completion Time (CT) for each process.
Step 3: TAT = CT - Arrival Time
Step 4: WT  = TAT - Burst Time
Step 5: Average WT = sum(WTs) / number of processes
Step 6: Average TAT = sum(TATs) / number of processes

SRTF Practice Problem:

Process | Arrival | Burst
P1      |   0     |  8
P2      |   1     |  4
P3      |   2     |  9
P4      |   3     |  5

Simulation:
t=0: P1 runs (remaining=8)
t=1: P2 arrives (burst=4 < P1 remaining=7). Preempt P1. Run P2.
t=2: P3 arrives (burst=9 > P2 remaining=3). P2 continues.
t=3: P4 arrives (burst=5 > P2 remaining=2). P2 continues.
t=5: P2 done. Ready: P1(7), P3(9), P4(5). Pick P4 (shortest).
t=10: P4 done. Ready: P1(7), P3(9). Pick P1.
t=17: P1 done. Run P3.
t=26: P3 done.

Gantt: |P1(0-1)|P2(1-5)|P4(5-10)|P1(10-17)|P3(17-26)|

CT: P1=17, P2=5, P3=26, P4=10
TAT: P1=17, P2=4, P3=24, P4=7   Average TAT = 13
WT:  P1=9,  P2=0, P3=15, P4=2   Average WT  = 6.5

Q16. What is the Banker's Algorithm and how does it relate to scheduling? Hard

The Banker's Algorithm is a deadlock-avoidance algorithm, not a scheduling algorithm per se, but it is often asked alongside scheduling because it governs whether a process can be allocated resources before it runs.

Core idea: Before granting resources, the OS simulates whether granting them leaves the system in a safe state (a state where all processes can eventually complete).

Safe state check:

Available = [3, 3, 2]  (instances of R1, R2, R3)

Process | Max    | Allocated | Need (Max-Allocated)
P0      | 7,5,3  | 0,1,0     | 7,4,3
P1      | 3,2,2  | 2,0,0     | 1,2,2
P2      | 9,0,2  | 3,0,2     | 6,0,0
P3      | 2,2,2  | 2,1,1     | 0,1,1
P4      | 4,3,3  | 0,0,2     | 4,3,1

Safe sequence: P1 -> P3 -> P4 -> P0 -> P2
(Each step: check if Need <= Available; if yes, run, release resources, add to Available)

If no safe sequence exists, the OS refuses the request (even if physical resources are available). The process must wait.


Q17. What is aging in scheduling and how is it implemented? Medium

Aging is a technique to prevent starvation by gradually increasing the priority of long-waiting processes.

Simple implementation:

Every T minutes, for each waiting process:
    priority = priority - 1  (lower number = higher priority)
    if priority < 0: priority = 0

Example: A process with priority 127 (lowest) that has waited 63 * T minutes will have priority 64. After 127 * T minutes, priority = 0, effectively making it the most urgent.

In practice: Linux's Completely Fair Scheduler handles this differently through virtual runtime tracking (processes with less CPU time get higher effective priority) rather than explicit aging.


Q18. How does Thread Scheduling differ from Process Scheduling? Medium

AspectProcess SchedulingThread Scheduling
Managed byOS kernelKernel (kernel threads) or user library (user threads)
Context switch costHigh (full address space)Lower (shared address space, only register/stack swap)
Contention scopeSystem-wideProcess-Contention Scope (PCS) within process, or System-Contention Scope (SCS) system-wide
Examplefork() creates new processpthread_create() creates kernel thread

User-level threads vs. kernel-level threads in scheduling:

  • User-level (M:1 model): Many user threads map to one kernel thread. OS schedules the kernel thread; user library schedules among user threads. If one blocks on I/O, ALL block (OS sees only one kernel thread).
  • Kernel-level (1:1 model): Each user thread = one kernel thread. OS can schedule each independently. This is the model used by Linux (POSIX pthreads on Linux = kernel threads).

Advanced Scheduling

Q19. What is the difference between I/O-bound and CPU-bound processes? How do schedulers handle each? Medium

CharacteristicCPU-BoundI/O-Bound
Burst patternLong CPU bursts, infrequent I/OShort CPU bursts, frequent I/O
ExampleVideo encoding, matrix multiplyDatabase query, file copy
Scheduler preferenceGets lower priority in interactive systemsGets higher priority (needs fast response)
Scheduling algorithm fitFCFS or lower-priority multilevel queueRound Robin or top multilevel queue

Why prefer I/O-bound processes? When an I/O-bound process runs, it quickly issues an I/O request and leaves the CPU. A CPU-bound process runs for its full quantum, delaying I/O-bound processes. By prioritizing I/O-bound processes, the scheduler:

  • Keeps I/O devices busy (better device utilization).
  • Keeps interactive processes responsive.
  • Lets CPU-bound work fill gaps between I/O waits.

Q20. What is the Completely Fair Scheduler (CFS) used in Linux? Hard

Linux's CFS (since kernel 2.6.23) replaces the traditional priority-based O(1) scheduler with a fair-share model.

Core concept: Virtual Runtime (vruntime)

  • Each task has a vruntime value tracking how much CPU time it has received, weighted by priority.
  • Higher-priority tasks accumulate vruntime more slowly (as if time moves slower for them).
  • The scheduler always runs the task with the smallest vruntime.

Data structure: Red-black tree, ordered by vruntime. The leftmost node (lowest vruntime) is always the next to run. Insertion/deletion: O(log n).

vruntime update:
delta_exec = actual_time_run
vruntime += delta_exec * (NICE_0_LOAD / task_weight)

Higher nice (lower priority) -> lower task_weight -> larger vruntime increase -> less CPU time

Key properties:

  • No starvation: every task's vruntime grows; the lowest-vruntime task always gets next turn.
  • Smooth interactivity: I/O-bound tasks that sleep frequently have low vruntime; when they wake, they immediately get the CPU.
  • Group scheduling: cgroups can receive a weighted share of CPU.

Q21. What is Gang Scheduling in multi-processor systems? Hard

Gang Scheduling (also called coscheduling) is a multiprocessor scheduling technique where related threads of a process are scheduled simultaneously on different CPUs.

Why it matters: In parallel programs, threads communicate and synchronize. If Thread A runs on CPU1 but Thread B (which A is waiting for) is not scheduled, Thread A spins or blocks, wasting CPU1.

Gang scheduling approach:

  • Group related threads into a "gang."
  • Schedule the entire gang at the same time across multiple CPUs.
  • All members of a gang start and stop together.

Trade-off: If a process has 4 threads but the machine has 2 free CPUs, the gang waits. This reduces throughput but improves latency for parallel workloads.

Used in: High-performance computing clusters, older Cray supercomputers.


Q22. What is Processor Affinity? Medium

Processor Affinity is the tendency (or requirement) to run a process on the same CPU it previously ran on.

Why it helps: When a process runs on CPU-X, its data fills CPU-X's cache. If it migrates to CPU-Y, it suffers cache misses until CPU-Y's cache warms up.

TypeDescription
Soft affinityOS tries to keep process on same CPU but may migrate if load imbalance requires it
Hard affinityProcess is pinned to specific CPU(s); OS never migrates it

Linux: sched_setaffinity() system call sets the CPU affinity mask for a process. Production use: Database servers (MySQL, PostgreSQL) often pin listener threads to specific cores to maximize cache efficiency.


Q23. What is load balancing in multiprocessor scheduling? Medium

Load balancing is the OS technique of distributing workload evenly across all CPUs to prevent some CPUs from being idle while others are overloaded.

Two approaches:

ApproachHow it worksOverhead
Push migrationOS kernel periodically checks CPU loads; pushes tasks from overloaded CPU to idle CPUsLow (periodic check)
Pull migrationIdle CPU pulls a task from another CPU's run queueResponsive but frequent

Linux scheduler uses both, running load balancing on each scheduling tick.

Conflict with affinity: Load balancing and cache affinity are opposed goals. Linux resolves this by migrating tasks only when the load imbalance exceeds a threshold, accepting some cache miss penalty for better overall CPU utilization.


Q24. What is the difference between cooperative and preemptive multitasking? Easy

AspectCooperativePreemptive
Who controls CPU releaseThe running process itself (yields voluntarily)The OS (via timer interrupt)
RiskA buggy or malicious process can monopolize CPUOS always retains control
Context switch pointsAt explicit yield() or I/O callsAt any timer tick
ExamplesEarly Windows (3.x), early macOS, classic Mac OSWindows 95+, Linux, modern macOS

Why cooperative multitasking failed: A single misbehaving application could freeze the entire system. Preemptive multitasking gave the OS guaranteed control via hardware timer interrupts.


Q25. What is the relationship between scheduling and power management? Medium

Modern schedulers integrate with power management (DVFS, C-states) to balance performance and energy.

DVFS (Dynamic Voltage and Frequency Scaling):

  • When CPU utilization is low, the OS/hardware reduces CPU frequency and voltage.
  • When a CPU-intensive task arrives, frequency ramps up.
  • Schedulers like Linux's EAS (Energy Aware Scheduler) consider the energy cost of running a task on a big vs. little core (ARM big.LITTLE).

CPU C-States (idle states):

  • C0: Active
  • C1: Clock halted (idle thread)
  • C3-C6: Deeper sleep (cache flushed, longer wakeup latency)

The scheduler's idle logic determines which C-state to enter based on predicted next wake time. A scheduler that incorrectly predicts long idle time and enters C6 may add 100+ microsecond latency when a task wakes.


Real-Time and Linux

Q26. What is a real-time operating system (RTOS)? What scheduling algorithms do RTOSes use? Hard

An RTOS is an OS designed to process tasks within guaranteed time bounds (deadlines). Correctness depends not only on logical output but also on when the output is produced.

Types:

  • Hard real-time: Missing a deadline is a system failure. Example: airbag controller, fly-by-wire.
  • Soft real-time: Missing a deadline degrades quality but does not cause failure. Example: video streaming, VoIP.

RTOS scheduling algorithms:

AlgorithmBasisOptimal?
Rate Monotonic (RM)Fixed priority; higher frequency = higher priorityOptimal among fixed-priority for periodic tasks
Earliest Deadline First (EDF)Dynamic priority; nearest deadline = highest priorityOptimal among dynamic-priority algorithms
Least Laxity First (LLF)Priority = deadline - remaining exec timeOptimal but high overhead

Rate Monotonic test: A task set is schedulable if:

Sum of (Ci / Ti) <= n * (2^(1/n) - 1)
where n = number of tasks, Ci = exec time, Ti = period
For n -> infinity: limit = ln(2) = 0.693

Q27. What is EDF (Earliest Deadline First) scheduling? Hard

EDF is a dynamic priority algorithm. At every scheduling point, the task with the earliest absolute deadline gets the CPU.

Example:

Task | Period | Exec Time | Deadline
T1   |   4    |    1      | end of each period
T2   |   5    |    2      | end of each period

Timeline:
t=0: T1(d=4), T2(d=5). Pick T1 (earlier deadline). T1 runs 0-1.
t=1: T2(d=5). T2 runs 1-3.
t=3: Idle until t=4.
t=4: T1(d=8), T2(d=5). Pick T2 (deadline=5 < 8). T2 runs 4-5.
t=5: T1(d=8). T1 runs 5-6.
t=6: Idle until t=8.
t=8: T1(d=12), T2(d=10). Pick T2. T2 runs 8-10.
... and so on.

EDF can achieve 100% CPU utilization for valid task sets (vs. ~69.3% for Rate Monotonic).

EDF in Linux: The SCHED_DEADLINE scheduling class (since kernel 3.14) implements EDF for tasks with explicit deadline, period, and runtime constraints.


Q28. What is the Linux nice value and how does it affect scheduling? Medium

nice is a Unix/Linux mechanism to adjust a process's scheduling priority relative to others.

Range: -20 (highest priority) to +19 (lowest priority). Default is 0.

Relationship to CFS weights:

nice -20 -> weight = 88761  (gets ~10x more CPU than nice 0)
nice   0 -> weight = 1024
nice +19 -> weight = 15     (gets ~1/60th CPU of nice 0)

Each unit of nice change alters the CPU share by approximately 10%.

Commands:

nice -n 10 ./my_batch_job     # Start with nice=10
renice -n -5 -p 1234          # Change running process 1234 to nice=-5

Real-world use: Backup jobs run at nice +19 to avoid impacting interactive workloads. Build servers use nice +10 to keep the developer's IDE responsive.


Q29. What are the POSIX real-time scheduling policies? Hard

POSIX defines these scheduling policies for real-time use:

PolicyTypeBehavior
SCHED_FIFOReal-time, static priorityRuns until voluntarily yields or higher-priority task preempts. No time slicing.
SCHED_RRReal-time, static priorityRound Robin with time slices among equal-priority tasks.
SCHED_OTHER (or SCHED_NORMAL)NormalLinux CFS. Used for most processes.
SCHED_DEADLINEReal-time, dynamicEDF-based. Requires deadline/period/runtime specification.

Priority: SCHED_FIFO and SCHED_RR tasks (priority 1-99) always preempt SCHED_OTHER tasks (effective priority 0). A SCHED_FIFO task at priority 50 preempts all SCHED_OTHER tasks regardless of their nice values.


Q30. How would you design a scheduler for a mixed workload (interactive + batch + real-time)? Hard

This is a systems design question. A well-structured answer:

Partition into scheduling classes (Linux-style):

Class 1: SCHED_DEADLINE (real-time, EDF)     -- highest priority
Class 2: SCHED_FIFO / SCHED_RR              -- real-time, below deadline
Class 3: SCHED_NORMAL (CFS)                 -- interactive + batch
Class 4: SCHED_IDLE                         -- lowest, only when nothing else runs

Within SCHED_NORMAL (CFS), differentiate interactive vs. batch:

  • Track I/O sleepiness: processes that sleep frequently get a scheduling bonus (earlier wake-run).
  • Use cgroups to cap batch CPU share: cpu.shares in the batch cgroup set to 512 vs. 1024 for interactive.

Admission control for real-time tasks:

  • Before admitting a SCHED_DEADLINE task, verify: sum of (runtime/period) across all deadline tasks + existing utilization <= configured RT throttle (default 95% in Linux: kernel.sched_rt_runtime_us).

Anti-starvation: Linux's RT throttle at 95% ensures CFS tasks always get at least 5% CPU even if real-time tasks are misbehaving.

Monitoring: Expose per-cgroup CPU scheduling statistics via /sys/fs/cgroup/cpu.stat for SRE observability.


FAQ

Q: Which scheduling algorithm gives minimum average waiting time? SJF gives the minimum average waiting time among non-preemptive algorithms for a fixed set of processes arriving simultaneously. SRTF is optimal for preemptive algorithms.

Q: Can Round Robin starve processes? No. Every process gets the CPU after at most (n-1) * quantum time, where n is the number of processes. Round Robin is starvation-free by design.

Q: What scheduling algorithm does Windows use? Windows uses a multilevel feedback queue with 32 priority levels. Interactive processes get a priority boost. It is classified as a preemptive, priority-based, time-slicing scheduler.

Q: What is the difference between scheduling and dispatching? Scheduling is the policy decision (which process next). Dispatching is the mechanism that actually performs the context switch and hands the CPU to the selected process.


Related PapersAdda guides:

Methodology applied to this articlelast verified 8 Jun 2026
Sources used
Public exam-pattern documents, official recruiter pages, and verified candidate reports on r/developersIndia and LinkedIn.
Verification window
Page last edited 8 Jun 2026 by Aditya Sharma. Numbers and patterns sanity-checked against the most recent 2026 cycle drives we tracked.
What we did NOT do
  • No fabricated salary numbers or success rates. If we quote a range, it's sourced.
  • No noun-substituted templates. This article was not generated by swapping company names in a stock prompt.
  • No paid placements, sponsored coaching links, or affiliate-shilled course pushes.
Verification policy: /editorial-standards/. Found something incorrect? Submit a correction - we respond within 48 hours.

Explore this topic cluster

More resources in Interview Questions

Use the category hub to browse similar questions, exam patterns, salary guides, and preparation resources related to this topic.

Paid contributor programme

Sat this this year? Share your story, earn ₹500.

First-person experience reports help future candidates prep smarter. We pay verified contributors ₹500 via UPI per accepted story - with byline.

Submit your story →

Ready to practice?

Take a free timed mock test

Put what you learned into practice. Our mock tests match the 2026 pattern with timer, navigator, reveal, and score breakdown. No signup.

Start Free Mock Test →

More from PapersAdda

Share this guide: