Save this video — free

UNC COMP 301 - F26/Lec 14 - Race conditions, Synchronized methods; Observer Design Pattern

Muhammad Sayeed Ghani · 1:14:56 · Watch on YouTube

UNC COMP 301 - F26/Lec 14 - Race conditions, Synchronized methods; Observer Design Pattern Watch on YouTube →

Overview

The lecture concludes Java concurrency with thread scheduling, race conditions, synchronization, locks, and deadlocks, then introduces the Observer design pattern through a basketball-game example. The code examples show how shared counters can produce inconsistent results, how synchronized access protects them, and how a game subject registers and notifies fan observers when scores change.

Key takeaways

Chapters

0:00 Runnable Tasks, Lambdas, Threads, and join()
4:40 Why Thread.join() Can Throw InterruptedException
8:46 Operating-System Scheduling, Cores, and Context Switching
13:58 Race Conditions Require Shared State and Concurrent Access
16:10 Counter Example: Lost Updates from Increment and Decrement
26:56 Synchronized Methods Protect the Shared Counter
29:18 Locks, try-finally, and Reentrant Access
37:00 Deadlock from Opposing Lock Acquisition
44:00 Observer Pattern: Subjects, Observers, and Events
53:36 Observer Registration, Notification, and Pattern Terminology
57:36 Subject Implementation: Store and Update Observers
1:00:00 Game and Fan Interfaces Define the Observer Contract
1:03:00 Basketball Game State and Team-Specific Fan Observers
1:08:00 Observer Demo Output and UML Relationships

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, Muhammad Sayeed Ghani.

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.