|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectpsimjava.Bin
public class Bin
This class controls the declaration, allocation and deallocation resources.
Psim-J Object-oriented simulation, process interaction approach.
(C)Jose M. Garrido. June 2000, 2003, 2004, 2007
If a process requesting a certain number of resource items in the resource pool (of type 'Bin') are not available, then the process is enqueued into the corresponding priority queue. When a process releases a number of resource items, then the queues are examined for waiting process.
File: Bin.java
| Constructor Summary | |
|---|---|
Bin(java.lang.String name,
int n)
Constructor initializes Bin object with a title and the number of available resource items. |
|
| Method Summary | |
|---|---|
void |
give(int num)
Current process deposits a number of resource items in the Bin object |
int |
length()
Returns number of of processes waiting on the Bin object |
int |
num_avail()
Returns number of available resource items in Bin object |
void |
report()
Internal method for the actual reporting of Bin object usage, called by the executive. |
void |
take(int num)
This method removes 'num' resource items from the Bin object pool, if there are sufficient items in the pool it returns normally. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Bin(java.lang.String name,
int n)
name - title of Bin object createdn - initial number of Bin items| Method Detail |
|---|
public void take(int num)
num - number of items to wirhdraw from Bin pool.public int num_avail()
public int length()
public void give(int num)
num - number of items to deposit in Bin objectpublic void report()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||