There are (mostly) two types of concurrency bugs: Non deadlock and deadlock bugs. Of the non-deadlock bugs, the main types are:...
A semaphore has an integer value that you set when you initialize. It has two operations: wait and post. The wait operation will first...
Sometimes we want a thread to check if a condition is true before continuing execution. You could just use a global variable and check...
Concurrent Counters What if you have a shared counter, and you want several threads to update it? Simply locking before update will...
Normally, we create threads, but the OS schedules them however it likes. Locking/unlocking gives the programmer some semblance of...
When creating a lock, you must do two things: Initialize the lock Check if lock/unlock failed! (i.e. check the error code). It’s common...
A thread is lot like a process, except that it shares memory with other threads. A thread has its own program counter from which it gets...