-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathroundRobinTest.c
More file actions
39 lines (31 loc) · 854 Bytes
/
roundRobinTest.c
File metadata and controls
39 lines (31 loc) · 854 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
#include "types.h"
#include "stat.h"
#include "user.h"
int main(int argc, char *argv[])
{
changePolicy(1);
int main_pid = getpid();
for (int i = 0; i < 10; i++)
{
if (fork() > 0)
break;
}
if (main_pid != getpid())
{
for (int i = 0; i < 100; i++)
printf(1, "/%d/: %d\n", getpid(), i);
int turnAroundTime = getTurnAroundTime(getpid());
int waitingTime = getWaitingTime(getpid());
int CBT = getCBT(getpid());
wait();
printf(1, "turnAroundTime for process /%d/ is :%d\n", getpid(), turnAroundTime);
printf(1, "waitingTime for process /%d/ is :%d\n", getpid(), waitingTime);
printf(1, "CBT for process /%d/ is :%d\n", getpid(), CBT);
printf(1, "\n\n");
}
while (wait() != -1)
{
;
}
exit();
}