# `Snakepit.Pool.ProcessRegistry`
[🔗](https://github.com/nshkrdotcom/snakepit/blob/v0.13.0/lib/snakepit/pool/process_registry.ex#L1)

Registry for tracking external worker processes with OS-level PID management.

This module maintains a mapping between:
- Worker IDs
- Elixir worker PIDs
- External process PIDs
- Process fingerprints

Enables robust orphaned process detection and cleanup.

# `activate_worker`

Activates a reserved worker with its actual process information.

This is a synchronous call that blocks until the worker is registered.
This ensures the happens-before relationship: worker registration completes
before the worker is considered ready for work.

# `activate_worker`

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `cleanup_dead_workers`

Cleans up dead worker entries from the registry.

# `current_run_entries`

Gets all registered worker entries for the current BEAM run.

# `debug_show_all_entries`

Debug function to show all DETS entries with their BEAM run IDs.

# `dets_table_size`

Returns the number of entries currently stored in the DETS table.

# `get_active_process_pids`

Gets all active external process PIDs from registered workers.

# `get_all_process_pids`

Gets all registered external process PIDs, regardless of worker status.

This is useful during shutdown when workers may have been terminated
but external processes still need cleanup.

# `get_beam_run_id`

Get the current BEAM run ID.

# `get_stats`

Gets registry statistics.

# `get_worker_info`

Gets information for a specific worker.

# `get_workers_by_fingerprint`

Gets workers with specific fingerprints.

# `list_all_workers`

Gets all registered worker information.

# `manual_orphan_cleanup`

Manually trigger orphan cleanup. Useful for testing and debugging.

# `reserve_worker`

Reserves a worker slot before spawning the process.
This ensures we can track the process even if we crash during spawn.

# `start_link`

# `unregister_worker`

Unregisters a worker from tracking.
Returns :ok regardless of whether the worker was registered.

# `update_process_group`

Updates process-group metadata for a worker after startup.

This is used to resolve startup races where the external OS process may not
be the process-group leader at the moment it is spawned, but becomes one
shortly thereafter (e.g. via `setsid()` in Python or delayed OS bookkeeping).

The update is only applied if the currently stored `process_pid` matches the
provided `process_pid`, to avoid corrupting a restarted worker entry.

# `validate_workers`

Validates that all registered workers are still alive.
Returns a list of dead workers that should be cleaned up.

# `worker_registered?`

Checks if a worker is currently registered.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
