Process/Coroutine Package in Java
University of Utah, Dec 1995
Warning:There are no fancy applets on this page,
click here to see some.
The code in divided in three packages, each of which can be reused
For documentation generated by javadoc, see
- sim package:
- queues package:
(for historic reasons, all methods of this class are capitalized)
- random package:
This is a straightforward port of the process.c/coroutine.c
library that uses Cthreads. A few points to note:
Last change: Dec 14 1995
- all type checks have been removed as Java throws an exception
in this case.
- I got rid of rlink because I hated it. There is no limit on
the number of queues a process can be in. Similarly, there is
no need for carrier objects as they are internally provided
by the Queue class.
- Some functions have been removed as they don't fit in the Java model:
terminate_and_delete(), for instance.
Other functions have been omitted as there is no need for them anymore.
For instance, process::enqueue_proc(q) is simply
- In general, functions and variables previously global such as
clock or current or activate() have become static members of the
- there is no distinction between coroutines and processes anymore
- processes are implemented using Java threads, which interact
in a coroutine fashion. This is implemented using condition variables.
CPU scheduler with
resource, a mutex implemented for processes with
sieve, an coroutine-based implementation of
carwash, a simulation of a car wash system.
powers, computing powers of n using DSS.
Condition variables with a