nachos.userprog
Class UThread
java.lang.Object
|
+--nachos.threads.KThread
|
+--nachos.userprog.UThread
- public class UThread
- extends KThread
A UThread is KThread that can execute user program code inside a user
process, in addition to Nachos kernel code.
|
Method Summary |
protected void |
restoreState()
Restore state before receiving the processor again. |
protected void |
saveState()
Save state before giving up the processor to another thread. |
| Methods inherited from class nachos.threads.KThread |
compareTo,
currentThread,
finish,
fork,
getName,
join,
ready,
selfTest,
setName,
setTarget,
sleep,
toString,
yield |
userRegisters
public int[] userRegisters
- Storage for the user register set.
A thread capable of running user code actually has two sets of
CPU registers: one for its state while executing user code, and one for
its state while executing kernel code. While this thread is not running,
its user state is stored here.
process
public UserProcess process
- The process this thread belongs to.
UThread
public UThread(UserProcess process)
- Allocate a new UThread.
saveState
protected void saveState()
- Save state before giving up the processor to another thread.
- Overrides:
- saveState in class KThread
restoreState
protected void restoreState()
- Restore state before receiving the processor again.
- Overrides:
- restoreState in class KThread