0
655views
Differentiate the following: i) Process vs Thread ii) Preemptive vs Non-preemptive Scheduling
1 Answer
0
6views

i) Process vs Thread

Process:

  • Program under execution
  • Process-related information is stored in PCB(Process control block)
Process Control Block
Process ID
Process state
Program Counter
CPU Registers
CPU Scheduling Algorithm
Page Table Info
Device Info

Thread:

  • Thread is part of a process
  • Also called light-weight process
Process Threads
Processes don't share memory A thread is a sub-part of process.
Light-weight process.
A process is a program under execution i.e an active program Threads require less time for context switching as
they are lighter than processes
Processes require more time for context
switching as they are more heavy
A thread may share some memory with its peerthreads
Communication between processes requires
more time than between threads
Communication between threads requires less
time than between processes
If a process gets blocked, remaining
processes cancontinue execution
If a thread gets blocked, all of its peer threads also
get blocked
Individual processes are independent of each other Threads are parts of a process and so are dependent
Require more resources than threads Need less resources than processes
Require more time for creation Require less time for creation
Require more time for termination Require less time for termination

ii) Preemptive vs Non-preemptive Scheduling

Preemptive Scheduling

Circumstances:

  • Process switches from running state to ready state.
  • Process switches from waiting state to ready state.
  • CPU is allocated to a process for a limited time.
  • If process with high priority arrives the current running process is interrupted .
  • Preemptive scheduling is flexible but has overhead of switching processes.
  • Example: round robin, shortest remaining job first, and priority scheduling

Non-Preemptive Scheduling

Circumstances:

  • Process switches from running state to waiting state.
  • Process terminates.
  • CPU is allocated to a process till it gets terminated or enters a waiting state.
  • Average waiting time of the process is increased.
  • Process in a running state is not interrupted even for process with high priority.
  • Example: first come first serve, shortest job first.
Preemptive Scheduling Non-Preemptive Scheduling
CPU is allocated to a process forlimited time. CPU is allocated to a process till
it complete burst time or switches to waiting state.
Process can be interruptedin between Process can not be interrupted in between
Low priority process may starve Process with short burst time may starve
Switching the processes
frequently increases the overhead
Doesn't have switching overhead
Preemptive scheduling is flexible Non-Preemptive scheduling is rigid
Cost associated No cost associated
Round Robin, Priority Scheduling,
Shortest Remaining Time First,etc.
First Come First serve, Shortest
Job First, etc.
Please log in to add an answer.