user6373874
user6373874

Reputation:

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

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?

Upvotes: 0

Views: 148

Answers (2)

Peter Lawrey
Peter Lawrey

Reputation: 533492

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)

Upvotes: -3

Mahesh
Mahesh

Reputation: 5308

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.

Upvotes: 0

Related Questions