Define
each of the following terms.
c.
ready state
ANS: A state in which the thread is capable of running (if the
processor becomes available).
d.
blocked state
ANS: A state in which the thread cannot use the processor. For
example, the blocked state occurs when the thread issues an I/O request.
e.
preemptive scheduling
ANS: A thread of higher priority enters a running state and is
assigned the processor. The thread "preempted" from the processor is
placed back in the ready state according to its priority.
f.
Runnable interface
ANS: An interface that provides a run method. By
implementing the Runnable interface, any class can be executed as a
separate thread.
g.
monitor
ANS: A monitor "watches" shared data between threads. A
monitor is responsible locking an object (i.e., allowing only one thread at a
time to execute synchronized methods on the object).
h.
notify method
ANS: Notifys a waiting thread that an object?s lock has been
released and that the waiting thread can now attempt to obtain the lock for
itself.
i.
producer/consumer relationship
ANS: A relationship in which a producer and a consumer share common
data. The producer typically wants to "produce" (add information) and
the consumer wants to "eat" (remove information).