CPS110: Address translation Landon Cox February 18, 2009 Course administration Project 1 drawing to a close Two groups with 100% (another is close) Four groups > 60 on 1t Many others close (40-50 range) Some final tips … Course administration What to carefully reread Section 4.4 of the spec (ordering stuff) Thread implementation slides Lock implementation slides I see a lot of code that ignore these sources Other hints … Course administration /* * Allocate space for thread control block and * new stack. */ try { thread_ptr = new thread_t; thread_ptr->stack = NULL; thread_ptr->stack = new char [stack_size]; } catch(bad_alloc) { if (thread_ptr != NULL) { if (thread_ptr->stack != NULL) { delete [] thread_ptr->stack; } delete thread_ptr; } return(-1); } Course administration Project 2 (virtual memory) out next Wednesday In some ways easier than P1 In some ways harder than P1 (not given a solution) Next deadline: midterm exam (February 23rd) In-class One sheet (two sides) of notes No laptops or other electronic resources Practice exam in discussion section this week Midterm exam What will be covered? All threads/concurrency material Project 1 Lectures Homework problems Analysis vs synthesis No regurgitation questions Analysis questions Analyze system/program/design Trace through program Compute performance Determine properties (deadlock, starvation, races) Synthesis Design/construct a new system/program/design I like these more (e.g. learn the most doing projects) How to study Do homework problems Understand Project 1 In groups Create and answer questions I might ask (you might get lucky; happened in past) Syntax for programs Real or pseudo is fine (just be clear) STL is fine queue.{push, pop, front, empty} Monitors Project 1 syntax or OO syntax thread_lock (lock_num) or mutex.lock () Semaphores OO syntax sem1.up (), sem1.down (), sem2.up (), … There is no “getVal” call! Remember to specify initial value!! Syntax for traces Thread: line number (or range of lines) 1: checkMilk () { 2: if (noNote) { 3: leave note 4: if (noMilk){ 5: buy milk; 6: } 7: remove note; 8: } 9: } Landon: Melissa: Landon: Melissa: 1-2 1-2 3-6 3-6 On-board review