1/26
A collection of vocabulary flashcards covering the core terminology and concepts of Swift Concurrency as discussed in the reference guide.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Concurrency
A way to structure code so that a single CPU core can juggle multiple programs, switching between them quickly so they appear to be running at the same time.
Parallelism
When two or more programs run at the exact same instant, typically enabled by using multiple CPU cores.
Main Thread
The initial thread created when an app launches, which must be used for all user interface work throughout the lifetime of the application.
Context Switch
The performance cost incurred when a system stashes the data for one thread to give another thread a chance to run on the CPU.
Thread Explosion
A performance crisis occurring when a program creates significantly more threads than available CPU cores, causing high overhead from context switching.
Synchronous Function
A function that executes all its work in a simple, straight line on a single thread and blocks that thread until the work is finished.
Asynchronous Function
A function marked with the async keyword that can perform work and suspend itself, allowing its thread to be used for other tasks while it waits for a result.
Suspension Point
A location in code, explicitly marked by the await keyword, where an asynchronous function can pause execution and give up its thread.
async let
A syntax used to start several asynchronous operations immediately and concurrently, allowing the program to continue until the values are specifically needed.
Sendable
A protocol and attribute used to ensure that data can be safely transferred across actor boundaries or between different tasks without causing data races.
Continuation
A special object used to bridge older code using completion handlers into modern async/await functions.
Checked Continuation
A type of continuation where Swift performs runtime checks to ensure the object is resumed exactly once, crashing if it is called multiple times or leaking a warning if it is never called.
AsyncSequence
An asynchronous version of the standard Sequence protocol where each element is returned asynchronously, typically handled using for await loops.
AsyncStream
A type of buffered asynchronous sequence that allows multiple values to be yielded over time, including different policies for buffering or discarding values.
Task
A basic unit of asynchronous work that runs immediately and concurrently with other code, providing a way to call async functions from synchronous contexts.
Detached Task
A unit of asynchronous work that does not inherit context from its creator, such as its priority, actor isolation, or task-local values.
Task Group
A collection of concurrent tasks that work together to produce a single result, often used when the number of required operations is dynamic.
Discarding Task Group
A specialized group where child tasks are automatically destroyed upon completion to prevent memory leaks in long-running operations.
Cooperative Cancellation
The mechanism by which a task is notified to stop working, requiring the code to voluntarily check Task.isCancelled or call Task.checkCancellation() to terminate safely.
Task-local values
Scoped metadata attached to a task that can be read by any code running within that task's hierarchy.
Actor
A reference type similar to a class that protects its mutable state by ensuring only one piece of code can access its data at any one time.
Actor Isolation
The protection mechanism where an actor's variables and methods can only be accessed asynchrononously from outside the actor to prevent data races.
Nonisolated
A keyword used to mark specific methods or properties that do not participate in an actor's isolation, such as constants or methods that only access safe state.
Actor Reentrancy
A design feature where an actor is allowed to begin a new task while a previous task is suspended at an await point, preventing deadlocks but requiring careful local state management.
Actor Hopping
The process of execution moving from one actor to another, which can incur a performance cost in the form of a context switch.
@MainActor
A global actor that ensures a type or method always executes on the main thread, primarily used for safe user interface updates.
Cooperative Thread Pool
The internal system Swift uses to manage a pool of threads that matches the number of CPU cores to execute tasks efficiently without thread explosion.