Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Notes  >  Operating System  >  Longest Remaining Time First (LRTF) CPU Scheduling Algorithm

Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE) PDF Download

Longest Job First Algorithm

In LJF Scheduling,

  • Out of all the available processes, CPU is assigned to the process having largest burst time.
  • In case of a tie, it is broken by FCFS Scheduling.
    Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)
  • LJF Scheduling can be used in both preemptive and non-preemptive mode.
  • Preemptive mode of Longest Job First is called as Longest Remaining Time First (LRTF).

Advantages-

  • No process can complete until the longest job also reaches its completion.
  • All the processes approximately finishes at the same time.

Disadvantages-

  • The waiting time is high.
  • Processes with smaller burst time may starve for CPU.

Problems Based on LJF Scheduling

Problem 1: Consider the set of 5 processes whose arrival time and burst time are given below-

Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)

If the CPU scheduling policy is LJF non-preemptive, calculate the average waiting time and average turn around time.

Gantt Chart-
Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)Now, we know-

  • Turn Around time = Exit time – Arrival time
  • Waiting time = Turn Around time – Burst time
    Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)

Now,

  • Average Turn Around time = (3 + 19 + 16 + 5 + 10) / 5 = 53 / 5 = 10.6 unit
  • Average waiting time = (0 + 17 + 12 + 0 + 4) / 5 = 33 / 5 = 6.6 unit


Problem 2: Consider the set of 4 processes whose arrival time and burst time are given below-

Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)If the CPU scheduling policy is LJF preemptive, calculate the average waiting time and average turn around time.

Gantt Chart-
Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)

Now, we know-

  • Turn Around time = Exit time – Arrival time
  • Waiting time = Turn Around time – Burst time

Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)

Now,

  • Average Turn Around time = (17 + 17 + 17 + 17) / 4 = 68 / 4 = 17 unit
  • Average waiting time = (15 + 13 + 11 + 9) / 4 = 48 / 4 = 12 unit


Problem 3: Consider three processes (process id 0, 1, 2 respectively) with compute time bursts 2, 4 and 8 time units. All processes arrive at time zero. Consider the longest remaining time first (LRTF) scheduling algorithm. In LRTF, ties are broken by giving priority to the process with the lowest process id. The average turn around time is-
(a) 13 unit
(b) 14 unit
(c) 15 unit
(d) 16 unit

 We have the set of 3 processes whose arrival time and burst time are given below-
Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)

Gantt Chart-
Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)

Now, we know-
Turn Around time = Exit time – Arrival time
Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)
Now,
Average Turn Around time = (12 + 13 + 14) / 3 = 39 / 3 = 13 unit
Thus, Option (a) is correct.

The document Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Operating System.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
10 videos|99 docs|33 tests

Top Courses for Computer Science Engineering (CSE)

10 videos|99 docs|33 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

pdf

,

Viva Questions

,

study material

,

practice quizzes

,

Free

,

video lectures

,

Summary

,

Objective type Questions

,

Important questions

,

Sample Paper

,

ppt

,

Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)

,

shortcuts and tricks

,

Semester Notes

,

past year papers

,

Previous Year Questions with Solutions

,

mock tests for examination

,

Extra Questions

,

MCQs

,

Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)

,

Exam

,

Longest Remaining Time First (LRTF) CPU Scheduling Algorithm | Operating System - Computer Science Engineering (CSE)

;