Labels

Monday, June 11, 2012

What is the difference between process and threads in java ?

A thread is part of a process; a process may contain several different threads. Two threads of the same process share a good deal of state and are not protected against one another,whereas two different processes share no state and are protected against one another. Two threads of the same process have different values of the program counter; different stacks(local variables); and different registers. The program counter, stack pointer, and registers are therefore saved in the thread table. Two threads share open files and memory allocation; therefore, file information and memory information (e.g. base/limit register or  page table) is stored in the process table.

No comments:

Post a Comment