Posts

Showing posts with the label locking

“When all you have is a hammer”: #CowboyDeveloper Edition

Image
“ Locking is easy — just use a mutex!”         --#CowboyDeveloper One of the surest “tells” of a  #CowboyDeveloper  is their behavior around a shared resources. Odds are they’ll slap a mutex around it (or around  something ), and keep going. Oh, if you really poke at them, they might be able to ( intelligently? maybe not ) say  something  about  mutexes vs semaphores vs spin-locks vs … , but, seriously, in their mind, “I t’s all so simple! You just lock/unlock it! Like, with mutexes! ” The above, mind you, as contrasted with the  excellent work by Willy Tarreau (most definitely  not  a #CowboyDeveloper) on  Progressive Locks . “What are they?” you ask? Well, if you’ve got a resource (tree, list, whatever) where you’re usually reading the resource, but, sometimes, you want to write  only  if your Read succeeded. In short, you want to be able to “upgrade” from a Read to a Write. S...