Threads vs Processes

Processes have different shared memory space.

The first expensive part is that whenever we fork, we need to copy over all memory, to make sure they do not overlap.

Threads do not need to copy, they have access to the same shared memory space.

The other Expensive part is when processes need to communicate. This is done via OS support, via syscalls.

Threads do not need this OS support, they have access to the same shared memory space.

So when do we use processes?

When safety is important, we want to separate the memory spaces.