|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nachos.threads.ThreadQueue nachos.threads.PriorityScheduler.PriorityQueue
protected class PriorityScheduler.PriorityQueue
A ThreadQueue that sorts threads by priority.
Field Summary | |
---|---|
boolean |
transferPriority
true if this queue should transfer priority from waiting threads to the owning thread. |
Method Summary | |
---|---|
void |
acquire(KThread thread)
Notify this thread queue that a thread has received access, without going through request() and nextThread(). |
KThread |
nextThread()
Notify this thread queue that another thread can receive access. |
protected PriorityScheduler.ThreadState |
pickNextThread()
Return the next thread that nextThread() would return, without modifying the state of this queue. |
void |
print()
Print out all the threads waiting for access, in no particular order. |
void |
waitForAccess(KThread thread)
Notify this thread queue that the specified thread is waiting for access. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean transferPriority
Method Detail |
---|
public void waitForAccess(KThread thread)
ThreadQueue
A thread must not simultaneously wait for access to multiple resources. For example, a thread waiting for a lock must not also be waiting to run on the processor; if a thread is waiting for a lock it should be sleeping.
However, depending on the specific objects, it may be acceptable for a thread to wait for access to one object while having access to another. For example, a thread may attempt to acquire a lock while holding another lock. Note, though, that the processor cannot be held while waiting for access to anything else.
waitForAccess
in class ThreadQueue
thread
- the thread waiting for access.public void acquire(KThread thread)
ThreadQueue
This method should not be called for a thread returned from nextThread().
acquire
in class ThreadQueue
thread
- the thread that has received access, but was not
returned from nextThread().public KThread nextThread()
ThreadQueue
If the limited access object transfers priority, and if there are other threads waiting for access, then they will donate priority to the returned thread.
nextThread
in class ThreadQueue
protected PriorityScheduler.ThreadState pickNextThread()
public void print()
ThreadQueue
print
in class ThreadQueue
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |