Sweaty Imposter

Separate Process Versus Separate Thread in the Same Process

TradeoffNetworking & OSMidSeniorUpdated

Running untrusted plugin code or risky native libraries. Process or thread?

Short answer: Separate process. Processes have separate address spaces; a segfault, memory corruption, or OOM kills only that process.

The Two Options

A

Separate process

B

Separate thread in the same process

Drill This: Your Pick First

The Better Pick

Option A

Separate process

Processes have separate address spaces; a segfault, memory corruption, or OOM kills only that process. Threads share memory, so one bad pointer takes down the whole server. Chrome and modern browsers run each tab in its own process for this reason.

When the Other One Wins

Separate thread in the same process

If you need cheap shared memory and frequent communication (e.g., a worker pool over a hot in-memory cache), threads avoid IPC overhead and fork cost. Trust boundary matters more than performance.