RAlI - The Silent Guardian of Your C++ Code
RAII - The Silent Guardian of Your C++ Code How a destructor saved my multithreaded system late at night It was late at night. A multithreaded simulation platform had just frozen solid, no crash, no exception, no log entry. Just silence. The kind of silence that means every thread is waiting for every other thread, and nothing will ever move again. A deadlock. The engineer staring at the thread dump traced it back to an early-return path buried three call levels deep. Someone had locked a mutex, hit an error condition, returned immediately, and never unlocked. Under light load the path was never triggered. Under the stress of a parallel workload with dozens of threads hammering the same subsystem, it was only a matter of time. The mutex stayed locked. The threads piled up. The system seized. The lock had been acquired manually. It had been forgotten manually. These two facts were never meant to be separated and yet they were, by twelve lines of error-handling code a...

The answer is Andrew:75, Watson:87, Lestrade:78.
ReplyDeleteTo solve this puzzle logically:
1. Make 2 cases of Watson's number - depending on carry from unit's place. Then do integer solution for the resulting equation (2 cases).
2. Also, Watson's and Lestrade's sum should be a multiple 11, this which limits the candidates for Andrew. Rest of the computation follows.
This puzzle can also be solved by coding the statements and searching the range os possible scores.
Here is the code for doing so: https://docs.google.com/file/d/0B1RemqblO3BZYWNfeW0xSkVTU0E/edit?usp=sharing