本書由G?del獎得主領銜撰寫,主要討論共享存儲通信方式下的多處理器并發(fā)程序設計。首先介紹基本原理,分析異步并發(fā)環(huán)境中的可計算問題,包括相關度量標準和方法。然后開展應用實踐,側重于并發(fā)程序的性能分析。每一章討論一種特定的并發(fā)數(shù)據(jù)結構、程序設計模式或算法技巧。第2版對數(shù)據(jù)并行、事務性編程、存儲管理等內容做了重點更新和擴充,并采用C 語言重構相關示例,更加關注底層機制。本書適合作為高等院校計算機相關專業(yè)的課程教材,也適合作為業(yè)界技術人員的參考書籍。
莫里斯·赫利希(Maurice Herlihy) 布朗大學計算機科學教授,曾任職于卡內基·梅隆大學和DEC公司劍橋實驗室。他獲得了包括Edsger W. Dijkstra獎(2003,2012)、ACM/EATCS Gdel獎(2004)、IEEE Wallace McDowell獎(2013)和Fulbright杰出講席(2012)在內的眾多榮譽。他是ACM會士,美國國家發(fā)明家科學院、美國國家工程院以及美國藝術與科學院院士。他擁有麻省理工學院計算機科學博士學位。
尼爾·沙維特(Nir Shavit) 麻省理工學院計算機科學教授,特拉維夫大學計算機科學教授,曾任職于Sun實驗室和Oracle實驗室。他與Maurice Herlihy分享了Edsger W. Dijkstra獎(2012)和ACM/EATCS Gdel獎(2004)。他擁有希伯來大學計算機科學博士學位。
維克多·盧昌科(Victor Luchangco) Algorand公司高級算法研究員,曾任職于Sun實驗室和Oracle實驗室。他擁有麻省理工學院計算機科學博士學位。
邁克爾·斯皮爾(Michael Spear) 理海大學計算機科學教授。他擁有羅切斯特大學計算機科學博士學位。
Preface
Acknowledgments
Suggestedwaystoteachtheartofmultiprocessorprogramming
CHAPTER 1 Introduction .................................... 1
1.1 Sharedobjectsandsynchronization .................... 3
1.2 Afable ......................................... 6
1.2.1 Propertiesofamutualexclusionprotocol .......... 8
1.2.2 Themoral .................................. 9
1.3 Theproducerconsumerproblem...................... 9
1.4 Thereaderswritersproblem ......................... 11
1.5 Theharshrealitiesofparallelization.................... 12
1.6 Parallelprogramming .............................. 14
1.7 Chapternotes..................................... 15
1.8 Exercises........................................ 15
PART 1 Principles
CHAPTER2 Mutual exclusion ............................... 21
2.1 Timeandevents................................... 21
2.2 Criticalsections................................... 22
2.3 Two-threadsolutions ............................... 25
2.3.1 TheLockOne class ............................ 25
2.3.2 TheLockTwo class ............................ 26
2.3.3 ThePetersonlock ............................ 27
2.4 Notesondeadlock ................................. 29
2.5 Thefilterlock .................................... 30
2.6 Fairness......................................... 33
2.7 LamportsBakeryalgorithm ......................... 34
2.8 Boundedtimestamps ............................... 35
2.9 Lowerboundsonthenumberoflocations ............... 39
2.10Chapternotes..................................... 41
2.11 Exercises........................................ 42
CHAPTER 3 Concurrent objects ............................. 49
3.1 Concurrencyandcorrectness ......................... 49
3.2 Sequentialobjects ................................. 52
3.3 Sequentialconsistency.............................. 53
3.3.1 Sequentialconsistencyversusreal-timeorder ....... 55
3.3.2 Sequentialconsistencyisnonblocking............. 56
3.3.3 Compositionality............................. 57
3.4 Linearizability .................................... 58
3.4.1 Linearizationpoints .......................... 58
3.4.2 Linearizabilityversussequentialconsistency ........ 59
3.5 Quiescentconsistency .............................. 59
3.5.1 Propertiesofquiescentconsistency ............... 60
3.6 Formaldefinitions ................................. 60
3.6.1 Histories ................................... 60
3.6.2 Linearizability............................... 61
3.6.3 Linearizabilityiscompositional.................. 63
3.6.4 Linearizabilityisnonblocking ................... 63
3.7 Memoryconsistencymodels ......................... 64
3.8 Progressconditions ................................ 64
3.8.1 Wait-freedom ............................... 65
3.8.2 Lock-freedom ............................... 65
3.8.3 Obstruction-freedom .......................... 66
3.8.4 Blockingprogressconditions ................... 67
3.8.5 Characterizingprogressconditions ............... 67
3.9 Remarks ........................................ 68
3.10 Chapternotes..................................... 69
3.11 Exercises........................................ 70
CHAPTER 4 Foundations of shared memory ................. 75
4.1 Thespaceofregisters .............................. 76
4.2 Registerconstructions .............................. 81
4.2.1 SafeMRSWregisters ......................... 82
4.2.2 AregularBooleanMRSWregister ............... 83
4.2.3 AregularM-valuedMRSWregister .............. 84
4.2.4 AnatomicSRSWregister ...................... 85
4.2.5 AnatomicMRSWregister ..................... 87
4.2.6 AnatomicMRMWregister..................... 90
4.3 Atomicsnapshots ................................. 92
4.3.1 Anobstruction-freesnapshot.................... 92
4.3.2