[Multithreading] Asynchronous Sleep in Distributed applications

Scenario: You have to design and implement a distributed application where a lot of clients call different operations in parallel. In certain situations, in order to make the system behave better, you need to delay some operations. Some examples where this can be useful: – The distributed system encounters a problem and you have a…


Bad Locking Patterns

Multithreading adds the overhead of making sure data is accessed in a thread safe way. Win32 API uses the CRITICAL_SECTION structure and functions. CLR provides mutual exclusive locks with Monitor and sync blocks. Basically, the Monitor class provides the same mechanism as CRITICAL_SECTION. How it works under the hood: every object in managed world has…

1