Recoverable Mutual Exclusion for Non-Volatile Main Memory Systems
Total Page:16
File Type:pdf, Size:1020Kb
View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by University of Waterloo's Institutional Repository RGLock: Recoverable Mutual Exclusion for Non-Volatile Main Memory Systems by Aditya Ramaraju A thesis presented to the University of Waterloo in fulfillment of the thesis requirement for the degree of Master of Applied Science in Electrical and Computer Engineering (Computer Software) Waterloo, Ontario, Canada, 2015 ©Aditya Ramaraju 2015 AUTHOR'S DECLARATION I hereby declare that I am the sole author of this thesis. This is a true copy of the thesis, including any required final revisions, as accepted by my examiners. I understand that my thesis may be made electronically available to the public. Aditya Ramaraju. ii Abstract Mutex locks have traditionally been the most popular concurrent programming mechanisms for inter- process synchronization in the rapidly advancing field of concurrent computing systems that support high- performance applications. However, the concept of recoverability of these algorithms in the event of a crash failure has not been studied thoroughly. Popular techniques like transaction roll-back are widely known for providing fault-tolerance in modern Database Management Systems. Whereas in the context of mutual exclusion in shared memory systems, none of the prominent lock algorithms (e.g., Lamport’s Bakery algorithm, MCS lock, etc.) are designed to tolerate crash failures, especially in operations carried out in the critical sections. Each of these algorithms may fail to maintain mutual exclusion, or sacrifice some of the liveness guarantees in presence of crash failures. Storing application data and recovery information in the primary storage with conventional volatile memory limits the development of efficient crash-recovery mechanisms since a failure on any component in the system causes a loss of program data. With the advent of Non-Volatile Main Memory technologies, opportunities have opened up to redefine the problem of Mutual Exclusion in the context of a crash-recovery model where processes may recover from crash failures and resume execution. When the main memory is non-volatile, an application’s entire state can be recovered from a crash using the in-memory state near-instantaneously, making a process’s failure appear as a suspend/resume event. This thesis proceeds to envision a solution for the problem of mutual exclusion in such systems. The goal is to provide a first-of-its-kind mutex lock that guarantees mutual exclusion and starvation freedom in emerging shared-memory architectures that incorporate non-volatile main memory (NVMM). iii Acknowledgements This thesis wouldn’t have been possible without the expertise, guidance, and the incredible patience of my advisor Prof. Wojciech Golab. The precision and non-dualism in everything that he says and writes is something I have continuously strived to inculcate throughout the duration of my MASc program. I shall always remain as the greatest admirer of his vast knowledge and skills in many areas, among which his technical writing is a class apart. Few people can inspire interest and passion towards the subject of Distributed Computing better than he does. I am deeply indebted to him for mentoring, educating, employing, and in a way, tirelessly parenting me during the last two years that made a significant difference in my life and shaped me as a better individual. I sincerely doubt that I will ever be able to express my appreciation fully, but I owe him my eternal gratitude. Every academic and professional achievement I ever make, starting with RGLock, is only a dedication and tribute to him. I owe my gratitude to Prof. Rajay Vedaraj at VIT University for all the knowledge sharing, constant encouragement, and inspiration he provided ever since my undergrad days. My sincere thanks to my friend Kartik Josyula for motivating me to pursue higher studies in Canada, and special thanks to Ankur Agarwal and Krunal Barot, my supervisors at IBM India, for duly encouraging me in this regard. I am also very thankful to my close friends, particularly Youcef Tebbal and Nicholas Petroff, for making my time in Waterloo so wonderful with as many thought-provoking discussions as the numerous mindless debates we ran into. I must also acknowledge the important role of my brother, Ramakrishna Rao Ramaraju, in being the primary source of inspiration for everything I have ever learnt about computers, not to mention the readily available financial assistance he provided whenever required. Finally, I am ever grateful to my parents for all their support and the sacrifices they have made for providing me with high quality education at only the best schools in every stage, of which, home remains my most favorite. iv Dedication To Annaya, and To my Guru. v Table of Contents AUTHOR'S DECLARATION ...................................................................................................................... ii Abstract ........................................................................................................................................................ iii Acknowledgements ...................................................................................................................................... iv Dedication ..................................................................................................................................................... v Table of Contents ......................................................................................................................................... vi List of Figures ............................................................................................................................................ viii List of Algorithms ........................................................................................................................................ ix Chapter 1 Introduction .................................................................................................................................. 1 1.1 Preliminaries ....................................................................................................................................... 2 1.2 Background & Motivation .................................................................................................................. 3 1.2.1 Spin-lock algorithms .................................................................................................................... 3 1.2.2 Crash-recoverable Mutex ............................................................................................................. 6 1.3 Summary of Results .......................................................................................................................... 10 Chapter 2 Related Work .............................................................................................................................. 11 Chapter 3 Model Specification ................................................................................................................... 17 3.1 Hardware Considerations .................................................................................................................. 17 3.2 Formalism ......................................................................................................................................... 18 vi 3.3 Crash-recoverable Execution ............................................................................................................ 19 Chapter 4 Recoverable Mutual Exclusion .................................................................................................. 22 Chapter 5 Algorithm ................................................................................................................................... 24 5.1 RGLock ............................................................................................................................................. 24 5.2 Swap and Store ................................................................................................................................. 30 5.3 Crash-recovery Procedures ............................................................................................................... 32 Chapter 6 Correctness ................................................................................................................................. 35 6.1 Notational Conventions .................................................................................................................... 35 6.2 Preliminaries ..................................................................................................................................... 36 6.3 Recoverable Mutual Exclusion ......................................................................................................... 41 Chapter 7 Conclusion and Future Work ..................................................................................................... 54 7.1 Summary ........................................................................................................................................... 54 7.2 Future Research ................................................................................................................................ 56 vii List of Figures Figure 3.1 Failure-free and crash-recoverable passages. ............................................................................ 21 Figure 5.1 Phase transitions of a process