Tasks vs Threads
Low-level process management never changes.
Today, we’re going to look at the power of the old-school Thread APIs, and demonstrate how much it has in common with Tasks, the modern building block of Swift Concurrency.
Back when I was a fresh-faced junior, we had a really smart engineer on my team, Jeff. I asked him to explain iOS concurrency to my graduate cohort, and he explained there were 3 levels of abstraction:
Operation & OperationQueue at the top-level, with advanced functionality.
GCD as your bread-and-butter for basic concurrency workloads.
Thread for low-level precise management of actual threads.
My impostor-syndrome-riddled brain filled in the blanks: I knew any time I heard “low-level” it meant “for geniuses”.
The Thread API was out-of-bounds, for the really smart engineers.
Until today.
It wasn’t until I started writing this piece that I realised, a lot of the APIs available in Thread are copied by the Task in Swift Concurrency. By comparing them, we can understand both at a deeper level.
Subscribe to Jacob’s Tech Tavern for free to read ludicrously in-depth articles on iOS, Swift, tech, & indie projects in your inbox every week.
Paid subscribers get much more:
🌟 Read this, plus all my Elite Hacks, my exclusive advanced content
🚀 Get my free articles a month before anyone else
🧵 Access my full Swift Concurrency course
Keep reading with a 7-day free trial
Subscribe to Jacob’s Tech Tavern to keep reading this post and get 7 days of free access to the full post archives.


