“Multi Threading” is one of the rich features of .NET applications.
Using this feature, the user is able to create multi-threaded applications.
This concept is introduced in VC++. This is also supported by Java.
Thread: The thread is a part of the task.
Using “multi threading”, you can break a complex task in a single application into multiple threads that execute independently of one another.
Before starting with the understanding of Multi Threading, you should recollect the concept of “Multi-Tasking”.
Multi Tasking:
Def: Ability of the OS, that is able to perform more than one task, at-a-time (simultaneously).
As a part of this, OS allocates the CPU clock for each task.
Multi Threading:
Def: The ability of an application, that is able to perform more than one thread simultaneously is called as “Multi-Threading”.
In other words, it can be called as “sub form of multi-tasking”.
Just like multi-tasking, OS allocates the CPU clock for each thread.
Demo on Multi Threading:
Implementation of Multi Threading:
.NET Framework offers a namespace called “System.Threading” for implementation of multi threading.
Import the API:
using System.Threading;
Create the Thread Object:
Thread th = new Thread();
Start the Thread:
th.Start();