Difference between ligt weight and heavy weight?

Answer Posted / modi[achir communication]

[Short answer: threads are lightweight, programs (aka
processes or tasks) are heavyweight. -Alex]

Lightweight and heavyweight processes refer the mechanics of
a multi-processing system.

In a lightweight process, threads are used to divvy up the
workload. Here you would see one process executing in the OS
(for this application or service.) This process would posess
1 or more threads. Each of the threads in this process
shares the same address space. Because threads share their
address space, communication between the threads is simple
and efficient. Each thread could be compared to a process in
a heavyweight scenario.

In a heavyweight process, new processes are created to
perform the work in parallel. Here (for the same application
or service), you would see multiple processes running. Each
heavyweight process contains its own address space.
Communication between these processes would involve
additional communications mechanisms such as sockets or pipes.

The benefits of a lightweight process come from the
conservation of resources. Since threads use the same code
section, data section and OS resources, less overall
resources are used. The drawback is now you have to ensure
your system is thread-safe. You have to make sure the
threads don't step on each other. Fortunately, Java provides
the necessary tools to allow you to do this.

Is This Answer Correct ?    14 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is swing container?

518


What are the benefits if Swing over AWT?

589


How do you swing an applet?

612


What is awt and swing in java?

495


What is swing used for?

486






What is the relationship between clipping and repainting?

666


What is the what is the difference between invokeandwait() and invokelater()? ?

625


What is jpanel in java swing with example?

502


What is an on stage swing?

543


What is the difference between swing and awt?

535


What is java swing package?

507


Why are swings considered lightweight?

542


What is the use of jfc in java swing?

652


Can a class be it?s own event handler? Explain how to implement this?

538


Why should the implementation of any swing callback (like a listener) execute quickly?

561