Oriel — AI & technology worth noticing, every day.

Processes vs Threads, as the Linux Kernel Sees Them

Post · https://dev.to/lovestaco/processes-vs-threads-as-the-linux-kernel-sees-them-55pk

Hello, I'm Maneshwar, and I'm building LiveReview — a blast-radius aware AI code review built for...

First seen by Oriel on .

AI summary

The article explains Linux processes and threads as scheduler tasks distinguished mainly by whether they use separate or shared address spaces, and outlines the resulting performance and safety trade-offs.

  • Linux schedules tasks rather than processes; clone() creates them, with CLONE_VM allowing a task to share an existing address space.
  • fork() uses copy-on-write, so pages are copied only when modified; threads also share resources such as the heap and globals, while retaining separate stacks and thread-local storage.
  • Four threads incrementing a shared counter one million times each produced 3,966,879 increments without a lock, versus the expected 4,000,000 with a mutex.
  • Threads can lose updates through data races, and a fatal fault in one thread normally terminates the whole process; separate processes provide stronger failure isolation.
  • The article recommends processes when failure containment matters and threads for workloads that share large datasets and can partition data to minimize contention.

#linux #operating systems #concurrency #threads

Generated by gpt-5.6-sol. Check the original for details.

Metric trends

Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained

Reactions

Total public reactions reported by the source; distinct from points and likes.

  • DEV Community: 31, latest observation ; +7 over observed period since

Comments

Comment count reported by the source.

  • DEV Community: 2, latest observation ; +1 over observed period since

Aliases

SourceExternal IDURL
DEV Community4883684https://dev.to/lovestaco/processes-vs-threads-as-the-linux-kernel-sees-them-55pk Read discussion