Save this video free

ECE344 Fall 2026 (Sec 1) Lec 17 - Building Locks

Jon Eyolfson · 1:05:39 · Watch on YouTube

ECE344 Fall 2026 (Sec 1) Lec 17 - Building Locks Watch on YouTube →

Overview

The lecture builds from an unsafe check-then-set lock to atomic compare-and-swap spin locks, then shows why efficient sleeping mutexes need coordinated queueing to prevent lost wakeups and unfair lock acquisition. It explains how Linux futexes provide a fast user-space path with kernel-assisted waiting, and how read-write locks allow concurrent readers while introducing writer-starvation risks.

Key takeaways

Chapters

0:00 From a Broken Check-Then-Set Lock to Atomic Operations
11:00 Compare-and-Swap Makes Lock Acquisition Atomic
16:50 Hardware Instructions and the Basic Spin Lock
21:10 When Spinning Helps, and xv6's Spin-Lock Tradeoff
24:10 A Queue-and-Sleep Design for Contended Locks
28:10 Naive Queueing Causes Lock Stealing and Lost Wakeups
36:30 Use an Internal Spin-Lock Guard to Protect the Protocol
40:00 Transfer Mutex Ownership Directly to a Queued Thread
44:10 Handle the Race Between Releasing the Guard and Sleeping
52:00 Linux Futexes Combine User-Space Fast Paths with Kernel Waiting
56:00 Futex Mutex States and the Cost of Contention
58:18 Read-Write Locks Allow Concurrent Readers
1:01:00 Build a Read-Write Lock and Identify Writer Starvation

Keep these chapters and the full searchable transcript in your own library.

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Jon Eyolfson.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.