Created
November 8, 2022 06:46
-
-
Save adiparamartha/06bb0f3e7f3b57f47626f506e9f5a205 to your computer and use it in GitHub Desktop.
SJF Scheduling Algorithm - Adi Paramartha - Python
This file contains 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
#ShortestJobFirst Scheduling Algorithms | |
#Pseudocode: Execute task with shortest burst time / processing time first | |
import random | |
import time | |
i=1 | |
a = random.randrange(1, 10) | |
b = random.randrange(1, 10) | |
c = random.randrange(1, 10) | |
d = random.randrange(1, 10) | |
e = random.randrange(1, 10) | |
taskList = {'Task_1': a , 'Task_2': b, 'Task_3': c, 'Task_4': d, 'Task_5': e} | |
for w in sorted(taskList, key=taskList.get, reverse=False): | |
print(w, " executed at ",i, " with load of ", taskList[w]) | |
i+=1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment