Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

Launch price

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year, or $19.50 for your first year with LAUNCH50, ends 1 Nov, 18:30 UTC.

See plansStart free instead

Module 09 · System Design · The low-level design round

Two people, one seat (thread-safe booking)

Two People, One Seat
Two People, One Seat · Open board

The race, the lock, the hold with a deadline, the version check, and three seats or none.

Before you start. Two earlier lessons are borrowed here. The object that keeps its own rules (encapsulation and invariants) taught the invariant, a sentence that must always stay true, here “one seat, at most one ticket”. Design a parking lot (the first whole round) used a class, a blueprint for objects, to build a lot that finds a free spot and marks it taken, and ended on a warning that two drivers arriving together can break it. The new word is thread: one of several lines of work a program runs at the same time. You need to read a little Python. (Who holds the pen (consensus & Raft) comes back at the end.)

Lesson 43 of 73 in System Design

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year, or $19.50 for your first year with LAUNCH50, ends 1 Nov, 18:30 UTC.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 15 November 2022: a presale, and everyone wants the same seats
  • Two clicks, one seat: a race condition
  • The window that admits one person: a critical section and a lock
  • Paying takes minutes: a hold with expiry
  • When there is a database: optimistic locking

Terms it explains: thread, interleave, race condition, critical section, lock, held, hold with expiry, pessimistic, optimistic, optimistic locking, row, version, atomic, deadlock.

Review System Design