Why is it so hard for non-programmers to understand mutex locks?
No… I am not asking non-programmers to understand programming at all. But concepts that we use in programming that came from real-life in the first place? Come on… Programmers learned from real-life, not the other way around!
Let me explain: at the hospital, after a not so clever renovation, we ended up with an employee restroom that is far from work place (in fact, almost in another department). Most of the times it is occupied… So it takes a trip to the restroom just to learn that it cannot be used at that moment! In a busy morning, one of those trips is just what one can do!
As a programmer I suggested a mutex lock: change the restroom door lock and make only one copy of the key, that should be kept in a common place and returned after being used. If you want to use the restroom and it’s occupied, just learning the key is not there is enough to save a useless trip.
Come on… that is not a hard concept! As I said, we, programmers, learned it from real-life, in settings just as the one I described above!
Well, I just got the key (“acquired the lock”, in programmer speech) and went to the restroom. When I unlocked the door I was surprised by someone already using it! How embarassing! Someone had the smart idea of making a copy of the key! What part of the mutex concept did people not understand?
Luckily, most computational mutex algorithms prevent “lock cloning”... :-)
0sem comentários ainda