Shared: code, global and heap data, open files and signal handlers. Private: stack, registers, thread ID and thread-local storage.
Benefits: responsiveness (keep a UI or server responsive during blocking work), resource sharing, lower overhead than processes, and use of multiple cores.
Risks: race conditions, deadlocks, harder debugging, and false sharing and cache contention; protect shared data with locks or use message passing.
Loading…