Sample Header Ad - 728x90

round-robin in bash script

-2 votes
1 answer
875 views
i have this task to do, but im actually stuck with this round-robin algorithm, here's the details input file there are 3 process A, B and C second column is the arrival time third column is nut value
A 1 2
B 2 3
C 0 4
i understand the idea that process with AT=0 status should be R=running then the next process with AT status should present as W=waiting after the process has reached the nut value, for ex 4 R status next seq should be F=finished output like
A B C
0 - - R
1 W - R
2 R W W
3 W W R
4 W R W
5 R W W
6 F W R
7 F R F
8 F R F
9 F F F
i tired to use the same idea of first come first serve but it's different as here we have to use the round robin algorithm and i didn't saw it before in bash if just someone give me the idea and i will try to continue till the end
nut value in the third column mean for ex first process A =2
so it must have two running status then it be finished
process C=4, must have 4 running status then finished and so on
the algorithm is round-robin i found this is the suitable one as the running status changes each line between the processes
yes each time only one running status and the other either not arrived yet or in waiting status
Asked by peter louis (29 rep)
Nov 21, 2022, 10:33 AM
Last activity: Nov 22, 2022, 02:54 PM