0% found this document useful (0 votes)
103 views2 pages

Lab Quiz Notes

Lab Quiz Notes for SC2005

Uploaded by

Reswara Anargya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views2 pages

Lab Quiz Notes

Lab Quiz Notes for SC2005

Uploaded by

Reswara Anargya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Thread.

cc
Lab Quiz Notes Fork(Function, arg, joinP)

 Allocate space in stack for


function
Scheduler.cc  Disable interrupts
Scheduler()  Admit to ready queue
 Enable interrupts
 Creates list

ReadyToRun(*thread)

 Set Status of thread to READY Finish()


 Add thread to list
 Disable interrupts
FindNextToRun()  ThreadToBeDestroyed =
 Return thread at the front of the list currentThread
 Remove pending interrupts
Run(*nextThread) (InterruptRemove)
 CheckOverflow  ScheduleTimerInterrupt()
 Change status of new thread to RUNNING  Sleep()
 SWITCH(oldThread, nextThread)
Yield()
 Terminate previous thread if applicable
 Disable Interrupts
 FindNextToRun()
Sleep()  If Ready queue is not empty
 Make sure interrupts are disabled o Add current thread to Ready
 Set status of thread to BLOCKED queue
 While ready queue is empty -> o Run the next thread
Idle  Enable interrupts
 Run the next thread
TimerExpired()/ TimeOfNextInterrupt()
ScheduleTimerInterruot()
 Return 40 (TimerTicks)
 Schedule a new interrupt

InterruptRemove() ChangeLevel ()
 Remove pending interrupts  Enable/Disable Interrupts
from the pending list

SetLevel ()

 Enable/Disbale Interrupts OneTick()


 If Enabled -> OneTick()
 Advance simulated time
 Disable interrupts
CheckIfDue(advanceClock)  Check for pending interrupts
 Disable Interrupts CheckIfDue()
o If advance Clock …  Enable Interrupts
 If YieldOnReturn
o Switch to SystemMode
o Yield current thread
o Switch back to old
Mode

You might also like