What your article describes is widely used today. Most often it is called the “ Critical Section ”, and it consists of a locked variable, a group of flags, and an internal synchronization object (Mutex, if I remember correctly). As a rule, in scenarios with a small amount of conflicts, the critical section is executed completely in user mode without using the kernel synchronization object. This ensures quick execution. When the conflict is high, the kernel object is used to wait, which frees up a time slice conducting for faster rotation.
As a rule, there is very little sense in implementing synchronization primitives on this day and in age. Operating systems come with a large number of such objects, and they are optimized and tested in a much wider range of scenarios than one programmer could imagine. Literally, it takes time to invent, implement and test a good synchronization mechanism. This does not mean that you should not try :)
source share