MY mENU


Thursday 29 March 2012

Process And Thread

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.


Definition of Thread:

  • A Thread is an independent sequential flow of execution/path.
  • A Thread is a stack created in java stacks area.
  • It executes methods in sequence one after one

When MultiThreading programming is suitable- means need of Multithreading?

- To complete independent multiple tasks execution in short time we should develop multithreading. In multithreading based programming CPU ideal time is utilized effectively.

No comments:

Post a Comment