0% found this document useful (0 votes)
5 views1 page

Process vs Thread Scheduling Explained

Uploaded by

shriyabs24
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Process vs Thread Scheduling Explained

Uploaded by

shriyabs24
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

OS Cheat Sheet: Process Scheduling vs Thread

Scheduling

1. Process Scheduling vs Thread Scheduling


Aspect Process Scheduling Thread Scheduling
Unit Scheduled Process (with its own address space, resources) Thread (lightweight, shares process resources
OS Awareness Kernel always schedules processes Kernel or library schedules threads
Blocking Effect One process blocking doesn’t stop others ULT: one thread blocking blocks all in process;
Parallelism Needs multiple processes True parallelism with kernel-level threads

2. Multithreading Models
Model Description Pros Cons Examples
Many-to-One Many ULTs mapped to oneFast
KLT context switch, simple
No parallelism, one blocking
Early
thread
Java
blocks
greenallthre
One-to-One Each ULT mapped to one KLT
True parallelism, blocking
Moreonly
overhead,
affects one
kernel
thread
involvement
Windows, Linux pthre
Many-to-Many M ULTs mapped to N KLTsParallelism + efficient management
Complex implementation Solaris (older)
Two-Level Hybrid of M:N with some direct
Flexibility
binding Complexity Solaris (newer)

3. Thread Scheduling Types


• Preemptive: OS can interrupt and switch threads (fair, responsive).
• Cooperative: Threads voluntarily yield CPU (fast but risky).
• Time Slicing: Equal-priority threads share CPU fairly.
• Real-Time Scheduling: RMS (fixed priority by period) or EDF (dynamic by deadline).

4. Example: Linux Completely Fair Scheduler (CFS)


• Treats both processes and threads as tasks.
• Uses a red-black tree ordered by virtual runtime (least CPU time first).
• Ensures fairness across processes and threads alike.

You might also like