Generic master/worker programs:
- Supporting code:
FakeTasks.java.
- Sequential version:
seq/MasterWorkerSeq.java.
- Multi-threaded versions:
- Client-server versions using sockets:
To execute: Compile everything, and then run either
sockets/Master1 or sockets/Master2 as the master,
plus one or more workers.
The start-sockets-workers script below may be useful.
- Client-server version using RMI:
To execute: Compile everything, start an instance of
the registry with the command "rmiregistry" (in the
directory containing the .class files), and
then run one master and one or more workers.
The start-rmi-workers script below may be useful.
- Scripts
start-socket-workers
start-rmi-workers
to start "worker" processes on selected machine.
To use, copy into a directory in your search path
(current directory will probably work) and make executable
with chmod u+x start-*-workers.
Executing with no arguments gives a usage message.
OpenCL
POSIX Threads (P-Threads)
- Sample makefile Makefile.
(See the Note About
Makefiles below.)
- ZIP archive containing all examples
P-Threads.zip.
- "Hello, world" program:
hello.c.
- Simple example of synchronization among threads:
- Utility functions for use with remaining examples:
timer.h,
- Programs to compute pi by numerical integration:
C++11 Threads
- Sample makefile Makefile.
(See the Note About
Makefiles below.)
- ZIP archive containing all examples
C++Threads.zip.
- "Hello, world" program:
hello.cpp.
- Simple example of synchronization among threads:
- Utility functions for use with remaining examples:
timer.h,
- Programs to compute pi by numerical integration:
To obtain a makefile, use your browser's download function;
cutting and pasting will likely turn the tabs in the makefile
into spaces and cause it to not work.
Put the makefile in the directory in which you want to
compile.
All the makefiles linked from this page begin with
brief documentation on their use (the "usage examples").
Other files
- Script to mail files for homework submission
mail-files.
Instructions for usage
here.