- The Processes and Threads are independent sequences of execution.
- The typical difference is that Threads run in a shared memory space, while Processes run in separate memory spaces.
- 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.
- Each process starts with a single thread, known as the primary thread. A process can have multiple threads in addition to the primary thread.
- 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.
- 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.