Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Light weight process

 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've heard ( or read ) that Threads are lightweight processes. Can any say what does it mean exactly ?
 
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic