Lecture19nFull - Click to edit Master subtitle style...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Click to edit Master subtitle style 8/1/11 Lecture 19 COP 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00 – 6:00 PM Lecture 19 8/1/11 n Last time: n Conditions for thread coordination – Safety, Liveness, Bounded-Wait, Fairness n Critical sections – a solution to critical section problem n Locks and Before-or-After actions. Hardware support for locks n Deadlocks; Signals; Semaphores; Monitors n Today: n Solutions to HW5 n Thread coordination with a bounded buffer. ¨ WAIT ¨ NOTIFY ¨ AWAIT ¨ ADVANCE ¨ SEQUENCE ¨ TICKET n Scheduling Algorithms n Next Time ¨ Scheduling Algorithms ¨ Multilevel memories Lecture 19 – Thursday March 31, 2011 Lecture 19 Lecture 19 8/1/11 A solution to critical section problem n Applies only to two threads Ti and Tj with i,j ={0,1} which share ¨ i nteger turn t if turn=i then it is the turn of Ti to enter the critical section ¨ boolean flag[2] t if flag[i]= TRUE then Ti is ready to enter the critical section n To enter the critical section thread Ti ¨ sets flag[i]= TRUE ¨ sets turn=j n If both threads want to enter then turn will end up with a value of either i or j and the corresponding thread will enter the critical section. n Ti enters the critical section - in other words leaves the while loop- only if either ¨ flag[j]= FALSE &Tj is not ready to enter or ¨ turn=i ‘ it is the turn of Ti to enter...
View Full Document

This note was uploaded on 07/30/2011 for the course COP 4600 taught by Professor Montagne during the Spring '08 term at University of Central Florida.

Page1 / 21

Lecture19nFull - Click to edit Master subtitle style...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online