Fix: Round Robin scheduling processes before their arrival time (#4) - #5
Open
Abhirai2006 wants to merge 1 commit into
Open
Fix: Round Robin scheduling processes before their arrival time (#4)#5Abhirai2006 wants to merge 1 commit into
Abhirai2006 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4
Bug
The Round Robin scheduler looped through every process every round and ran whichever one still had burst time left, without ever checking whether that process had actually arrived yet. This let later-arriving processes get scheduled before their arrival time - exactly what was reported in #4.
Repro (before fix):
P4 was scheduled to run from t=5 to t=7 — two seconds before it arrives at t=7.
Root cause
There was no ready queue and no arrival-time check — it just cycled through the full process list on every pass.
Fix
Replaced this with a proper ready-queue based Round Robin:
Testing
npm run build— compiles clean for this file (pre-existing lint warnings inSJFPriority.js/Sjf.jsare unrelated to this change).