# “Thread” vs. “Queue” vs. “Actor’s executor”

**URL:** <https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601>\
**Category:** Using Swift\
**Tags:** concurrency, thread, executor, strict-concurrency\
**Created:** [June 23, 2025, 2:04am UTC](https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601 "2025-06-23T02:04:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nashysolutions](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nashysolutions/32/15433_2.png) [@nashysolutions](https://forums.swift.org/u/nashysolutions)\
**Post date:** [June 23, 2025, 2:04am UTC](https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601/1 "2025-06-23T02:04:10Z")

</div>

I had this conversation with ChatGPT and I don't trust the bot as a source of truth on this.

My question: ...the word 'queue' in swift-concurrency ... is not the same as the word 'queue' used in the context of GCD ?

ChatGPT's Answer  
When discussing actor isolation, three concepts come into play:

1. **Thread** —An operating system thread is a low-level thing that can run code.The Swift concurrency runtime can hop between threads freely.
2. **Actor’s queue/executor** —Every actor has its own _serial executor_, which is basically a **queue of tasks** waiting to run in that actor’s isolation.

- The actor’s executor _serialises_ all the tasks that touch the actor’s state.
- This is sometimes informally called the actor’s “queue” or “mailbox.”

1. **Scheduler** —The scheduler is the thing that maps pending tasks (actor-isolated or not) onto available threads.It doesn’t care what actor a task belongs to — it just looks for work to do and finds a thread to run it.

## **🔄 How they fit together:**

- When you call an actor method, the call is posted onto that actor’s **executor queue**.
- The scheduler later picks up that actor’s executor work and assigns it to an available **OS thread**.
- On that thread, the actor’s executor processes one task at a time.

My question: So the word 'queue' in this context is just an informal way of saying 'executor' ? And is not the same as the word 'queue' used in the context of GCD ?

ChatGPT's Answer  
Exactly — you’ve got it. ✅ Let me make this crystal clear.

* * *

## **🎯**

## **queue**

## **in actor context**

When we say the actor has a **“queue”** , we mean its **executor** :

- A logical **serial list of tasks** that need to run one-by-one to maintain actor isolation.
- This is _not_ necessarily a DispatchQueue or a GCD queue — it’s an implementation detail of the actor’s executor.
- Apple’s concurrency runtime decides how to implement this under the hood.

* * *

## **🎯**

## **queue**

## **in GCD context**

When we talk about a **GCD queue** (DispatchQueue.main, DispatchQueue.global, etc.), we mean:

- A **real Dispatch Queue** provided by **Grand Central Dispatch**.
- You can submit blocks to these queues with DispatchQueue.async { ... }.
- They manage their own pools of threads.

---

<div class="post-metadata">

**Author:** ![ktoso](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ktoso/32/44526_2.png) [@ktoso](https://forums.swift.org/u/ktoso)\
**Post date:** [June 23, 2025, 2:07am UTC](https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601/2 "2025-06-23T02:07:46Z")

</div>

It wasn't all that nice to have to try to parse what was what (your input / your qwuestion / the ai response)...

But yeah: "queue" just means _queue_. Actors have a list of jobs basically.

A dispatch queue can be a swift concurrency `SerialExecutor`.

An actor has an executor; the executor may be a dispatch queue or not. Logically, executors have "a queue" of the pending jobs.

Watch this talk for details [Swift concurrency: Behind the scenes - WWDC21 - Videos - Apple Developer](https://developer.apple.com/videos/play/wwdc2021/10254/)

---

<div class="post-metadata">

**Author:** ![robert.ryan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/robert.ryan/32/38339_2.png) [@robert.ryan](https://forums.swift.org/u/robert.ryan)\
**Post date:** [June 23, 2025, 4:18am UTC](https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601/3 "2025-06-23T04:18:45Z")

</div>

From [SE-0306](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0306-actors.md#actor-isolation):

> [@Implementation note](#):
>
> At an implementation level, the messages are partial tasks (described by the [Structured Concurrency](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0304-structured-concurrency.md) proposal) for the asynchronous call, and each actor instance contains its own serial executor (also in the [Structured Concurrency](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0304-structured-concurrency.md) proposal). The default serial executor is responsible for running the partial tasks one-at-a-time. This is conceptually similar to a serial [`DispatchQueue`](https://developer.apple.com/documentation/dispatch/dispatchqueue), but with an important difference: tasks awaiting an actor are **not** guaranteed to be run in the same order they originally awaited that actor. Swift's runtime system aims to avoid priority inversions whenever possible, using techniques like priority escalation. Thus, the runtime system considers a task's priority when selecting the next task to run on the actor from its queue. This is in contrast with a serial `DispatchQueue`, which are strictly first-in-first-out. In addition, Swift's actor runtime uses a lighter-weight queue implementation than Dispatch to take full advantage of Swift's `async` functions.

So, it is conceptually a “queue” but not always a strict FIFO one. The default serial executor considers not only order, but priorities, too.

---

<div class="post-metadata">

**Author:** ![David\_Smith](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/david_smith/32/37508_2.png) [@David\_Smith](https://forums.swift.org/u/David_Smith)\
**Post date:** [June 23, 2025, 5:53pm UTC](https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601/4 "2025-06-23T17:53:31Z")

</div>

> [@nashysolutions](#):
>
> My question: ...the word 'queue' in swift-concurrency ... is not the same as the word 'queue' used in the context of GCD ?

I don't think I've ever seen anyone use the word `queue` to refer to a Swift Concurrency specific thing. Are you sure your premise here isn't just either a) someone getting confused, or b) someone referring to libdispatch and you mistakenly thinking they're referring to SC?

---

<div class="post-metadata">

**Author:** ![robert.ryan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/robert.ryan/32/38339_2.png) [@robert.ryan](https://forums.swift.org/u/robert.ryan)\
**Post date:** [June 23, 2025, 6:29pm UTC](https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601/5 "2025-06-23T18:29:27Z")

</div>

> [@David\_Smith](#):
>
> I don't think I've ever seen anyone use the word `queue` to refer to a Swift Concurrency specific thing. Are you sure your premise here isn't just either a) someone getting confused, or b) someone referring to libdispatch and you mistakenly thinking they're referring to SC?

Actually, SE-0306 uses the term:

> [@](#):
>
> Swift's actor runtime uses a lighter-weight queue implementation than Dispatch…

But later it clarifies:

> [@Changes in the third pitch](#):
>
> - Replaced "queue" terminology with the more traditional "mailbox" terminology, to try to help alleviate confusion with Dispatch queues.

So, you’re right that we wouldn’t tend to use the term “queue” in the context of Swift concurrency, explicitly to avoid this sort of confusion. (I confess that I don’t see many people adopting this “mailbox” terminology, either.) In this case, I suspect that ChatGPT went down the “queue” road as the OP included this term in the prompt.

---

<div class="post-metadata">

**Author:** ![rayx](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/rayx/32/12204_2.png) [@rayx](https://forums.swift.org/u/rayx)\
**Post date:** [June 24, 2025, 2:21am UTC](https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601/6 "2025-06-24T02:21:09Z")

</div>

Evolution proposals use the term "enqueue" a lot. That implies use of queue.

```plaintext
 $ grep -r -i enqueue * | cut -d: -f1 | sort | uniq
0304-structured-concurrency.md
0314-async-stream.md
0323-async-main-semantics.md
0329-clock-instant-duration.md
0371-isolated-synchronous-deinit.md
0392-custom-actor-executors.md
0406-async-stream-backpressure.md
0417-task-executor-preference.md
0420-inheritance-of-actor-isolation.md
0424-custom-isolation-checking-for-serialexecutor.md
0431-isolated-any-functions.md
0449-nonisolated-for-global-actor-cutoff.md
0469-task-names.md
0472-task-start-synchronously-on-caller-context.md
0475-observed.md

```

While I searched for this, I find the following text in SE-0306, which almost answers OP's question.

> **Implementation note** : At an implementation level, the messages are partial tasks (described by the [Structured Concurrency][sc] proposal) for the asynchronous call, and each actor instance contains its own serial executor (also in the [Structured Concurrency][sc] proposal). The default serial executor is responsible for running the partial tasks one-at-a-time. This is conceptually similar to a serial [`DispatchQueue`](https://developer.apple.com/documentation/dispatch/dispatchqueue), but with an important difference: tasks awaiting an actor are **not** guaranteed to be run in the same order they originally awaited that actor. Swift's runtime system aims to avoid priority inversions whenever possible, using techniques like priority escalation. Thus, the runtime system considers a task's priority when selecting the next task to run on the actor from its queue. This is in contrast with a serial DispatchQueue, which are strictly first-in-first-out. In addition, Swift's actor runtime uses a lighter-weight queue implementation than Dispatch to take full advantage of Swift's `async` functions.

---

<div class="post-metadata">

**Author:** ![ktoso](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ktoso/32/44526_2.png) [@ktoso](https://forums.swift.org/u/ktoso)\
**Post date:** [June 24, 2025, 2:22am UTC](https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601/7 "2025-06-24T02:22:28Z")

</div>

The "enqueue" means specifically: `Executor/`[enqueue(\_:) | Apple Developer Documentation](https://developer.apple.com/documentation/swift/executor/enqueue(_:)-55qpq) and the fact of enqueueing a job to an executor.

---

<div class="post-metadata">

**Author:** ![jaleel](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jaleel/32/45076_2.png) [@jaleel](https://forums.swift.org/u/jaleel)\
**Post date:** [June 24, 2025, 7:11am UTC](https://forums.swift.org/t/thread-vs-queue-vs-actor-s-executor/80601/8 "2025-06-24T07:11:16Z")

</div>

Think queue is a common term overall, not necessarily related to computer science, so it's natural to see it from time to time, e.g. `message queue` seen quite often in different actor docs.
