java4all@1986 java. Powered by Blogger.

What is difference between process and threads?

>> Monday, May 30, 2011

A process is an execution of a program but a thread is a single execution sequence within the process. A process
can contain multiple threads. A thread is sometimes called a lightweight process
A JVM runs in a single process and threads in a JVM share the heap belonging to that process. That is why
several threads may access the same object. Threads share the heap and have their own stack space. This is
how one thread’s invocation of a method and its local variables are kept thread safe from other threads. But the
heap is not thread-safe and must be synchronized for thread safety.

0 comments:

Post a Comment

FaceBook Login

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

Total Pageviews

STATCOUNTER

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP