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

bug in mlfq.py #13

Open
c2hpxq opened this issue Aug 24, 2020 · 1 comment
Open

bug in mlfq.py #13

c2hpxq opened this issue Aug 24, 2020 · 1 comment

Comments

@c2hpxq
Copy link

c2hpxq commented Aug 24, 2020

There seems to be a mistake when boosting jobs to high priority queue:
for j in range(numJobs):
# print('-> Boost %d (timeLeft %d)' % (j, job[j]['timeLeft']))
if job[j]['timeLeft'] > 0:
# print('-> FinalBoost %d (timeLeft %d)' % (j, job[j]['timeLeft']))
job[j]['currPri'] = hiQueue
job[j]['ticksLeft'] = allotment[hiQueue]

To my limited understanding, allotment[i] represents number of quantum you have in queue i, so here is a 'type mismatch' bug.
To make it right: job[j]['ticksLeft'] = quantum[hiQueue]

Or maybe I failed to fully understand the program... In that case, any insight/correction is welcomed.
If I'm right, hope it get fixed so everyone doing ex5 in ch8 has no need to come through it again.

@c2hpxq
Copy link
Author

c2hpxq commented Aug 24, 2020

Also, I think both ticksLeft and allotLeft should be reset.

obsiwitch added a commit to obsiwitch/eduostep that referenced this issue May 19, 2021
* NB: fixed boost allotment & ticks reset in mlfq.py
  * ref: remzi-arpacidusseau/ostep-homework#18
  * ref: remzi-arpacidusseau/ostep-homework#13
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