Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread and Process  RSS feed

 
Natraj Gudla
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I read in my college days that a Thread is a lighter process , is'nt that true?
I had a discussion earlier with a collegue who says , you cannot even call a thread as a lighter process . and i believe that a thread has to start from a process.
I know some things likes the context switch for process is expensive than threads , and threads share a common istruction set with the process that spawned it etc...
can i get clearly the difference in a thread and a process conceptually.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the OS but generally starting a new process (say launching an executable from the command line or runtime.exec) is many times more expensive (time & memory) than starting a new thread within a process.
For example, web servers like IIS and J2EE run each request on a thread from a thread pool which is much more efficient than CGI which starts a new process for each request.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Threads and Synchronization forum...
 
Gayathri Prasad
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nataraj,
Thread are certainly light weight when compared to the Processes. This is fundamentally a concept of Operating System and I would suggest you got through the link http://www.cag.lcs.mit.edu/~rinard/osnotes/h2.html
for a better understanding of threads and processes.
ATB,
Gaya3
--------------------------------------------------
Beginning is half done.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!