Hacker News new | past | comments | ask | show | jobs | submit login

Mutex is a synchronization primitive implementing mutual exclusion. When created with a name, they can be used to synchronize processes across the whole OS.

For instance, a named mutex is a good way to ensure the program can only be running in a single instance. Specifically, the program creates a named mutex on startup, and locks it forever. If failed to lock, it shows a message saying "another instance is already running" and quit. When the program quits normally, the OS will automatically unlock the mutex, allowing the program to run once again.

Now, imagine that by coincidence, 2 unrelated programs have implemented that approach using the same name for the mutex. This gonna break both of them with weird bugs. Launch program A, then launch program B, and it won't run complaining "another instance is already running" despite that's not true.

For this reason, mutex names are better be very unique.

A typical solution is generating a GUID and using it for the name of the mutex.

But the developer of that particular program instead used the string "What are the odds that some idiot will name his mutex ether-rot-mutex!" They're not wrong in the sense the odds are miniscule, however GUIDs are unique too and much shorter, only 36 characters.




You must have interactions exclusively with prodigious 5 year olds


It was a good explanation.

How good is "the man tried to think of a name no one ever thought of before?"


what does ether-rot refer to?


In 2003, “ether” might have referred to “Ethernet”, wired networking.

Rot might have referred to decay or a rotation cipher, like ROT13. https://en.m.wikipedia.org/wiki/ROT13

I think here they are essentially random like “I hope no one else uses Correct Battery Horse Staple for their globally unique ID”.

https://xkcd.com/936/


wondering the same, maybe simple word play on ethernet.. who knows what floats about in the brain of a developer! naming vars is hard dangerous work in my experience!


This is the real question.

How can the ether rot? Is it not eternal?


thank you :)


Thanks!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: