2

I'm a bit stuck at this question. From what I found the:

  • TT = Burst - waiting or exit-arrival
  • RT = start time - arrival

In the book there is an example:

             P1    P2   P3
arr           0     0    0
comp.        10     10   10

I wrote function and got:

  • For fifo I found that TT is : 10 ,20 ,30
  • RT : 0 , 10 ,20

But I'm struggeling to find TT and RT for the same process but for RoundRobin (with some quantum). Answer from a book is:

  • TT: 28, 29, 30
  • RT: 0, 1, 2 How was it calculated? Need help with defining how to find TT and RT for RR. With example and calc. please.

Update:

I managed to find a RT for a rr and fifo:

Rt1 = 0 -0 = 0   quantum = 1 : 0-0 = 0
Rt2 = 10-0 = 10  quantum = 1 : 1-0 = 1
Rt3 = 20-0 = 20  quantum = 1 : 2-0 = 2

But still not getting correct TT.

func (j Job) TurnaroundTime() time.Duration {
    Tt := (j.finished - j.arrival - j.estimated) + j.estimated
    return Tt
}

func (j Job) ResponseTime() time.Duration {

    if j.id == 1 {
        Rt = time.Duration(0)
    }
    Rt := j.start - j.arrival

    //fmt.Print(Rt, j.start, j.Now(), " - ")

    return Rt
}

1 Answers1

0

The problem was in a RR that I was using, exactly with my quantum being == 1.

When it comes to the functions:

package job

import (
    "../scheduler/system/systime"
    "time"
)

// Setting up the schedule for a job 

func (j *Job) Scheduled(s systime.SystemTime) {
    j.SystemTime = s
    j.arrival = j.Now()

}
// Starting job, here I add a start time only when the job is first time started.
// NotStartedYet is -1 


func (j *Job) Started(cpuID int) {
    if j.start == NotStartedYet {
        j.start = j.Now()
    }
}

//Total time from when job arrived til its fully exicuted

func (j Job) TurnaroundTime() time.Duration {
    Tt := j.finished - j.arrival    
    return Tt
}

//sort of waiting time between arrival and actual assignment to the cpu

func (j Job) ResponseTime() time.Duration {

    Rt := j.start - j.arrival

    return Rt
}
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61