-
Notifications
You must be signed in to change notification settings - Fork 0
/
SJF.py
28 lines (28 loc) · 900 Bytes
/
SJF.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# creating list
process = []
count = 0
num = input("Please enter the number of your processes: ")
num = int(num)
while(count < num):
x = input("Please enter the time of your processes %s: " %(count+1))
x = int(x)
process.append(x)
count+=1
print("==================================================")
print("==================================================")
# sort & display list of process
process.sort()
print("List of Process is : ", process)
print("==================================================")
print("==================================================")
# starting process
count = 0
L = int(len(process))
while(count < L):
y = count
print("Process %s is running..." %(count+1))
process.remove(process[0])
print("Execution of the process %s is completed" %(count+1))
count+=1
print(process)
print("All processes were executed with Algorithm SJF.")