> ## Documentation Index
> Fetch the complete documentation index at: https://sysg.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Start vs Spawn

# Start vs Spawn

`start` is now the primary process-creation command.

:::warning Deprecated
`sysg spawn` is deprecated. Use `sysg start --parent-pid ...` for child-process workflows.
:::

## Quick comparison

|               | `start` (manifest/ad-hoc)                   | `start` (child mode)                                    | `spawn` (deprecated)       |
| ------------- | ------------------------------------------- | ------------------------------------------------------- | -------------------------- |
| **Flags**     | `sysg start [--config ...] [-- command...]` | `sysg start --parent-pid <pid> [--ttl ...] -- <cmd...>` | `sysg spawn ...`           |
| **Lifecycle** | Top-level managed unit(s)                   | Parent-attached child unit                              | Parent-attached child unit |
| **Use case**  | Core services and ad-hoc units              | Dynamic child workers                                   | Legacy compatibility       |

## `start` - Unified command

Manifest services:

```yaml theme={null}
services:
  web:
    command: "python app.py"
    restart_policy: always
  database:
    command: "postgres"
    depends_on: []
```

Run with:

```sh theme={null}
$ sysg start
```

Ad-hoc single command:

```sh theme={null}
$ sysg start --name quick-task -- ./task.sh
```

Child-mode replacement for `spawn`:

```sh theme={null}
$ sysg start --parent-pid 12345 --name worker_1 --ttl 3600 -- python job.py
```

## Legacy `spawn` mapping

Existing invocations:

```sh theme={null}
$ sysg spawn --name worker_1 -- python job.py
```

Equivalent `start` command:

```sh theme={null}
$ sysg start --parent-pid <parent_pid> --name worker_1 -- python job.py
```

## Recommended naming

Use the term **child mode** for the former `spawn` workflow:

* `start` in child mode (`--parent-pid`)
* `start` in ad-hoc mode (command without `--parent-pid`)
* `start` in manifest mode (no command)

## Example: Job queue with child mode

```yaml theme={null}
services:
  queue:
    command: "redis-server"
    restart_policy: always

  scheduler:
    command: "python scheduler.py"
    depends_on: ["queue"]
    spawn:
      mode: dynamic
      limit: 50
```

The scheduler reads from queue and spawns workers:

```python theme={null}
# scheduler.py
import os
import subprocess

while job := queue.pop():
    subprocess.run(["sysg", "start", "--parent-pid", str(os.getpid()),
                    "--name", f"job_{job.id}",
                    "--ttl", "3600", "--", "python", "worker.py", job.id])
```

## See also

* [`start`](/how-it-works/commands/start) - Launch services
* [`spawn`](/how-it-works/commands/spawn) - Deprecated command reference
* [Configuration](/how-it-works/configuration) - Service definitions
