Controlling Multi-Core Race Conditions on Linux/Android
summary
Shows that Android’s Java framework still Java framework lacks thread affinity while NDK and bionic expose CPU affinity, so legacy code can migrate and misbehave when threads run on different cores. Demonstrates a small counter race that only fails rarely but reproducibly until protected by a mutex, and shows cache-line false sharing on 64B cache line causing huge slowdowns; moving data off the same line cuts a 14s run to ~6s. Recommends futex with priority inheritance and careful data alignment.
AI-written summary · about
chapters (17)
- 0:00Introduction to multicore
- 2:58Multicore motivations
- 4:27Performance challenges
- 7:46Linux scheduling models
- 10:56Thread scheduling mechanics
- 14:45Race conditions and data
- 17:17Detecting race conditions
- 22:11Avoiding race conditions
- 23:58Thread affinity in Android
- 25:33Containment challenges
- 28:55Mutual exclusion techniques
- 30:52Priority inversion solutions
- 34:40Mutexes and spin locks
- 36:51Message queues and binary
- 39:12Development guidelines
- 43:03Mutex code demonstration
- 48:53Cache and performance demo
related talks
15mEnemy of the State, Understanding the Many Flavors of Race Conditions
34mExploiting Race Conditions Using the Scheduler
07mRace Conditions in Details
33mUntangle your App: Efficient Threading in Android
01h 04mDebugging data races
39mLet's talk concurrency
30mExtra! Extra! Thread all about it!
25mTackling Contention : The Monster in sync.Locker
