Class
Tree
Deprecated
Index
Help
PREV NEXT
FRAMES
NO FRAMES
A
B
C
D
E
F
G
H
I
L
M
N
P
R
S
T
U
V
W
A
ACCESS_TIME
- Static variable in class
SharedDataMain
ACCESS_TIME is the read and write access time for a SharedData object.
accessTime
- Static variable in class
SharedData
accessTime is the time required to perform a data access on this SharedData.
addLock()
- Method in class
Locker
lckr.addLock() adds a lock to lckr.
B
BoundedBufferMain
- class
BoundedBufferMain
.
Class BoundedBufferMain defines a main method for running a bounded buffers simulation.
BoundedBufferMain()
- Constructor for class
BoundedBufferMain
This constructor is disabled.
BoundedBufferProcess
- class
BoundedBufferProcess
.
A BoundedBufferProcess is a process that works with two buffer queues, one with empty buffers and one with full buffers.
BoundedBufferProcess(String, double, BufferQueue, BufferQueue)
- Constructor for class
BoundedBufferProcess
new BoundedBufferProcess(nm, t, f, e) returns a new bounded buffer process and starts executing its run method in a new thread.
Buffer
- class
Buffer
.
An object of class Buffer simulates a buffer used by a BoundedBufferProcess.
Buffer(String)
- Constructor for class
Buffer
new Buffer(nm) returns a new Buffer.
BufferQueue
- class
BufferQueue
.
An object of class BufferQueue is a named queue of Buffers used by a BoundedBufferProcess.
BufferQueue(String, int)
- Constructor for class
BufferQueue
new BufferQueue(nm, n) returns a new BufferQueue with a capacity for n Buffer objects.
buffers
- Variable in class
BufferQueue
buffers is the array of Buffers for this BufferQueue.
C
capacity
- Variable in class
BufferQueue
capacity is the maximum number of Buffers that this BufferQueue can hold.
Consumer
- class
Consumer
.
A Consumer is a bounded buffer process that removes buffers from its full buffer queue, processes them, and places them onto its empty buffer queue.
Consumer(String, double, BufferQueue, BufferQueue)
- Constructor for class
Consumer
new Consumer(nm, t, f, e) returns a new consumer and starts executing its run method in a new thread.
count
- Variable in class
BufferQueue
count is the number of Buffers in this BufferQueue.
count
- Variable in class
SharedDataProcess
count is the number of times that this shared data process will access its shared data object.
D
down()
- Method in class
Semaphore
s.down() waits until the value of s is positive, then decrements the value of s.
doWrite()
- Method in class
SharedData
doWrite() increments the value of this Writer.
E
eat()
- Method in class
Philosopher
eat() simulates eating for this philosopher.
EATING
- Static variable in class
Philosopher
EATING is the state constant for eating philosophers.
empty
- Variable in class
BoundedBufferProcess
empty is the queue for empty buffers used by this bounded buffer process.
F
fill()
- Method in class
BufferQueue
bq.fill() fills bq with Buffers whose names are the decimal representations of integers from 0 up to one less than the capacity of bq.
format
- Static variable in class
Printer
format is the format for times printed by this Printer.
full
- Variable in class
BoundedBufferProcess
full is the queue for full buffers used by this bounded buffer process.
G
getBuffer()
- Method in class
BufferQueue
bq.getBuffer() returns the next available Buffer from bq.
getLeftChopstick()
- Method in class
Philosopher
phil.getLeftChopstick(p) returns the name of the chopstick to the left of phil.
getTime()
- Static method in class
Printer
Printer.getTime() returns the time in milliseconds since the start of the program.
go()
- Static method in class
Philosopher
Philosopher.go() allows philosophers to access their state information.
H
HUNGRY
- Static variable in class
Philosopher
HUNGRY is the state constant for hungry philosophers.
I
isFull()
- Method in class
BufferQueue
bq.isFull() returns true if there is no more room for Buffers in bq.
isLocked()
- Method in class
Locker
lckr.isLocked() returns true if there are locks on lckr.
L
left
- Variable in class
Philosopher
left is the left neighbor of this philosopher.
leftChopstick
- Variable in class
Philosopher
leftChopstick is the name of the chopstick to the left of this philosopher.
LOAD_FACTOR
- Static variable in class
SharedDataMain
LOAD_FACTOR is the fraction of time that is spent for accesses.
lockCount
- Variable in class
Locker
lockCount is the current number of locks on this Locker.
locker
- Variable in class
SharedData
locker provides the Writer locking and Reader waiting for this SharedData.
Locker
- class
Locker
.
An Locker is an object that can have multiple locks attached to it.
Locker()
- Constructor for class
Locker
new Locker() returns a new Locker object.
M
main(String[])
- Static method in class
BoundedBufferMain
main(String[])
- Static method in class
PhilosopherMain
main(args) is the main program for a dining philosophers simulation.
main(String[])
- Static method in class
SharedDataMain
mutex
- Static variable in class
Philosopher
mutex is a mutual exclusion semaphore that is used by all philosophers when accessing philosopher state information.
N
name
- Variable in class
Buffer
name is the name for this Buffer.
name
- Variable in class
BufferQueue
name is the name for this BufferQueue.
name
- Variable in class
Semaphore
name is the name for this semaphore.
name
- Variable in class
SharedData
name is the name for this SharedData.
nextGet
- Variable in class
BufferQueue
nextGet is the index where the next available Buffer can be found in this BufferQueue.
NUM_BUFFERS
- Static variable in class
BoundedBufferMain
NUM_BUFFERS is the number of buffers used in the simulation.
NUM_CONSUMERS
- Static variable in class
BoundedBufferMain
NUM_CONSUMERS is the number of Consumers used in the simulation.
NUM_PHILOSOPHERS
- Static variable in class
PhilosopherMain
NUM_PHILOSOPHERS is the number of Philosophers used in the simulation.
NUM_PRODUCERS
- Static variable in class
BoundedBufferMain
NUM_PRODUCERS is the number of Producers used in the simulation.
NUM_READERS
- Static variable in class
SharedDataMain
NUM_READERS is the number of readers used in the simulation.
NUM_WRITERS
- Static variable in class
SharedDataMain
NUM_WRITERS is the number of writers used in the simulation.
numWaiters
- Static variable in class
Semaphore
numWaiters is the number of threads that are waiting on semaphores.
P
permission
- Variable in class
Philosopher
permission controls permission to eat for this philosopher.
Philosopher
- class
Philosopher
.
A Philosopher is a process that thinks and eats.
Philosopher(String, double)
- Constructor for class
Philosopher
new Philosopher(nm, t) returns a new philosopher and starts executing its run method in a new thread.
PhilosopherMain
- class
PhilosopherMain
.
Class PhilosopherMain defines a main method for running a dining philosophers simulation.
pickUpChopsticks()
- Method in class
Philosopher
pickUpChopsticks() simulates picking up chopsticks for this philosopher.
Printer
- class
Printer
.
Class Printer provides printing service with the static println() method.
println()
- Static method in class
Printer
Printer.println() prints a blank line to System.out.
println(String)
- Static method in class
Printer
Printer.println(msg) prints the current time to System.out, followed by the name of the current Process, followed by msg, followed by a newline.
Process
- class
Process
.
A Process is a simulation of a thread of execution.
Process(String, double)
- Constructor for class
Process
new Process(nm, t) returns a new process and starts executing its run method in a new thread.
PROCESSING_TIME
- Static variable in class
BoundedBufferMain
PROCESSING_TIME is the processing time for each Process in milliseconds.
Producer
- class
Producer
.
A Producer is a bounded buffer process that removes buffers from its empty buffer queue, fills them, and places them onto its full buffer queue.
Producer(String, double, BufferQueue, BufferQueue)
- Constructor for class
Producer
new Producer(nm, t, f, e) returns a new producer and starts executing its run method in a new thread.
putBuffer(Buffer)
- Method in class
BufferQueue
bq.putBuffer(buff) adds buff to bq.
putDownChopsticks()
- Method in class
Philosopher
putDownChopsticks() simulates putting down chopsticks for this philosopher.
R
READ_LOAD
- Static variable in class
SharedDataMain
READ_LOAD is the fraction of total access time that is spent for Reader accesses.
READ_TWIDDLE
- Static variable in class
SharedDataMain
READ_TWIDDLE is the average time that readers spend between reads.
read()
- Method in class
SharedData
sd.read() reads the current value of sd.
Reader
- class
Reader
.
A Reader is a shared data process that reads from a shared data object.
Reader(String, double, SharedData)
- Constructor for class
Reader
new Reader(nm, t, d) returns a new reader and starts executing its run method in a new thread.
removeLock()
- Method in class
Locker
lckr.removeLock() adds a lock to lckr.
right
- Variable in class
Philosopher
right is the right neighbor of this philosopher.
run()
- Method in class
Process
proc.run() runs the processing for proc, printing messages before and after processing.
S
Semaphore
- class
Semaphore
.
A Semaphore is used for synchronization of Java threads.
Semaphore(String, int)
- Constructor for class
Semaphore
new Semaphore(init, nm) returns a new semaphore object named nm with initial value init.
setLeftNeighbor(Philosopher)
- Method in class
Philosopher
phil.setLeftNeighbor(p) makes p the left neighbor of phil and makes phil the right neighbor of p.
setSimulationTime(long)
- Static method in class
Process
Process.setSimulationTime(t) sets the simulation time to t.
sharedData
- Variable in class
SharedDataProcess
sharedData is the shared data object accessed by this shared data process.
SharedData
- class
SharedData
.
An object of class SharedData is a named int data value used by a SharedDataProcess.
SharedData(String, double)
- Constructor for class
SharedData
new SharedData(nm, t) returns a new SharedData object.
SharedDataMain
- class
SharedDataMain
.
Class SharedDataMain defines a main method for running a readers and writers simulation.
SharedDataProcess
- class
SharedDataProcess
.
A SharedDataProcess is a process that accesses a shared data object.
SharedDataProcess(String, double, SharedData)
- Constructor for class
SharedDataProcess
new SharedDataProcess(nm, t, d) returns a new shared data process and starts executing its run method in a new thread.
SIMULATION_TIME
- Static variable in class
BoundedBufferMain
SIMULATION_TIME is the approximate total time for the simulation.
SIMULATION_TIME
- Static variable in class
SharedDataMain
SIMULATION_TIME is the approximate total time for the simulation.
start
- Static variable in class
Printer
state
- Variable in class
Philosopher
state is the state of this philosopher: THINKING, HUNGRY, or EATING.
step()
- Method in class
Consumer
cons.step() simulates processing a single buffer.
step()
- Method in class
Philosopher
phil.step() simulates a think and eat cycle for phil.
step()
- Method in class
Process
The step() method defines a step in the behavior of this process.
step()
- Method in class
Producer
prod.step() simulates filling a single buffer.
step()
- Method in class
Reader
prod.step() simulates a single read step from a shared data object.
step()
- Method in class
Writer
wr.step() simulates a single write step to a shared data object.
T
THINK_EAT_TIME
- Static variable in class
PhilosopherMain
THINK_EAT_TIME is average time that philosophers spend thinking or eating.
think()
- Method in class
Philosopher
think() simulates thinking for this philosopher.
THINKING
- Static variable in class
Philosopher
THINKING is the state constant for thinking philosophers.
toString()
- Method in class
Buffer
buff.toString() returns the name of buff.
toString()
- Method in class
BufferQueue
bq.toString() returns the name of bq.
toString()
- Method in class
Process
proc.toString() returns the name of proc.
toString()
- Method in class
Semaphore
s.toString() returns the name of s.
toString()
- Method in class
SharedData
sd.toString() returns the name of sd.
tryToGrantPermission(Philosopher)
- Static method in class
Philosopher
tryToGrantPermission(p) attempts to grant permission for p to eat.
twiddle()
- Method in class
Process
proc.twiddle() causes proc to do nothing significant for a random amount of time.
U
up()
- Method in class
Semaphore
s.up() increments the value of s.
V
value
- Variable in class
Semaphore
value is the current value of this semaphore.
value
- Variable in class
SharedData
value is the current value of this SharedData.
W
waiters()
- Static method in class
Semaphore
Semaphore.waiters() returns the number of threads that are waiting on semaphores.
WRITE_LOAD
- Static variable in class
SharedDataMain
WRITE_LOAD is the fraction of total access time that is spent for Reader accesses.
WRITE_TWIDDLE
- Static variable in class
SharedDataMain
WRITE_TWIDDLE is the average time that writers spend between writes.
write()
- Method in class
SharedData
sd.write() increments the value of sd.
Writer
- class
Writer
.
A Writer is a shared data process that writes to a shared data object.
Writer(String, double, SharedData)
- Constructor for class
Writer
new Writer(nm, t, d) returns a new Writer and starts executing its run method in a new thread.
A
B
C
D
E
F
G
H
I
L
M
N
P
R
S
T
U
V
W
Class
Tree
Deprecated
Index
Help
PREV NEXT
FRAMES
NO FRAMES