wood burning stoves 2.0*
The moose likes Threads and Synchronization and the fly likes Thread and Process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread and Process" Watch "Thread and Process" New topic
Author

Thread and Process

Tom Chen
Ranch Hand

Joined: Dec 13, 2000
Posts: 46
Can anyone tell me the detail differences between thread and process?
Thanks


Sun Certified Java Programmer
Mike Broadbear
Ranch Hand

Joined: Jan 14, 2002
Posts: 39
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.
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
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


Rob
SCJP 1.4
Ash sav
Ranch Hand

Joined: Apr 14, 2001
Posts: 55
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
Ashutosh Roy
Greenhorn

Joined: Jan 17, 2002
Posts: 8
Hi!
Programs that are running concurrently can be termed as Process.
The sequence of execution in a process can be termed as Thread.
Ashu


Ashu
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Thread and Process
 
Similar Threads
What is the difference between process & thread??
Is it OK?
thread
process & thread
Why threads are light weight