Threads inside the same process share most things. What does each thread get its own copy of?

Its own stack; threads share the process's global memory and heap.

Start playing free

  1. Its own heap
  2. Its own stack ✔
  3. Its own process ID

Why: Threads in one process share the same global data and heap, which makes sharing fast but risky. Each thread has its own stack for local variables and function calls. Separate processes, by contrast, do not share memory by default.

Huh, didn't know that: On Linux with POSIX threads, all threads in a process also share one process ID.

The dad joke
Why did the two threads fight? They both wanted the last cookie in the shared heap.
Like this card?
Play the game

References

Answer: Its own stack. Threads in one process share the same global data and heap, which makes sharing fast but risky. Each thread has its own stack for local variables and function calls. Separate processes, by contrast, do not share memory by default.

  1. Linux man-pages: pthreads(7) man7.org/linux/man-pages/man7/pthreads.7.html
    These threads share the same global memory (data and heap segments), but each thread has its own stack (automatic variables).
    Checked 2026-10-10.

Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.

Test yourself in the game