I am mostly backend programmer. From time to time I need to solve various concurrensy problems and this may take me a lot of time. I may spend a week trying to solve some problem that looks pretty simple. Note, I know basic stuff like mutexes and semaphors work etc. My problem is that combining these primitives to invent solution that is deadlock and race conditions free is very time consuming and exostive. Do you have any advice on how to become better at this? Any approaches, ideas, notations, formal methods, books anything? Thanks in advance.