Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8356117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:05:15+00:00 2026-06-09T10:05:15+00:00

I understand how preemptive SJF Scheduling works but I dont know how to calculate

  • 0

SJF Table and its Gantt Chart

I understand how preemptive SJF Scheduling works but I dont know how to calculate the average waiting time..
This example is taken from ‘OS Principles’ by Galvin, Gagne and Silberschatz.
They calculate the average waiting time as:
((10-1)+(1-1)+(17-2)+(5-3)) / 4 = 6.5ms
How is this calculated? Please simplify.
Also, it would be great if you could solve the same using RR algorithm with time quantum of say… 5ms (for simple calculation) and explain how to calculate the avg waiting time

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:05:16+00:00Added an answer on June 9, 2026 at 10:05 am

    Just look at the diagram and calculate for every process, how much time he have been waiting:

    P1 run at the beginning 1 time (he is the only one) thus he wait 0 here. Than, he wait from time 1 until time 10 -> total waiting time = (10-1).

    P2 arrive in time 1, and start running right away. So he didn’t wait at all -> (1-1).

    P3 arrive in time 2, and begin running in time 17 -> (17-2).

    P4 arrive in time 3, and start running in time 5 -> total waiting time = (5-3).

    Thus, the average waiting time = ((10-1)+(1-1)+(17-2)+(5-3))/4 = 6.5ms.

    EDIT :
    For RR with 5 quanta, that’s what gonna happen:

    P1 arrives, and get quanta of 5ms -> in time 5, he stops with remaining burst of 3.
    Next, P2 will start running from time 5 to time 9. (his burst is only 4). So you get P2 waited for (5-1).

    P3 will start running, from time 9 to time 14 with remaining burst of 4. Next, P4 will start running from time 14 to time 19 and will end. Total waiting time for P4 is (14-3).

    Than P1 will continue running from time 19 to time 22 and will end. Total waiting time for P1 is (19-5). Than, P3 continue running from time 22 to time 26. Total waiting time for P3 is (9-2) + (22-14).

    So you get average running time = ((5-1)+(14-3)+(19-5)+(9-2)+(22-14))/4 = 10.5ms

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand this is an easy question but for some reason this just isn't
I understand what weak tables are. But I'd like to know where weak tables
I understand that this a very noob problem, but when I try to create
I understand that this may not necessarily apply to just @properties, but they would
Understand that 1x1 widget size should be 72 dip x 72 dip, but this
I've been reading this for quite some time but doesn't make sense to me..
I understand this is somewhat trivial but... What the best way to get the
I understand I can create an enum like this: public enum MyEnum { ONE(1),
Understand that the subject should be discussed before. But as I haven't found the
I understand why there isn't a method built in to do this, however I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.