CSE150 Operating Systems (Spring semester 2008): threads and IPC

Consider the following programs (corresponding to figures in the textbook), which are implemented with threads (Pthread in Linux):

To compile and run these programs, do gcc -lpthread -o peterson peterson.c; ./peterson. They have internal parameters (e.g. the number of threads for fig2-15.c, or the "computation timeouts" for strict_alt.c and peterson.c. Make sure you understand what the programs do by reading their source. Then, compile and run the programs, and observe their output carefully (observe how fast the output appears and in what order). Some things to try:

Run peterson, strict_alt and top in separate windows so you can monitor the status of these processes.


Miguel A. Carreira-Perpinan
Last modified: Tue Apr 1 00:29:38 PST 2008

UC Merced | EECS | MACP's Home Page