Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLFQ - doubt (or bug?) #10

Open
ibrahim5253 opened this issue Aug 11, 2020 · 0 comments
Open

MLFQ - doubt (or bug?) #10

ibrahim5253 opened this issue Aug 11, 2020 · 0 comments

Comments

@ibrahim5253
Copy link

Okay, so, I am having some trouble understanding the trace. Here's the setup - 2 queues, 2 jobs - one CPU bound (no IO) with runtime 9 and another with IO frequency 2 (duration 1) and runtime 4. Quantum is 3 for each of the queues, allotment 1. We do Stay and Boost priorities every 5 seconds.

$ ./mlfq.py -n 2 -l 0,9,0:0,4,2 -q 3 -c -i 1 -S -B 5
Here is the list of inputs:
OPTIONS jobs 2
OPTIONS queues 2
OPTIONS allotments for queue  1 is   1
OPTIONS quantum length for queue  1 is   3
OPTIONS allotments for queue  0 is   1
OPTIONS quantum length for queue  0 is   3
OPTIONS boost 5
OPTIONS ioTime 1
OPTIONS stayAfterIO True
OPTIONS iobump False


For each job, three defining characteristics are given:
  startTime : at what time does the job enter the system
  runTime   : the total CPU time needed by the job to finish
  ioFreq    : every ioFreq time units, the job issues an I/O
              (the I/O takes ioTime units to complete)

Job List:
  Job  0: startTime   0 - runTime   9 - ioFreq   0
  Job  1: startTime   0 - runTime   4 - ioFreq   2


Execution Trace:

[ time 0 ] JOB BEGINS by JOB 0
[ time 0 ] JOB BEGINS by JOB 1
[ time 0 ] Run JOB 0 at PRIORITY 1 [ TICKS 2 ALLOT 1 TIME 8 (of 9) ]
[ time 1 ] Run JOB 0 at PRIORITY 1 [ TICKS 1 ALLOT 1 TIME 7 (of 9) ]
[ time 2 ] Run JOB 0 at PRIORITY 1 [ TICKS 0 ALLOT 1 TIME 6 (of 9) ]
[ time 3 ] Run JOB 1 at PRIORITY 1 [ TICKS 2 ALLOT 1 TIME 3 (of 4) ]
[ time 4 ] Run JOB 1 at PRIORITY 1 [ TICKS 1 ALLOT 1 TIME 2 (of 4) ]
[ time 5 ] IO_START by JOB 1
IO DONE
[ time 5 ] BOOST ( every 5 )
[ time 5 ] Run JOB 0 at PRIORITY 1 [ TICKS 0 ALLOT 1 TIME 5 (of 9) ]
[ time 6 ] IO_DONE by JOB 1
[ time 6 ] Run JOB 1 at PRIORITY 1 [ TICKS 0 ALLOT 1 TIME 1 (of 4) ]
[ time 7 ] Run JOB 0 at PRIORITY 0 [ TICKS 2 ALLOT 1 TIME 4 (of 9) ]
[ time 8 ] Run JOB 0 at PRIORITY 0 [ TICKS 1 ALLOT 1 TIME 3 (of 9) ]
[ time 9 ] Run JOB 0 at PRIORITY 0 [ TICKS 0 ALLOT 1 TIME 2 (of 9) ]
[ time 10 ] BOOST ( every 5 )
[ time 10 ] Run JOB 1 at PRIORITY 1 [ TICKS 0 ALLOT 1 TIME 0 (of 4) ]
[ time 11 ] FINISHED JOB 1
[ time 11 ] Run JOB 0 at PRIORITY 1 [ TICKS 0 ALLOT 1 TIME 1 (of 9) ]
[ time 12 ] Run JOB 0 at PRIORITY 0 [ TICKS 2 ALLOT 1 TIME 0 (of 9) ]
[ time 13 ] FINISHED JOB 0

Final statistics:
  Job  0: startTime   0 - response   0 - turnaround  13
  Job  1: startTime   0 - response   3 - turnaround  11

  Avg  1: startTime n/a - response 1.50 - turnaround 12.00

At time 5, why is TICKS 0? Since JOB 0 just got switched in, shouldn't it have the entire quantum? Same at time 6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant