|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--simulator.Semaphore
This class is a multi-value semaphore with P and V operations that performs a process suspension if there's no other available resorces. The P and V operation use a internal Java mutex to avoid conflicts.
Field Summary | |
(package private) int |
N
The actual number of process that are suspend |
(package private) java.lang.String |
O
This string contain the Owner of the process that call a P or V operation, but it is never used. |
(package private) int |
value
The actual number of available resorces |
Constructor Summary | |
Semaphore(int initSem,
java.lang.String Owner)
Initialize the semaphore with starting resorces and owner string of process |
Method Summary | |
void |
P()
Perform a P operation (if there's no other resorces the process will be suspend) |
void |
V()
Perform a V operation (if there's suspended processes, it will resume one of them) |
Methods inherited from class java.lang.Object |
|
Field Detail |
int value
int N
java.lang.String O
Constructor Detail |
public Semaphore(int initSem, java.lang.String Owner)
initSem
- the initial resources numberOwner
- a string for the owner (actualy never used)Method Detail |
public void P()
public void V()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |