Net-informations.com
SiteMap  | About    

Difference between a thread and a process

Thread and a Process

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 purticularly each process has its own memory space. Threads exist within a process and every process has at least one thread.

Each process provides the resources needed to execute a program. Each process is started with a single thread, known as the primary thread. A process can have multiple threads in addition to the primary thread.

On a multiprocessor system, multiple processes can be executed in parallel. Multiple threads of control can exploit the true parallelism possible on multiprocessor systems.

Threads have direct access to the data segment of its process but a processes have their own copy of the data segment of the parent process.

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 ?

In .NET languages you can 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.

The following links shows how to multithreading in c# and VB.Net


C# Multithreading Program    VB.Net Multithreading Program






net-informations.com (C) 2016    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.