Tag concurrency

Common Concurrency Problems

There are (mostly) two types of concurrency bugs: Non deadlock and deadlock bugs. Of the non-deadlock bugs, the main types are:...

Semaphores

A semaphore has an integer value that you set when you initialize. It has two operations: wait and post. The wait operation will first...

Condition Variables

Sometimes we want a thread to check if a condition is true before continuing execution. You could just use a global variable and check...

Lock Based Concurrent Data Structures

Concurrent Counters What if you have a shared counter, and you want several threads to update it? Simply locking before update will...

Locks

Normally, we create threads, but the OS schedules them however it likes. Locking/unlocking gives the programmer some semblance of...

Thread API

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...

Introduction to Concurrency

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...