Open In App

Convoy Effect in Operating Systems

Last Updated : 28 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The Convoy Effect is a phenomenon associated with the First Come First Serve (FCFS) algorithm, in which the whole Operating System slows down due to a few slow processes.

What is the Convoy Effect?

FCFS algorithm is non-preemptive in nature, that is, once CPU time has been allocated to a process, other processes can get CPU time only after the current process has finished. This property of FCFS scheduling leads to the situation called Convoy Effect. Suppose there is one CPU-intensive (large burst time) process in the ready queue, and several other processes with relatively fewer burst times but are Input/Output (I/O) bound (Need I/O operations frequently).

Convoy Effect

Convoy Effect

Steps Involved in Convoy Effect in Operating Systems

Steps are as following below:

  • The I/O bound processes are first allocated CPU time. As they are less CPU intensive, they quickly get executed and goto I/O queues.
  • 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 CPU intensive process still hasn’t finished. This leads to I/O devices being idle.
  • When the CPU intensive process gets over, 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 in Convoy Effect, 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.

Measures to Avoid the Convoy Effect in Operating System

Hence in Convoy Effect, one slow process slows down the performance of the entire set of processes, and leads to wastage of CPU time and other devices. 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.

Examples of Convoy Effect in Operating Systems

Consider there are three processes, P1, P2, and P3. The burst time of process P3 is the highest.

The following formulas in the table are used to compute the waiting time and turnaround time:

Waiting Time = Turn Around Time – Burst Time

Turn Around Time = Completion Time – Arrival Time

Process P3 is the first in the queue in the first scenario, yet it has the longest burst time of all the processes. Because we are using the FCFS scheduling technique, Process P3 will be carried out by the CPU first.

The CPU’s average waiting time will be rather long according to this schedule. The convoy effect is the cause of this. P1 and P2, the other processes, will have to wait 46 units of time for their turn. Whatever the case their burst time is very low. Now this schedule suffers from starvation.

Process ID

Arrival Time

Brust Time

Completion Time

Turn Around Time

Waiting Time

P1

1

1

42

41

40

P2

1

3

45

44

41

P3

0

42

46

46

4

Avg waiting Time of processes = 85/3.

In the second example, the starving issue would not have arisen if Process P1 had arrived at the end of the queue and the other processes P2 and P3 had finished before then.

Let’s look at one more example to see how the waiting periods in the two circumstances differ from one another. Even though the schedule has the same length (45 units), there will be less waiting time with this one.

Process ID

Arrival Time

Brust Time

Completion Time

Turn Around Time

Waiting Time

P1

0

2

4

2

0

P2

0

1

3

3

2

P3

1

42

45

44

2

Avg Waiting Time = 4/3

FAQs on Convoy Effect in Operating System

Q.1: How the Convoy Effect can be reduced in Operating Systems?

Answer:

Preemptive scheduling techniques, like Round Robin Scheduling, can help prevent the Convoy Effect by minimizing the amount of time that smaller processes must wait for CPU time. As a result, they execute more quickly and use less idle resources.

Q.2: Does FCFS have the operating system’s Convoy Effect?

Answer:

If the burst time of the first work entering is the highest among all, First Come First Serve may suffer from the convoy effect. As is evident in real life, other people may be obstructed until the convoy passes completely if it is using the road. This also has an impact on the operating system.

Q.3: What is main difference between the Convoy effect and starvation?

Answer:

The Convoy effect causes slow down the operating system for a short period of time. although, starvation is the indefinite deferment of a process, that it is ready for allocation.



Similar Reads

Operating Systems | Input Output Systems | Question 5
Which of the following is major part of time taken when accessing data on the disk? (A) Settle time (B) Rotational latency (C) Seek time (D) Waiting time Answer: (C) Explanation: Seek time is time taken by the head to travel to the track of the disk where the data to be accessed is stored.Quiz of this Question
1 min read
Operating Systems - GATE CSE Previous Year Questions
Solving GATE Previous Year's Questions (PYQs) not only clears the concepts but also helps to gain flexibility, speed, accuracy, and understanding of the level of questions generally asked in the GATE exam, and that eventually helps you to gain good marks in the examination. Previous Year Questions help a candidate practice and revise for GATE, whic
4 min read
Operating Systems | Set 2
Following questions have been asked in GATE CS exam. 1. Consider a machine with 64 MB physical memory and a 32-bit virtual address space. If the page size is 4KB, what is the approximate size of the page table? (GATE 2001) (a) 16 MB (b) 8 MB (c) 2 MB (d) 24 MB Answer: (c) Explanation: A page entry is used to get address of physical memory. Here we
4 min read
Operating Systems | Set 4
Following questions have been asked in GATE CS exam. 1. Using a larger block size in a fixed block size file system leads to (GATE CS 2003) a) better disk throughput but poorer disk space utilization b) better disk throughput and better disk space utilization c) poorer disk throughput but better disk space utilization d) poorer disk throughput and
3 min read
Operating Systems | Set 5
Following questions have been asked in GATE 2012 exam. 1. A process executes the code fork (); fork (); fork (); The total number of child processes created is (A) 3 (B) 4 (C) 7 (D) 8 Answer (C) Let us put some label names for the three lines fork (); // Line 1 fork (); // Line 2 fork (); // Line 3 L1 // There will be 1 child process created by lin
3 min read
Operating Systems | Set 6
Following questions have been asked in GATE 2011 CS exam. 1) A thread is usually defined as a 'light weight process' because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the followings is TRUE? (A) On per-thread basis, the OS maintains only CPU register state (B) The OS do
4 min read
Operating Systems | Set 10
Following questions have been asked in GATE 2008 CS exam. 1) The data blocks of a very large file in the Unix file system are allocated using (A) contiguous allocation (B) linked allocation (C) indexed allocation (D) an extension of indexed allocation Answer (D) The Unix file system uses an extension of indexed allocation. It uses direct blocks, si
3 min read
Operating Systems | Set 7
Following questions have been asked in GATE CS exam. 1) Let the time taken to switch between user and kernel modes of execution be t1 while the time taken to switch between two processes be t2. Which of the following is TRUE? (GATE CS 2011) (A) t1 > t2 (B) t1 = t2 (C) t1 2) A system uses FIFO policy for page replacement. It has 4 page frames with n
3 min read
Operating Systems | Set 8
Following questions have been asked in GATE 2009 CS exam. 1) In which one of the following page replacement policies, Belady’s anomaly may occur? (A) FIFO (B) Optimal (C) LRU (D) MRU Answer (A) Belady's anomaly proves that it is possible to have more page faults when increasing the number of page frames while using the First in First Out (FIFO) pag
3 min read
Operating Systems | Set 9
Following questions have been asked in GATE 2009 CS exam. 1) In the following process state transition diagram for a uniprocessor system, assume that there are always some processes in the ready state: Now consider the following statements: I. If a process makes a transition D, it would result in another process making transition A immediately. II.
3 min read