This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Page 1 CS162 Operating Systems and Systems Programming Lecture 4 Synchronization, Atomic operations, Locks January 30, 2012 Anthony D. Joseph and Ion Stoica http://inst.eecs.berkeley.edu/~cs162 Lec 4.2 1/30/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Space Shuttle Example Original Space Shuttle launch aborted 20 minutes before scheduled launch Shuttle has Fve computers: our run the Primary Avionics Software System (PASS) Asynchronous and real-time Runs all of the control systems Results synchronized and compared 440 times per second The ifth computer is the Backup light System (BS) Stays synchronized in case it is needed Written by completely different team than PASS Countdown aborted because BS disagreed with PASS A 1/67 chance that PASS was out of sync one cycle Bug due to modiFcations in initialization code of PASS A delayed init request placed into timer queue As a result, timer queue not empty at expected time to force use of hardware clock Bug not found during extensive simulation PASS BFS Lec 4.3 1/30/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Concurrency Multiple computations (threads) executing in parallel to share resources, and/or share data Share resources: high utilization Share data: enable cooperation between apps, e.g., Browser sharing data with OS to send/receive packets Web server: thread master sharing work & results with thread pool (see previous lecture) Powerpoint sharing data with Excel and Word Lec 4.4 1/30/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Challenges Applications/programmers would like a system to behave as they were the only one using it (e.g., VM abstraction) Performance isolation and predictability Outputs should be consistent with application semantics E.g., depositing $100 and then another $100 to your bank account should always increase your balance by $200 Page 2 Lec 4.5 1/30/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Sharing Granularity Fine grain sharing: increase concurrency better performance more complex Coarse grain sharing: Simpler to implement Lower performance Examples: Sharing CPU for 10ms vs. 1min Sharing a database at the row vs. table granularity A single query can access a row/table at a time Allow one person vs. multiple persons in a supermarket! Lec 4.6 1/30/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Goals for Today Synchronization Hardware Support for Synchronization Note: Some slides and/or pictures in the following are adapted from slides 2005 Silberschatz, Galvin, and Gagne Note: Some slides and/or pictures in the following are adapted from slides 2005 Silberschatz, Galvin, and Gagne....
View Full Document
This note was uploaded on 03/12/2012 for the course CS 162 taught by Professor Kubiatowicz during the Spring '02 term at University of California, Berkeley.
- Spring '02
- Operating Systems