- Sync vs Async
- Serial vs Concurrent
- DispatchGroup
- DispatchQueue
- Thread-Safe Data Structure
- OperationQueue
- Semaphore
- Deadlock
- 📺 | WWDC Modernizing Grand Central Dispatch Usage 🚨Must Watch🚨
- 🔗 | Concurrency Programming Guide
- 🔗 Khanlou | The GCD Handbook
- 🔗 Objc.io | Concurrent Programming: APIs and Challenges
- 🔗 libdispatch efficiency tips
- 🔗 Swift Lee | Asynchronous operations
- 🔗 Donny Wals | DispatchGroup
- Avoid using concurrent queues at all cost.
- Instead use a serial queue per sub system and use a target queue if you need subsystems to interact.
- Reader/writer locks tend to be a source of great complexity and hard to get right, specially in Swift which is bad at atomic access. If needed it’s better to use
os_unfair_lock
- Combine helps handling concurrency with its stream of events API.
- Don’t use GlobalQueues.
- Quote from Swift Evolution: Fixing race conditions in async/await example:
dispatch_get_global_queue() is in practice on of the worst thing that the dispatch API provides
- Quote from Swift Evolution: Fixing race conditions in async/await example:
- Shouldn’t need to specify QoS unless for example you start a process in the main queue and want it to go in the background specifically. Otherwise let the system determine the QoS for you.