Write a user-level program that uses xv6 system calls to ''ping-pong'' a byte between two processes over a pair of pipes, one for each direction. The parent should send a byte to the child; the child should print ": received ping", where is its process ID, write the byte on the pipe to the parent, and exit; the parent should read the byte from the child, print ": received pong", and exit.
The solution for this exercise is in the file user/pingpong.c
.
Write a program to implement a pipe-based version of the Sieve of Eratosthenes.
The program should print prime numbers up to 280 by filtering numbers through a pipeline of processes.
The solution for this exercise is in the file user/primes.c
.
Write a simple version of the UNIX find program for xv6: find all the files in a directory tree with a specific name.
The solution for this exercise is in the file user/find.c
.
Write a simple version of the UNIX xargs program for xv6: its arguments describe a command to run, it reads lines from the standard input, and it runs the command for each line, appending the line to the command's arguments.
The solution for this exercise is in the file user/xargs.c
.
- Add each program to the UPROGS section of the Makefile.
UPROGS=\
...
$U/_pingpong\
$U/_primes\
$U/_find\
$U/_xargs
- Start xv6
make qemu
- Run the Programs
After starting xv6, each program can be executed using its name, such aspingpong
,primes
,find
, andxargs
.