1,277
edits
Changes
→Priority Scheduler: formatting
==Priority Scheduler==
===Implementation===
;New state variables are shown by the class they appear in: '''PriorityQueue: ''' – {{c|KThread lastThread}}'''ThreadState: ''' – {{c|int donatedPriority}}'''PriorityScheduler: TreeSet¬Ђlong (time), KThread¬ї ''' – {{c|ArrayList<KThread> waitQueue}} ;Implementation details
* nextThread()
* This method retrieves and removes the highest priority thread off the Priority-Time set. It calculates this thread's priority based on priorities of the threads waiting in the queue. It resets the priority of thread previously in the lastThread position to its original priority. The thread to be returned is also set as the new lastThread.
* acquire()
* This method calculates the priority of the associated thread based on priorities of the threads waiting in the queue. It resets the priority of the thread previously in the lastThread position to its original priority. The associated thread is set as the new lastThread.
===Testing===
===Pseudocode===
FIXME
==Boat.java==