Skip to main content

Kernel

The parallel worker interface used to execute jobs.

It allows registering parallel job handlers that are dispatched from a Dispatcher. Jobs can either be:

  • Tracked: send and synchronize data back to the dispatcher
  • Detached: fire-and-forget dispatch with no synchronization and no data sent back to the dispatcher

Each kernel instance should be bound to exactly one actor.

Functions

new

Parallel
Kernel.new(actorActor) → Kernel

Creates a new Kernel bound to an Actor

On

Parallel
Kernel:On(
namestring,--

Job name

process(
idnumber,
...any
) → any
) → ()

Registers a tracked parallel job

The job will:

  • Execute in parallel across actors
  • Return results to the dispatcher
  • Be synchronized and ordered into the output

This is the standard for computation jobs with no side-effects.

OnDetached

Parallel
Kernel:OnDetached(
namestring,--

Job name

process(
idnumber,
...any
) → any
) → ()

Registers a detached parallel job

Detached jobs:

  • Do not send any data back to the dispatcher
  • Do not synchronize or flush
  • Do not allocate tables
  • Are fire-and-forget

This is the lowest-overhead execution mode and is suitable for pure side-effect jobs such as raycasts, writes, or simulation steps.

Ready

Kernel:Ready() → ()

Marks this kernel as ready

This sets the internal ready attribute used by the dispatcher to determine whether the actor is ready to receive jobs.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Creates a new Kernel bound to an Actor",
            "params": [
                {
                    "name": "actor",
                    "desc": "",
                    "lua_type": "Actor"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Kernel"
                }
            ],
            "function_type": "static",
            "tags": [
                "Parallel"
            ],
            "source": {
                "line": 33,
                "path": "src/kernel.luau"
            }
        },
        {
            "name": "On",
            "desc": "Registers a **tracked parallel job**\n\nThe job will:\n- Execute in parallel across actors\n- Return results to the dispatcher\n- Be synchronized and ordered into the output\n\nThis is the standard for computation jobs with no side-effects.",
            "params": [
                {
                    "name": "name",
                    "desc": "Job name",
                    "lua_type": "string"
                },
                {
                    "name": "process",
                    "desc": "",
                    "lua_type": "(id: number, ...any) -> any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "Parallel"
            ],
            "source": {
                "line": 63,
                "path": "src/kernel.luau"
            }
        },
        {
            "name": "OnDetached",
            "desc": "Registers a **detached parallel job**\n\nDetached jobs:\n- Do not send any data back to the dispatcher\n- Do not synchronize or flush\n- Do not allocate tables\n- Are fire-and-forget\n\nThis is the lowest-overhead execution mode and is suitable for \npure side-effect jobs such as raycasts, writes, or simulation steps.",
            "params": [
                {
                    "name": "name",
                    "desc": "Job name",
                    "lua_type": "string"
                },
                {
                    "name": "process",
                    "desc": "",
                    "lua_type": "(id: number, ...any) -> any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "Parallel"
            ],
            "source": {
                "line": 116,
                "path": "src/kernel.luau"
            }
        },
        {
            "name": "Ready",
            "desc": "Marks this kernel as ready\n\nThis sets the internal ready attribute used by the dispatcher\nto determine whether the actor is ready to receive jobs.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 139,
                "path": "src/kernel.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Kernel",
    "desc": "The parallel worker interface used to execute jobs.\n\nIt allows registering parallel job handlers that are dispatched\nfrom a [Dispatcher]. Jobs can either be:\n\n- **Tracked**: send and synchronize data back to the dispatcher\n- **Detached**: fire-and-forget dispatch with no synchronization and no data sent back to the dispatcher\n\nEach kernel instance should be bound to exactly one actor.",
    "source": {
        "line": 19,
        "path": "src/kernel.luau"
    }
}