Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lightweight Vs Heavyweight Processes

Is the following assertion true about the above question?

Lightweight processes contain a single process but multiple threads

Heavyweight processes can contain multiple subprocesses

I know there's much more to it than that, but I was wondering if this would pass as a very very basic understanding of heavyweight and lightweight processes...

like image 613
user559142 Avatar asked May 14 '11 18:05

user559142


People also ask

What is lightweight and heavyweight process?

Lightweight processes contain a single process but multiple threads. Heavyweight processes can contain multiple subprocesses. It doesn't block the user because threads are independent and you can perform multiple operations at same time.

What is meant by lightweight process?

Lightweight processes (LWPs) bridge the user level and the kernel level. Each process contains one or more LWP, each of which runs one or more user threads. (See Figure 1-1.) The creation of a thread usually involves just the creation of some user context, but not the creation of an LWP.

Why process is heavyweight and thread is lightweight?

Threads are sometimes called lightweight processes because they have their own stack but can access shared data. Because threads share the same address space as the process and other threads within the process, the operational cost of communication between the threads is low, which is an advantage.

What is a heavyweight process explain with example?

One example of a heavyweight thread is the average UNIX process, where processors may need to access more resources, and switch time may be greater, than with some other kinds of threads in different operating system environments.


1 Answers

A normal process under an Operating System (OS) is a heavy-weight process. For each such process, the OS provides an independent address space, this way keeping different users and services separated. Switching from one such process to another is time consuming, though modern machines contain a special unit, the Memory Management Unit (MMU), dedicated to the task. A Light-Weight Process (LWP), also called thread, runs under the address space of a normal (heavy-weight) process, and LWPs under the same process may share e.g. variables. Switching from one LWP to another is much faster than switching from one heavy-weight process to another, because there is less to manage, and the MMU is not involved.

like image 106
Norbert Avatar answered Oct 04 '22 16:10

Norbert