4 Replies - 2211 Views - Last Post: 02 November 2013 - 04:56 PM Rate Topic: -----

#1 codinator   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 08-April 13

System Programing | Scheduling Times

Posted 02 November 2013 - 09:36 AM

I'm trying to understand these scheduling algorithms:

First-Come-First-Served (FCFS)
Shortest job first (SJF)
Shortest remaining time (SRT)
Round-robin (RR)
So, given some input:

Process Name: A; Arrival Time: 0; Expected CPU Running Time: 3
Process Name: B; Arrival Time: 1; Expected CPU Running Time: 5
Process Name: C; Arrival Time: 3; Expected CPU Running Time: 2
Process Name: D; Arrival Time: 9; Expected CPU Running Time: 5
Process Name: E; Arrival Time: 12; Expected CPU Running Time: 5


FCFS would schedule as AAABBBBBCCDDDDDEEEEE.

I can't seem to figure the rest out. Can someone help explain the difference to me?

I tried Googling but the result I got for SJF is kind confusing.

This post has been edited by codinator: 02 November 2013 - 09:41 AM


Is This A Good Question/Topic? 0
  • +

Replies To: System Programing | Scheduling Times

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5207
  • View blog
  • Posts: 13,957
  • Joined: 18-April 07

Re: System Programing | Scheduling Times

Posted 02 November 2013 - 10:42 AM

Well, out of the list of processes, which one has the shortest running time? Probably C right? That would be then scheduled first. Thus... shortest... job... first.

Shortest remaining time would be that out of all jobs, which will finish first. In other words, which job has the least remaining time left on it. You would then schedule in order of which is finishing first (shortest REMAINING TIME left on the job).

Round robin is simply going from process to process in a circular fashion. Giving a slice of time to each process. It gives a slice to A, then to B, then to C, then to D, E and then back to A. This scheme means that no process gets priority over the other.

:)
Was This Post Helpful? 1
  • +
  • -

#3 codinator   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 08-April 13

Re: System Programing | Scheduling Times

Posted 02 November 2013 - 10:57 AM

AAACCBBBBBDDDDDEEEEE for SJF? and i still dont get what you meant for SRT
Was This Post Helpful? 0
  • +
  • -

#4 codinator   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 08-April 13

Re: System Programing | Scheduling Times

Posted 02 November 2013 - 11:27 AM

ABBCCAABBBDDDDDEEEEE for SRT?
Was This Post Helpful? 0
  • +
  • -

#5 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5207
  • View blog
  • Posts: 13,957
  • Joined: 18-April 07

Re: System Programing | Scheduling Times

Posted 02 November 2013 - 04:56 PM

Well as the processes proceed, some are going to have a higher priority than others. Meaning they will get a majority share of the cycles. This means that some processes are going to be moving faster than others. Let's say for instance that E is high priority. It might be moving faster so the remaining time on it may be only 1 second while the others are 2 seconds and above. Thus it would try to schedule the process with the least remaining time left on the clock first. In other words, it would try to get whatever is going to be done the quickest first.

An analogy would be like you had three egg timers. One you started for 3 minutes, one for 10 minutes and one for 20 minutes. They are all started at the same time. After one minute they would be 2 min, 9 min and 19 min. It would then say, the remaining time on the first egg timer, being only 2 minutes left, should then be scheduled with higher priority. "Let's hurry up the first time by giving it priority so that it will finish faster and we can get it out of the way. We then can go to the next one, 9 minutes, and finish that next."

Let's say that the second egg timer set for 10 minutes moves nearly 10 times faster than the others (it was given more cycles). So after one minute we have 2 min for the first, but the second timer is only 10 seconds remaining. We would schedule the second timer with higher priority to finish it off faster.

I mean... read the name... shortest REMAINING TIME gets higher priority. In other words, I don't think you can tell, out of the data you posted what the pattern is because you don't display the remaining time. You would only know that after execution progresses.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1