Swift Concurrency: Actors, Executors, and Their Interaction with Threads

https://hackernoon.imgix.net/images/2jqChkrv03exBUgkLrDzIbfM99q2-g4821ai.jpeg

While Swift Concurrency does a remarkable job of abstracting thread management, iOS developers eventually reach a point where they need to understand what’s happening under the hood. We’ve touched on thread behavior in previous articles, but it’s time to consolidate that knowledge — you are absolutely going to need it for the advanced concepts ahead.

At the end of the day, code execution still happens on threads. Swift Concurrency doesn’t reinvent this fundamental reality (even if Apple loves to introduce its own proprietary naming conventions). We already know that within a single Task, the underlying thread can switch between suspension points (await). But how exactly does the system choose which thread to use?

To answer this, we first need to break down the components that make up the Swift Concurrency execution chain.

The Anatomy of Swift Concurrency

Some of these components will be familiar, some you may have heard of...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE