Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplemented a new code for Priority Scheduling #2278
Conversation
TravisBuddy
commented
Aug 4, 2020
|
Hey @Lownish, TravisCI finished with status TravisBuddy Request Identifier: 6f17e4d0-d6ab-11ea-8693-3322afd57804 |
TravisBuddy
commented
Aug 4, 2020
|
Hey @Lownish, TravisCI finished with status TravisBuddy Request Identifier: c54a6ed0-d6ac-11ea-8693-3322afd57804 |
@Lownish Thanks for this submission! I do not know scheduling and I am struggling to understand this algorithm. Sometimes it goes in an infinite loop and other times it delivers all zeros. Can you please provide a set of input data and expected output data? I created a separate `priority_schedule()` function with a doctest that never seems to calculate a schedule. Can you please fix that function so that it provides the correct schedule for that input data?
TravisBuddy
commented
Aug 5, 2020
|
Hey @Lownish, TravisCI finished with status TravisBuddy Request Identifier: 90fd1860-d721-11ea-85fc-4b61cecd2c91 |
|
@cclauss , Priority Scheduling is a scheduling algorithm which decides which process to execute, given the priority of each process in the queue. Whenever there are processes of the same priority, it follows FCFS. The code prints the sequence of the processes to be run, as well as its waiting time and turn around time. The greater the priority number, the higher priority the process has. Priority ranges from 1 onwards. This algorithm is usually covered as part of the Operating System component. You can find more details on the link below: The link above is of a set of data, but the priority must be incremented by 1, since it should be from 1 onwards. Output must be: |
TravisBuddy
commented
Aug 5, 2020
|
Hey @Lownish, TravisCI finished with status TravisBuddy Request Identifier: bb783300-d725-11ea-85fc-4b61cecd2c91 |
TravisBuddy
commented
Aug 5, 2020
Travis tests have failedHey @Lownish, TravisBuddy Request Identifier: cf3a2ec0-d725-11ea-85fc-4b61cecd2c91 |
TravisBuddy
commented
Aug 5, 2020
Travis tests have failedHey @Lownish, TravisBuddy Request Identifier: 7592de70-d726-11ea-85fc-4b61cecd2c91 |
|
|
Needs work. |
The priority is starting with 0. It should start with 1. This will require incrementing all priorities by 1 |
|
The doctest increments all priorities by one and still fails. Please ensure the doctest passes. |
|
If priority is [0, 1, 2, 3, 4] or [1, 2, 3, 4, 5] should not change the outcome of the schedule. |
TravisBuddy
commented
Aug 5, 2020
Travis tests have failedHey @Lownish, TravisBuddy Request Identifier: 4eca5cd0-d728-11ea-85fc-4b61cecd2c91 |
TravisBuddy
commented
Aug 5, 2020
Travis tests have failedHey @Lownish, TravisBuddy Request Identifier: 083abe80-d729-11ea-85fc-4b61cecd2c91 |
|
It seems there is some error in the logic when the arrival time for all processes are not 0. Looking into it |
thunderstorm2kN
commented
Aug 5, 2020
•
|
oof , mate I'm just a starter , i did 1/4 of a python course , but I'll take a look :(
|
|
The waiting time for process 7 is wrong but the rest is correct. Where did that chart come from?
|
https://www.javatpoint.com/os-non-preemptive-priority-scheduling The chart uses a reverse logic where lowest priority number means highest priority. I made the change while running it. |
|
@cclauss , are there any modifications required to have the pull request merged? Have not received any other reviews for almost a week now. |
|
A single source for both the code and the expected results is not making me comfortable because I do not know scheduling so I am not a strong reviewer of this submission. Perhaps a different reviewer would be more comfortable with this work. For me, there needs to be a published source on scheduling algoritms that agrees with your results. If your results do not match any published resource then perhaps we should close this PR. |
|
Meanwhile, I'll search for some legitimate sources for such problems along with the results. |
|
This book explains about different process scheduling algorithms. Chapter 5, on page 192, covers the priority scheduling algorithm covered here, with arrival time 0 for all processes. The book also mentioned that there is no actual agreement whether the lowest number represents the highest or the lowest priority, but it chose it to be, the lower the number, the higher the priority in this case, contrary to the program submitted here, |
|
@itsvinayak , can you please review the code? |



Lownish commentedAug 4, 2020
•
edited
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.