What is the difference between Process and Threads?
Answer Posted / hetal
A process is a running instance of a program to which system allocates resources like CPU time and memory (separate heap, method area etc. which does not overlap with other process running on the system at the same time). In a big application there may be a set of cooperating processes communicating to each other in order to perform the desired functionality. Two processes communicate through well defined inter process communication mechanism, such as pipes, sockets and shared memory, if both processes are running on the same machine.
On the other hand threads exist within a process; every process has at least one thread. A thread is a light weight process that does not require as much resources as a process requires. Threads running inside a process, share the common set of resources among themselves which are allocated to the process (including the memory, the address space). All the threads share the same heap and method area (but individual stacks). All local variables are thread safe in Java because local variables are stored in each thread's own stack and each thread has its own stack created. Because threads share virtual address space, that makes inter thread communication between threads much cheaper than inter process communication between two independent processes
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Is the ternary operator written x : y ? Z or x ? Y : z ?
When is the best time to validate input?
Difference between new operator and class.forname().newinstance()?
What is the difference between a menuitem and a checkboxmenuitem?
What is the difference between static and non-static with examples?
What class is the top of the awt event hierarchy?
Are enterprise beans allowed to use thread.sleep()?
Can I map more than one table in a cmp?
Difference between hashmap and hashtable?
Why won’t the jvm terminate when I close all the application windows?
What is the difference between the string and stringbuffer classes?
What are the different class loaders used by jvm?
What is Remote Server?
Where can I find seam examples and documentation?
What is the purpose of the wait(), notify(), and notifyall() methods?