|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectpsimjava.Res
public class Res
PsimJ Java package for OO simulation
Object-oriented simulation package, process interaction approach.
(C) J. M. Garrido. June 2000, 2003, 2004, 2007 Resource pools (containers).
The class 'Res' controls the declaration, allocation and deallocation of resource pools. If a process requesting a certain number of resource items from an object of type 'Res' and are not available, then the process is enqueued into the resource's priority queue. When a process releases a number of resource items, the queue is examined for the waiting processes. A process dequeued is checked if its request can be granted.
File: Res.java
| Constructor Summary | |
|---|---|
Res(java.lang.String name,
int n)
Constructor for the resurce pool object |
|
| Method Summary | |
|---|---|
void |
acquire(int num)
This method allows the requesting process to acquire a number of resource items. |
int |
length()
This method gets the number of waiting processes. |
int |
num_avail()
This method gets the number of available resource items available in the resource pool. |
void |
release(int num)
This dunction releases resources from the calling process, and makes them available in the resource pool. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Res(java.lang.String name,
int n)
name - the title for the resource pool objectn - the number of resource items in the resource pool| Method Detail |
|---|
public void acquire(int num)
num - the number of resource items requested.public int num_avail()
public int length()
public void release(int num)
num - int, the number of resource items released by the calling process.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||