Why saying that a thread is a "light-weight process" is not technically correct?

144 Views Asked by At

During my distributed programming course in Java, my teacher asked this question. He argued that even if it is a commonly used definition it is not totally true.
What are the things that can make a thread to be considered as a heavy-weight process?

2

There are 2 best solutions below

4
On

heavily/light weight is about how much resources they take and how expensive it is to switch tasks. On Linux a Thread is also treated like a Process with it's own Process Id, however it doesn't use as much resources as you add each one as it shared memory with an existing thread.

A more light weight version of a thread is to use continuations. This can be cheapest with short call stacks as it is an entirely user space implementation.

Threads are more light weight than processes. But...

  • there are even more light weight was of sharing work, in some contexts threads are expensive.
  • it's not really a process (Linux pretends a thread is a process in some ways)
1
On

There is a definite difference between threads and processes - two or more threads share memory space allocated to the process, while the memory space allocated to 2 processes are separate.

What are the things that can make a thread to be considered as a heavy-weight process?

Again, the threads are not the same as processes, so this question still technically is still incorrect.