This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Light weight process

 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've heard ( or read ) that Threads are lightweight processes. Can any say what does it mean exactly ?
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A program is a heavyweight process...because a program can remain in xcution for a long duration depending upon the size & complexity of the program.

But a thread is a lightweight process becaues it represents a fragment
of a bigger program and can wrap its xcuition quickly or like a daemon thread start off a new thread and wait..that threads job is done.

Also in OS world, the context-switching is another factor that has to be taken into consideration.Context switching between one program and another
would req few xcution cycles..The lengthier program and if there are more prgms in xcution then more prgms vie for xcution cycles(processor).
but threads in contrast would not need to go thru many context switches unlike the programs.

There are other factors too like-address space,etc.

i hope this does make sense to u.

A program / thread in an OS world is a process

progm- heavyweight (time/resources needed are more)
thread-lightweight (less here since it may be xcuting a part of code even though its part of the same prgm)


[ April 08, 2005: Message edited by: A Kumar ]
 
M Beck
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i originally heard it explained, years ago, as simply this: processes are "heavy weight" because starting up a new one takes a long time (on the order of milliseconds or so) - there's a lot of overhead involved. threads have less overhead, so they can be started more quickly (perhaps a fraction of a millisecond).

that might have been an incorrect explanation, however. after all, i saw it in a context of "how can we make starting a process faster in our operating system".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic