File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread and Process" Watch "Thread and Process" New topic

Thread and Process

Tom Chen
Ranch Hand

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

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

Joined: Jan 07, 2002
Posts: 2205
I'd like to add my humble 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.

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.
Sun certified Java Programmer
Ashutosh Roy

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

I agree. Here's the link:
subject: Thread and Process
It's not a secret anymore!