Convoy Effect in Scheduling Operating System

About Convoy Effect in OS

On this page, we will learn the concepts of the convoy effect in scheduling operating system. Convoy effect ,or commonly referred to as starvation in FCFS is a situation which makes the CPU and other resources idle for most of the time.

 

convoy effect in scheduling operating system

Convoy Effect in Scheduling Operating System

Convoy effect is a phenomenon which occurs in First Come First Serve Scheduling Algorithm. Consider a process that is too large that occurs at the very start of the ready queue. Due to this long process other processes in the queue may starve for a very long time.

To understand this consider an example. Where a very long train is passing by and smaller cars and other vehicles may have to wait for a very very long time to pass by.

So, as in First Come First Serve Algorithm (FCFS), Jobs are executed as they come. As FCFS is a non-preemptive algorithm, meaning jobs can’t be preempted (stopped) if they have begun execution, so unless the process does not get finished other process can’t get CPU resources.

This situation can be likened to a convoy passing through the road. So, unless the convoy passes completely, other people can’t use the road.

Convoy effect

Steps are as following below which leads to convoy effect:

  • The I/O bound processes are first allocated CPU time ,quickly get executed and goto I/O queues as they are less CPU intensive.
  • Now, the CPU intensive process is allocated CPU time. As its burst time is high, it takes time to complete.
  • While the CPU intensive process is being executed, the I/O bound processes complete their I/O operations and are moved back to ready queue.
  • However, the I/O bound processes are made to wait as the other CPU intensive process still hasn’t finished. This leads to I/O devices being idle and  hence performing inefficiently.
  • When the CPU intensive process gets executed, it is sent to the I/O queue so that it can access an I/O device.
  • Meanwhile, the I/O bound processes get their required CPU time and move back to I/O queue.
  • However, they are made to wait because the CPU intensive process is still accessing an I/O device. As a result, the CPU is sitting idle now.

Hence in Convoy Effect, one slow process affects and slows down the performance of the other processes, and leads to wastage of CPU time and other resources.

To avoid Convoy Effect, preemptive scheduling algorithms like Round Robin Scheduling can be used – as the smaller processes don’t have to wait much for CPU time – making their execution faster and leading to less resources sitting idle.

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription