Aberham
Aberham

Reputation: 31

cpu scheduling response time?

Hi I got the following questions for homework but I am unsure about my conclusion any help would be appreciated

1) For what types of workloads does SJF have the turnaround times as FIFO?

I think the only possible way this could happen is if your sort your workloads in sjf order before running FIFO.

2) For what types of workloads and time quanta does RR give the same response times as SJF?

This was a lot harder the only case I could find was when the workloads were of same length and the time quanta is greater than the length of the workloads.

Are these assumption right or am I missing something are there more possible workloads?

Upvotes: 0

Views: 979

Answers (2)

Yunus
Yunus

Reputation: 84

  1. For what types of workloads does SJF have the turnaround times as FIFO?

SJF and FIFO/FCFS may produce the same turnaround times in the following cases:

  • all processes have the same burst time.
  • process with shorter burst time always arrived first in FIFO/FCFS. (in increasing order)
  • all processes arrive at different time, and no preemption for SJF
  1. For what types of workloads and time quanta does RR give the same response times as SJF?

SJF and RR may produce the same response times in the following cases:

  • all processes have the same burst time as quantum time of RR
  • SJF with preemption but the shortest burst time is equal with quantum time of RR.

Also maybe there are other possible cases.

Upvotes: 0

paxdiablo
paxdiablo

Reputation: 882706

I think you're mostly correct on both counts.

For SJF/FIFO, if you're taking about turnaround times for each job from the time they enter the queue, they would have to enter the queue in shortest-job-first order.

However, if turnaround time is measured from the time the job starts running, they could come in any order.

For RR/SJF, you would need to ensure the jobs all run in a single quantum so that the round-robin nature was discounted. But again, it depends on whether response time is from job entry or job start.

It's more likely to be the former so the jobs would again have to come in in SJF order. I don't think they'd all actually have to be the same length.

Upvotes: 1

Related Questions