Source Code for Programs
This page contains links to the programs in
the case study sections of the book.
The Pthreads, Java, MPI, and SR programs have been tested
as described below.
The Ada, HPF, Linda, and OpenMP programs have not been
tested, because I do not have access to implementations.
If someone is able to test one or more of these programs,
I would be pleased to acknowledge your assistance.
Pthreads
The Pthreads programs have been tested on Sun Sparc multiprocessors
running Solaris.
The Jacobi iteration program also shows how to do timing
using the times() system call.
Producer/consumer program in Figure 4.15
Matrix summation program in Figure 5.18
Jacobi iteration program outlined in Figure 12.1
Java
The Java programs have been tested on Sun Solaris,
Alpha OSF, and Pentium Linux systems.
In the remote database program (Figure 8.16),
localhost has been used instead of
the name of my machine (paloverde)
so that the program can be run on any host.
Readers/writers,
sequential program (pages 241-42)
Readers/writers,
parallel program with no synchronization (pages 241-43)
Readers/writers,
exclusive access program (pages 243-44)
Readers/writers, true solution with
concurrent reads or exclusive writes (pages 245-46)
Remote file reader using sockets,
server class in Figure 7.18
Remote file reader using sockets,
client class in Figure 7.19
Remote data base using remote method invocation (RMI),
interface, client, and server in Figure 8.16
MPI
The MPI programs have been tested using the LAM implementation of MPI.
The programs have been run on Sun Sparc multiprocessors
running Solaris and on a network of Pentiums running Linux.
Exchange values between two processes
program in Figure 7.17
Jacobi iteration program
outlined in Figure 12.2
SR
The SR programs have been tested using SR 2.3 on various machines.
The SR distribution
contains numerous additional programs, including all those in
Ron Olsson's and my book on SR.
Critical section simulation in Figure 8.19
readers/writers simulation
(not in the text); also shows how to simulate monitors
using semaphores
A few additional (small) programs I use in lectures are:
hello world
array summation
iterative quadrature
parallel quicksort
matrix multiplication using the co statement
matrix multiplication using processes
finding patterns in a file
Ada
Barrier type in Figure 8.17
(declaration only; not a complete program)
Dining philsophers,
main program in Figure 8.18 and
waiter task in Figure 8.19
HPF
Jacobi iteration subroutine in
Figure 12.8 (not a complete program)
Linda
Prime number program in Figure 7.16
OpenMP
Jacobi iteration program
in Figure 12.4
Last updated January 29, 2000