Lesson 12 of 12

The Background Processes: Who Actually Runs a PostgreSQL Server

Applies to PostgreSQL 13–17 Last reviewed Jun 2026 Grounded in source

The one thing to understand first

A running PostgreSQL server is not one program — it is a small family of cooperating OS processes sharing one block of memory. One supervisor, the postmaster, starts everything, forks a dedicated process for each client connection, and launches a handful of specialist background workers that handle checkpoints, dirty-buffer writeback, WAL flushing, vacuuming, and archiving. Knowing who does what turns an opaque ps listing into a map of exactly where your I/O and CPU are going.

The postmaster: supervisor and parent

Everything starts in src/backend/postmaster/postmaster.c. PostmasterMain creates the shared memory segment, opens the listening socket, and enters ServerLoop. For each incoming connection it fork()s a backend (one OS process per connection). It also forks the auxiliary processes and, crucially, watches them: its reaper() handler catches any child that exits. If a backend dies unsafely (a crash that may have corrupted shared memory), the postmaster takes the whole cluster down to a safe state — it kills every child, resets shared memory, and runs recovery — which is why one segfaulting backend briefly drops all connections.

The specialist workers

Each background process is a focused loop:

This is a Pro lesson

Get every Learning Pathway and cookbook recipe — grounded in PostgreSQL source code, with diagnostics, fixes, and prevention for each topic.

Continue this lesson to learn:

  • One shared memory, many processes
  • Layer 3 — Take attendance with backend_type
  • Layer 4 — The levers this hands you
  • Layer 5 — What an Oracle DBA should expect vs what they get
  • Key takeaway
  • How this article was written
  • All 36 Learning Pathway lessons
  • 170+ cookbook recipes
  • Source-grounded diagnostics & fixes

Secure checkout Cancel anytime Source-grounded

Was this helpful?

← Back to 05 — The Engine Room: How PostgreSQL Actually Executes