public class ResourceDB
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
checkForDeadlock(SimProcess unsatProc)
This method is called when a SimProcess can not get the resources desired
to check if a possible deadlock situation has occured.
|
boolean |
debugIsOn()
Shows if this resourceDB currently produces debug output.
|
void |
debugOff()
Switches off debug output for this resourceDB.
|
void |
debugOn()
Switches on debug output for this resourceDB.
|
void |
deleteResAllocation(Res resPool,
SimProcess doneProc,
int quantity)
Deletes an entry in the resource data base (should be called when a
Sim-process is done with it's requested number of resources from a
resource pool (
Res )). |
void |
deleteResRequest(SimProcess gainProc,
Res resPool,
int quantity)
Deletes an entry in the resource data base (should be called when a
Sim-process receives it's requested number of resources from a resource
pool (
Res )). |
void |
noteResourceAllocation(Res resourcePool,
SimProcess allocatingProcess,
int quantity)
Makes an entry in the resource data base when a SimProcess is allocating
a number of resources from a resource pool (
Res ). |
void |
noteResourceRequest(SimProcess requestingProcess,
Res resourcePool,
int quantity)
Makes an entry in the resource data base when a SimProcess is requesting
a number of resources from a resource pool (
Res ). |
java.lang.String |
toHtmlString()
Returns a string representation of the resource database with some HTML
formatting tags.
|
public boolean checkForDeadlock(SimProcess unsatProc)
unsatProc
- desmoj.SimProcess : The SimProcess which can not get the
resources desired. The unsatisfied process.true
if a deadlock is found,
false
otherwise.public boolean debugIsOn()
public void debugOff()
public void debugOn()
public void deleteResAllocation(Res resPool, SimProcess doneProc, int quantity)
Res
)). The SimProcess and the number of
requested resources will be deleted in the corresponding Vector (of the
Res pool) in the assignment hashtable. The Res pool is the key to this
hashtable, specifying the Vector which holds all the (SimProcess/number
of requested resources)-pairs.resPool
- desmoj.Res : The resource pool which has provided the
resources. (The key to the hashtable)doneProc
- desmoj.SimProcess : The Simprocess giving back his allocated
resources. He should be done with the resources now.quantity
- int : The number of resources the SimProcess has used.public void deleteResRequest(SimProcess gainProc, Res resPool, int quantity)
Res
)). The resource pool and the number of
requested resources will be deleted in the request hashtable. The
Sim-process is the key to this hashtable, specifying the
RequestedResources object which holds the (resource pool/number of
requested resources)-pair.gainProc
- desmoj.SimProcess : The Simprocess giving up his request for
the resources. Hopefully he gets satisfied.resPool
- desmoj.Res : The resource pool which provides the resources.quantity
- int : The number of resources the SimProcess gets.public void noteResourceAllocation(Res resourcePool, SimProcess allocatingProcess, int quantity)
Res
). The
Sim-process and the number of allocated resources will be saved in the
assignment hashtable. The resource pool is the key to this hashtable.resourcePool
- desmoj.Res : The resource pool which is providing the
resources.allocatingProcess
- desmoj.SimProcess : The Simprocess which is allocating the
resources.quantity
- int : The number of resources the SimProcess is allocating.public void noteResourceRequest(SimProcess requestingProcess, Res resourcePool, int quantity)
Res
). The
resource pool and the number of requested resources will be saved in the
request hashtable. The SimProcess is the key to this hashtable.requestingProcess
- desmoj.SimProcess : The Simprocess which is requesting the
resources.resourcePool
- desmoj.Res : The resource pool which should provide the
resources.quantity
- int : The number of resources the SimProcess wants to get.public java.lang.String toHtmlString()
Res
) all
the SimProcesses that are using resources from that resource pool. This
information is useful for debugging purposes.