cs 134 operating systems
play

CS 134: Operating Systems Better Synchronization 1 / 21 Overview - PowerPoint PPT Presentation

CS34 2013-05-19 CS 134: Operating Systems Better Synchronization CS 134: Operating Systems Better Synchronization 1 / 21 Overview CS34 Overview 2013-05-19 Aside: Attending a Conference More Low-Level Synchronization Overview


  1. CS34 2013-05-19 CS 134: Operating Systems Better Synchronization CS 134: Operating Systems Better Synchronization 1 / 21

  2. Overview CS34 Overview 2013-05-19 Aside: Attending a Conference More Low-Level Synchronization Overview Higher-Level Primitives atomic yield Avoiding Locks Aside: Attending a Conference More Low-Level Synchronization Higher-Level Primitives atomic yield Avoiding Locks 2 / 21

  3. Aside: Attending a Conference How to Attend a Conference CS34 How to Attend a Conference 2013-05-19 Aside: Attending a Conference OSDI is next week How to get the most out of it? How to Attend a Conference OSDI is next week How to get the most out of it? 3 / 21

  4. Aside: Attending a Conference Tech Sessions CS34 Tech Sessions 2013-05-19 Aside: Attending a Conference ◮ Program is posted at https://www.usenix.org/conference/osdi12/ tech-schedule/osdi-12-program ◮ Mouse over title to get abstract ◮ Key for full-text versions will be sent this week ◮ Not required to attend all sessions Tech Sessions ◮ But should be over 50% ◮ . . . and interest should be in 75% ◮ Use in-session time wisely ◮ Treat it like class or colloquium ◮ If you’re a scribe, take careful notes—you’re the only one! ◮ Wireless will be available ◮ Program is posted at https://www.usenix.org/conference/osdi12/ tech-schedule/osdi-12-program ◮ Mouse over title to get abstract ◮ Key for full-text versions will be sent this week ◮ Not required to attend all sessions ◮ But should be over 50% ◮ . . . and interest should be in 75% ◮ Use in-session time wisely ◮ Treat it like class or colloquium ◮ If you’re a scribe, take careful notes—you’re the only one! ◮ Wireless will be available 4 / 21

  5. Aside: Attending a Conference Poster Sessions CS34 Poster Sessions 2013-05-19 Aside: Attending a Conference ◮ Two sessions Monday & Tuesday evenings ◮ Often best source of information about cutting-edge research ◮ Budget your time wisely Poster Sessions ◮ Spend time getting detail on posters that interest you ◮ Finger food will be provided ◮ Two sessions Monday & Tuesday evenings ◮ Often best source of information about cutting-edge research ◮ Budget your time wisely ◮ Spend time getting detail on posters that interest you ◮ Finger food will be provided 5 / 21

  6. Aside: Attending a Conference BOFs CS34 BOFs 2013-05-19 Aside: Attending a Conference ◮ Late evenings ◮ Choose wisely—often not terribly informative BOFs ◮ Late evenings ◮ Choose wisely—often not terribly informative 6 / 21

  7. Aside: Attending a Conference The “Hallway Track” CS34 The “Hallway Track” 2013-05-19 Aside: Attending a Conference ◮ Often considered most important part of a conference ◮ Takes place at breaks, at lunch, poster sessions, etc. ◮ Chance to learn more, get to know useful people ◮ Get up your gumption and talk to a stranger! ◮ Choose small groups (2-3) The “Hallway Track” ◮ Should have at least one younger person ◮ OK to talk to anyone who’s alone ◮ I will introduce you to anybody I’m talking to ◮ Don’t join if large group (limits exposure) ◮ Don’t cling (limits variety) ◮ Good chance to quiz people with interesting papers/posters ◮ Often considered most important part of a conference ◮ Takes place at breaks, at lunch, poster sessions, etc. ◮ Chance to learn more, get to know useful people ◮ Get up your gumption and talk to a stranger! ◮ Choose small groups (2-3) ◮ Should have at least one younger person ◮ OK to talk to anyone who’s alone ◮ I will introduce you to anybody I’m talking to ◮ Don’t join if large group (limits exposure) ◮ Don’t cling (limits variety) ◮ Good chance to quiz people with interesting papers/posters 7 / 21

  8. More Low-Level Synchronization Where We Were. . . CS34 Where We Were. . . 2013-05-19 More Low-Level Synchronization Last time we looked at Test-and-Set, Swap, and Compare-and-Swap T&S is good for locking; Swap isn’t good for much of anything. Where We Were. . . C&S can be used for lock-free synchronization—if you’re very careful! Last time we looked at Test-and-Set, Swap, and Compare-and-Swap T&S is good for locking; Swap isn’t good for much of anything. C&S can be used for lock-free synchronization—if you’re very careful! 8 / 21

  9. More Low-Level Synchronization Load Linked / Store Conditional CS34 Load Linked / Store Conditional 2013-05-19 Pseudocode: int load_linked(int *addr) bool store_conditional( More Low-Level Synchronization { int *addr, newval) int origval; { atomic { atomic { origval = *addr; switch ( mem_watch(addr); watch_result(addr)) { Pseudocode: } case UNCHANGED: Load Linked / Store Conditional return origval; *addr = newval; } return true; case CHANGED: return false; case WASNT_WATCHING: int load_linked(int *addr) bool store_conditional( return false; } stop_watching(addr); } { int *addr, newval) } Can you write increment? Answer: yes, because you can implement int origval; { CAS with this. atomic { atomic { But LL/SC is limited, because often only one memory location can be origval = *addr; switch ( watched at a time. So if many LL are used at once, all but one might mem_watch(addr); watch_result(addr)) { break. And in any case, there is no guarantee of fairness. } case UNCHANGED: return origval; *addr = newval; } return true; case CHANGED: return false; case WASNT_WATCHING: return false; } stop_watching(addr); } } 9 / 21

  10. More Low-Level Synchronization Which Processors Have What. . . CS34 Which Processors Have What. . . 2013-05-19 Instructions to perform simple changes in atomic read- op -write More Low-Level Synchronization cycle. m68k Compare and Swap ( cas ) SPARC Compare and Swap ( cas ) x86 Compare and Exchange ( cmpxchgl ) MIPS Load-Linked/Store Conditional ( ll / sc ) Which Processors Have What. . . (R4000 upwards) PowerPC Load Word & Reserve/Store Word Conditional ( lwarx / stwcx ) Instructions to perform simple changes in atomic read- op -write cycle. m68k Compare and Swap ( cas ) SPARC Compare and Swap ( cas ) x86 Compare and Exchange ( cmpxchgl ) MIPS Load-Linked/Store Conditional ( ll / sc ) (R4000 upwards) PowerPC Load Word & Reserve/Store Word Conditional ( lwarx / stwcx ) 10 / 21

  11. More Low-Level Synchronization Which Processors Have What. . . CS34 Which Processors Have What. . . 2013-05-19 Instructions to perform simple changes in atomic read- op -write More Low-Level Synchronization cycle. m68k Compare and Swap ( cas ) SPARC Compare and Swap ( cas ) x86 Compare and Exchange ( cmpxchgl ) MIPS Load-Linked/Store Conditional ( ll / sc ) Which Processors Have What. . . (R4000 upwards) PowerPC Load Word & Reserve/Store Word Conditional ( lwarx / stwcx ) Instructions to perform simple changes in atomic read- op -write System/161 No hardware synchronization (MIPS R2000/R3000) cycle. m68k Compare and Swap ( cas ) SPARC Compare and Swap ( cas ) x86 Compare and Exchange ( cmpxchgl ) MIPS Load-Linked/Store Conditional ( ll / sc ) (R4000 upwards) PowerPC Load Word & Reserve/Store Word Conditional ( lwarx / stwcx ) System/161 No hardware synchronization (MIPS R2000/R3000) 10 / 21

  12. More Low-Level Synchronization Which Processors Have What. . . CS34 Which Processors Have What. . . 2013-05-19 Instructions to perform simple changes in atomic read- op -write More Low-Level Synchronization cycle. m68k Compare and Swap ( cas ) SPARC Compare and Swap ( cas ) x86 Compare and Exchange ( cmpxchgl ) MIPS Load-Linked/Store Conditional ( ll / sc ) Which Processors Have What. . . (R4000 upwards) PowerPC Load Word & Reserve/Store Word Conditional ( lwarx / stwcx ) Instructions to perform simple changes in atomic read- op -write System/161 No hardware synchronization (MIPS R2000/R3000) Which primitives can we simulate and how? cycle. m68k Compare and Swap ( cas ) SPARC Compare and Swap ( cas ) x86 Compare and Exchange ( cmpxchgl ) MIPS Load-Linked/Store Conditional ( ll / sc ) (R4000 upwards) PowerPC Load Word & Reserve/Store Word Conditional ( lwarx / stwcx ) System/161 No hardware synchronization (MIPS R2000/R3000) Which primitives can we simulate and how? 10 / 21

  13. Higher-Level Primitives atomic Higher-Level Primitives CS34 Higher-Level Primitives 2013-05-19 Higher-Level Primitives The idea of wanting to do things atomically seems like a good one. . . atomic Higher-Level Primitives The idea of wanting to do things atomically seems like a good one. . . 11 / 21

  14. Higher-Level Primitives atomic Higher-Level Primitives CS34 Higher-Level Primitives 2013-05-19 Higher-Level Primitives The idea of wanting to do things atomically seems like a good one. . . atomic atomic { Higher-Level Primitives yourBalance = yourbalance - 100; myBalance = myBalance + 100.00; } The idea of wanting to do things atomically seems like a good one. . . atomic { yourBalance = yourbalance - 100; myBalance = myBalance + 100.00; } 11 / 21

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend