Difference between a Thread and a Process

  1. The Processes and Threads are independent sequences of execution.
  2. The typical difference is that Threads run in a shared memory space, while Processes run in separate memory spaces.
  3. A Process has a self contained execution environment that means it has a complete, private set of basic run time resources i.e each process has its own memory space. Threads exist within a process and every process has at least one thread.
  4. Each process starts with a single thread, known as the primary thread. A process can have multiple threads in addition to the primary thread.
  5. Changes to the main thread may affect the behavior of the other threads of the process while changes to the parent process does not affect child processes.
  6. Processes are heavily dependent on system resources available while threads require minimal amounts of resource, so a process is considered as heavyweight while a thread is termed as a lightweight process.

    What is multithreading ?

    When we write applications that perform multiple tasks simultaneously. Tasks with the potential of holding up other tasks can execute on separate threads is known as multithreading.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s