diff --git a/labs/xv6.html b/labs/xv6.html index a5df08d..fcbb234 100644 --- a/labs/xv6.html +++ b/labs/xv6.html @@ -1,6 +1,6 @@
-Optional: write an uptime program that prints the uptime in terms - of ticks using the uptime system call. + of ticks using the uptime system call.
In the previous exercise, if you made an error in sleep, the - program may have exited prematurely, but it didn't affect other - processes because xv6 isolates processes. Sometimes you want - processes to interact with each other. Xv6 provides two ways to do: - either through the file system (one process can create a file and - another process can read that file) or through pipes. In this - exercise you explore interprocess communication through pipes. - +
Write a program that uses UNIX system calls to ``ping-pong'' a byte between two processes over a pair of pipes, one for each direction. The parent sends by writing a byte to fd[1] and @@ -140,6 +132,32 @@ initial file system. You just ran one of them: ls.
Write a concurrent version of prime sieve using pipes. This idea + is due to Doug McIlroy, inventor of Unix pipes. The picture + halfway down the page + and the text surrounding it explain how to do it. + +
Your goal is to use pipe and fork to set up + the pipeline. The first process feeds the numbers 2 through 35 + into the pipeline. For each prime number, you will arrange to + create one process that reads from its left neighbor over a pipe + and writes to its right neighbor over another pipe. Since xv6 has + limited number of file descriptors and processes, the first + process can stop at 35. + +
Some hints: +
Modify the shell to support wait.
Modify the shell to support lists of commands, separated by ";"