題目:https://pdos.csail.mit.edu/6.S081/2021/labs/util.html
Write a concurrent version of prime sieve using pipes. This idea is due to Doug McIlroy, inventor of Unix pipes. The picture halfway down this page and the surrounding text explain how to do it. Your solution should be in the file user/primes.c.
程式碼:
#include "kernel/types.h"
#include "kernel/stat.h"
#include "user/user.h"
int
main(int argc, char *argv[])
{
if(argc < 2)
sleep(10);
else
sleep(atoi(argv[1]));
exit(0);
}