commandments - The 12 Commandments of Synchronization Emin...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
The 12 Commandments of Synchronization Emin G¨un Sirer Computer Science Department, Cornell University October 2, 2011 Abstract In the beginning, there was hardware. Now the hardware was formless and empty, darkness was over the surface of silicon. And then the creator said “let there be operating systems,” and there were OSes. The creator saw that OSes were good. And the creator said “let there be processes, and threads.” OSes were teeming with processes and threads carrying out different tasks. Then the creator said “let the processes and threads synchronize with each other.” For this task, the creator appointed human-kind. But humans were fallible, and weak, and they failed to get synchronization correct, and fallen angel BSOD (pronounced beesod ), spawn of Beelzebub, ruled the day with great evil. So the creator sent the following commandments. Commandment 0. Thou shalt live and die by coding conventions for synchroniza- tion. Remember the parable of Jebediah the Electrician, who wired up his house using only pink wires. He said onto the townsfolks “I saved a bundle by not buying properly color-coded wires; and yet my lights turn on when I flippeth the switch. My wiring is correct and just right for my needs, and I did not have to worry about blue wires and green wires and brown wires. I use the book of Good Wiring Conventions as TP in my outhouse, for I have no use for any rules.” And the townsfolks said “be careful with your hubris, for the creator might smite thee.” And he respondeth, “I rule over you with my cheap wiring and you are all weaklings for following well-known good practices.” Remember when his wife was with child, and he wanted to build an addition to his house? He made a mistake when tracing the all-pink wires all the way back to the power plant, cut into a live wire with his metal clippers, and was promptly fried in a flash of hellfire. Take heed of the story of ex-Jebediah the Electrician, now known as Jebediah the Crisp. For that is the fate that awaits you when you do not follow conventions when writing synchronization code. There will be times, tempting times, when the problem seems constrained enough to solve with a custom solution that violates the conventions you have been taught. We sent these to you to test your free will and self-control, and BSOD lurks behind them. If you give in to the temptation, you will come up with a solution that may be correct just by the skin of its teeth, but will likely not be understandable to others in the field. It may be just right, or it may have subtle bugs, but in either case, it 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
will take a lot of time to figure out its properties either way. Remember that your goal is not to barely meet the minimum correctness criteria—we created you in our image to strive for higher standards. Your goal is to meet the correctness criteria with code that is clear, obviously correct, self-documenting, and maintainable. So for that reason, always follow the commandments, even when not doing so does not immediately lead
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

commandments - The 12 Commandments of Synchronization Emin...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online