Condition variables
This presentation is the property of its rightful owner.
Sponsored Links
1 / 5

Condition variables PowerPoint PPT Presentation


  • 46 Views
  • Uploaded on
  • Presentation posted in: General

Condition variables. proc notify (cvar) { acquire (tt_lock); for (i = 0 to N-1) do { if (ttable[i].cvar == cvar && ttable[i].state == WAITING) { ttable[i].state  RUNNABLE;} } release(tt_lock);}. proc wait(cvar, lock) {

Download Presentation

Condition variables

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Condition variables

Condition variables


Condition variables

proc notify (cvar) {

acquire (tt_lock);

for (i = 0 to N-1) do {

if (ttable[i].cvar == cvar &&

ttable[i].state == WAITING) {

ttable[i].state  RUNNABLE;}

}

release(tt_lock);}


Condition variables

proc wait(cvar, lock) {

acquire(tt_lock);

ttable[id].lock  lock;

ttable[id].cvar  cvar;

release(tt_lock);

yield(WAITING);

acquire(lock);}


Implementing condition variables

Implementing condition variables

proc wait(cvar, lock) {

yield_wait(cval,lock);

acquire(lock); }


Implementing condition variables1

Implementing condition variables

proc yield_wait(cvar, lock) {

disable_interrupts;

acquire(tt_lock);

release(lock);

ttable[id].lock  lock;

ttable[id].cvar  cvar;

ttable[id].sp  SP;

ttable[id].state  WAITING;

// other yield code

release(tt_lock);

enable_interrupts;}


  • Login