---
slug: "Queue"
name: "Queue"
type: "Data Structures"
layer: "Infrastructure"
ref: "Queue#5689"
sema_id: "sema:Queue#mh:SHA-256:5689d2db87dd8752019da54910f7be96929ff84baf09cdadd2c6826b01ea5420"
tags: ["Infrastructure","Data Structures"]
updated: 2026-11-11
mindscape: "bootstrap"
index_url: https://mindscape.pages.dev/bootstrap/index.json
url: https://mindscape.pages.dev/bootstrap/Queue/
related: ["Message","Stream","Task","BeamSearch"]
---

# Queue

Ordered container with FIFO/LIFO/priority discipline and explicit dequeue semantics

Layer: Infrastructure · Category: Data Structures

## Mechanism

A linear container holding [Task](https://mindscape.pages.dev/bootstrap/Task.md)s or [Message](https://mindscape.pages.dev/bootstrap/Message.md)s under an explicit ordering discipline (FIFO, LIFO, or Priority). Consumers dequeue one element at a time; producers enqueue at the discipline-dictated position. Distinct from a [Stream](https://mindscape.pages.dev/bootstrap/Stream.md) (continuous, unbounded, with no single consumer) and from a plain list (no consumer semantics).

## Invariants

—

## Failure modes

—

## Data schema

```json
{
  "type": "object",
  "required": [
    "queue_id",
    "items",
    "policy"
  ],
  "properties": {
    "queue_id": {
      "type": "string"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Enqueued Task or Message objects"
      }
    },
    "policy": {
      "type": "string",
      "enum": [
        "FIFO",
        "LIFO",
        "Priority"
      ],
      "default": "FIFO"
    },
    "capacity": {
      "type": "integer"
    },
    "metrics": {
      "type": "object",
      "properties": {
        "depth": {
          "type": "integer"
        },
        "average_wait_time": {
          "type": "number"
        }
      }
    }
  }
}
```

## Builds on

- [Message](https://mindscape.pages.dev/bootstrap/Message.md) (Infrastructure; References)
- [Stream](https://mindscape.pages.dev/bootstrap/Stream.md) (Infrastructure; References)
- [Task](https://mindscape.pages.dev/bootstrap/Task.md) (Infrastructure; References)

## Used by

- [BeamSearch](https://mindscape.pages.dev/bootstrap/BeamSearch.md) (Mind; References)

## Identity

- Sema ID: `sema:Queue#mh:SHA-256:5689d2db87dd8752019da54910f7be96929ff84baf09cdadd2c6826b01ea5420`
- Ref: `Queue#5689`
- Supersedes:
  - `sema:Queue#mh:SHA-256:2ec3531a8c5711e281ab2913646d9f46dad05140fea7ceb6966bfa62d745bc9b`
  - `sema:Queue#mh:SHA-256:52224702509927c0b69df5580e0554e4ca381f93d291a08d7b2e8d4eaf04cdb2`

## Links

- [Pattern page](https://mindscape.pages.dev/bootstrap/Queue/)
- [View in the interactive graph](https://mindscape.pages.dev/bootstrap/#Queue)
- [JSON](https://mindscape.pages.dev/bootstrap/Queue.json)
- [Index of all patterns](https://mindscape.pages.dev/bootstrap/index.json)
