• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread and Process

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone tell me the detail differences between thread and process?
Thanks
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A decent book:
Concurrency, State Models & Java Programs
by Jeff Magee & Jeff Kramer
'Process' can be used to refer to an operating system process, which is a unit of resource allocation both for CPU time and memory in a system. An os process is characterized by:
-a data segment
-a code segment
-multiple stacks, one for each thread
The code for each thread is in the code segment and all threads in a process can access the data segment. A thread can be represented as a path of execution through code.
Basically, a process may contain several threads. I also think some use the terms 'thread' and 'process' interchangeably.
...Mike B.
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to add my humble comment...in the java world, a process is controlled by the native OS, outside of the java VM. You might have several VMs running on a machine, each in its own process, but the VM itself can't control how much processor time that process receives.
A thread is scheduled and time-sliced by the Java VM. It may delegate certain scheduling tasks to the native OS, depending on the actual VM implementation and native OS, but the threads are much more under the control of the VM than an OS process.
Rob
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Process is nothing but different program running on computer concurrently e.g. Microsoft word and Microsoft Paint are running on same computer at the same time.
But the thread is nothing but part of the program which run concurrently on the computer e.g formatting and printing word document. The are two tasks would correspond to executing parts of the program concurrently. Each such part define separate path of execution which is called thread.
Ash
Sun certified Java Programmer
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Programs that are running concurrently can be termed as Process.
The sequence of execution in a process can be termed as Thread.
Ashu
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic