|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.machine.TCB
public final class TCB
A TCB simulates the low-level details necessary to create, context-switch, and destroy Nachos threads. Each TCB controls an underlying JVM Thread object.
Do not use any methods in java.lang.Thread, as they are not compatible with the TCB API. Most Thread methods will either crash Nachos or have no useful effect.
Do not use the synchronized keyword anywhere in your code. It's against the rules, and it can easily deadlock nachos.
Field Summary | |
---|---|
static int |
maxThreads
The maximum number of started, non-destroyed TCB's that can be in existence. |
Constructor Summary | |
---|---|
TCB()
Allocate a new TCB. |
Method Summary | |
---|---|
void |
contextSwitch()
Context switch between the current TCB and this TCB. |
static TCB |
currentTCB()
Return the TCB of the currently running thread. |
void |
destroy()
Destroy this TCB. |
static void |
die()
Destroy all TCBs and exit Nachos. |
static void |
givePrivilege(Privilege privilege)
Give the TCB class the necessary privilege to create threads. |
static boolean |
isNachosThread()
Test if the current JVM thread belongs to a Nachos TCB. |
void |
start(Runnable target)
Causes the thread represented by this TCB to begin execution. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int maxThreads
Constructor Detail |
---|
public TCB()
Method Detail |
---|
public static void givePrivilege(Privilege privilege)
privilege
- encapsulates privileged access to the Nachos
machine.public void start(Runnable target)
public static TCB currentTCB()
public void contextSwitch()
public void destroy()
public static void die()
public static boolean isNachosThread()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |