021585e9ef
- Free process resources when a process exits (reaped in next process cycle; should probably reap after a wait() or something) - Free process struct after wait() - Fix page allocation - Fix fork() return value for child process (attempted to write to an invalid point in kernel-stack memory) We shouldn't be triple faulting randomly anymore! Continue investigating the fork() return value, as there was a bugged return at some point during executon of a test run of thrash-process.
24 lines
450 B
C
24 lines
450 B
C
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <syscall.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
DEFN_SYSCALL1(wait, 17, unsigned int);
|
|
|
|
int main(int argc, char ** argv) {
|
|
for (int j = 0; j < 1024; ++j) {
|
|
volatile int k = fork();
|
|
printf("I am %d, I got %d\n", getpid(), k);
|
|
if (k == 0) {
|
|
printf("I am %d\n", getpid());
|
|
return 0;
|
|
} else {
|
|
printf("Waiting on %d\n", k);
|
|
syscall_wait(k);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|