Tags

Concurrency

Concurrency

0 lessons
3 code snippets
2 question banks
7 community items

concurrency

Code Snippets

3 snippets
Code Snippet
Premium

Async Queue with Concurrency Limit

When you have hundreds of API calls but the upstream caps you at 5 in flight, naive `Promise.all` is a 429 storm waiting to happen. A concurrency-limited queue runs at most `n` tasks at once, draining a backlog as workers free up. This snippet starts with the minimal worker pool, adds per-task error isolation, then layers in cancellation and ordered results so the helper holds up in production.

JavaScript
async-programming
concurrency
rate-limiting
queue

445

14

Hard
Code Snippet

Goroutine + Channel Fan-Out

Fan-out is the canonical Go concurrency pattern: a producer pushes jobs onto a channel, a fixed pool of worker goroutines pulls and processes them in parallel, and results flow back through a results channel. This snippet shows a minimal worker pool, the close + range idiom that signals completion, and a `sync.WaitGroup` variant for fire-and-forget. Use this whenever you need parallelism with a bounded number of workers.

Go
go-goroutines
go-channels
go-concurrency-patterns
concurrency

856

15

Medium
Code Snippet

Context-Driven Cancellation

`context.Context` is Go's standard mechanism for cancelling long-running operations: a deadline, a parent-child cancellation tree, and a request-scoped value bag. This snippet shows `context.WithTimeout` to bound a function's runtime, the `select { case <-ctx.Done(): ... }` pattern in workers, and how to attach a request-id value. Pass `ctx` as the first argument to every function that does I/O or has a chance of blocking.

Go
go-context
go-concurrency-patterns
go-channels
concurrency

158

3

Medium

Question Banks

2 items
Question Bank

Producer / Consumer and Locks

Mid-tier drills on bounded buffers, mutexes, semaphores, and deadlock detection. Code stems in Python and JavaScript; one trace involves the four conditions for deadlock.

Python
JavaScript
concurrency
pessimistic-locking
multithreading
interview-prep

1.1k

20

Medium
Question Bank
Premium

Concurrency Edge Cases

Hard drills on race conditions, the ABA problem, lost notifications, and fairness. Mixed JS / Python / Java code stems with subtle bugs to spot and fix.

Python
Java
JavaScript
race-conditions
concurrency
multithreading
interview-prep

1k

17

Hard

Community

7 items
Article

Transaction Isolation Levels with Failing Examples

Read uncommitted, read committed, repeatable read, serializable. Each level explained with a runnable two-session SQL example showing exactly which anomaly it allows or prevents.

database
sql
acid
concurrency
optimistic-locking

493

9

4.4 (14)

May 3, 2026

by @rohaneriksson

Question Bundle
$14.99

PostgreSQL MVCC and Isolation Level Deep Dive

A 5-question reference set on PostgreSQL's MVCC implementation: tuple versioning, READ COMMITTED vs REPEATABLE READ vs SERIALIZABLE, row-level locks, and the autovacuum machinery that keeps txid wraparound at bay.

Python
sql
database
concurrency
interview-prep

668

13

4.4 (16)

Apr 20, 2026

by CodeSnatch

Article

asyncio Explained Without the Jargon

asyncio is a cooperative scheduler for I/O-bound code. async def marks a pause-able function, await is the pause point, and the event loop runs whichever coroutine is ready.

py-asyncio
concurrency
coroutines
performance
interview-prep

1.1k

27

4.4 (12)

Mar 16, 2026

by @aishasantos

Article

The GIL: What It Actually Blocks

The GIL blocks parallel Python bytecode and nothing else. I/O, well-behaved C extensions, and multiprocessing all sidestep it. Here is how I tell GIL-bound code from code that just feels slow.

py-gil
concurrency
performance
py-multiprocessing
fundamentals

715

19

4.3 (11)

Mar 14, 2026

by @freyadiallo

Article

Promises, await, and the Microtask Queue

What a microtask actually is, why Promise.resolve().then never runs synchronously, how await schedules continuations as microtasks, and the four-column trace I run when ordering surprises me.

promises
async-await
js-microtask-macrotask
js-event-loop
concurrency

225

2

4.3 (9)

Dec 28, 2025

by @adaezeaziz

Article

The JavaScript Event Loop: Tasks, Microtasks, and Rendering

A trace-by-hand walkthrough of the event loop: pick a macrotask, drain microtasks to empty, then optionally render. Worked example interleaves setTimeout, Promise, queueMicrotask, await, and requestAnimationFrame.

js-event-loop
js-microtask-macrotask
promises
concurrency
fundamentals

347

3

4.5 (10)

Dec 23, 2025

by @omarbennett

Question Bundle
$14.99

Distributed Locks and Leases Deep Dive

A 5-question reference set on distributed mutual exclusion: Redis SETNX with fencing tokens, etcd leases, Raft leader election, optimistic vs pessimistic locking tradeoffs, and cross-region home-region pinning.

Java
distributed-systems
consensus
concurrency
interview-prep

701

7

Nov 24, 2025

by CodeSnatch