forked from uditvyas/xv6-MLFQ
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfoo.c
More file actions
30 lines (27 loc) · 667 Bytes
/
foo.c
File metadata and controls
30 lines (27 loc) · 667 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
// TEST FILE, WHICH CREATES A CHILD AND A PARENT PROCESS
// BOTH PARENT AND THE CHILD HAVE CPU INTENSIVE JOBS
// THE PARENT WAIT FOR THE CHILD TO FINISH BEFORE COMPLETING ITS EXECUTION
#include "types.h"
#include "stat.h"
#include "user.h"
#include "fcntl.h"
int main(int argc, char *argv[]){
int id = 0;
double x = 1;
id = fork();
if (id<0){
printf(1,"%d failed in fork!\n",getpid());
}
else if (id>0){
while(x<1.2){
x = x+0.000000005;
}
wait();
}
else{
while(x<1.2){
x = x+0.000000005;
}
}
exit();
}