Multithreading has always been a helpful friend of a programmer . Multithreading increases the response time of an application . Multithreading can be implemented by using namespace system.threading .
Why Multithreading is required ?
> For this I will give U a simple example : Assume U have a company and U have only one assistance and 0 workers then what will happen the complete workload of company will be on your assistance , the assistance then take much time to do everything one by one , Which will affect U in turn .. your application also runs in the same manner if U have only single thread Your execution and your processing will be very slow which may also hangs your application . So Multithreading distributes specified process to run in another thread an wont affect the normal processing of your application ..
Lets have a little demo for this .
Demo - 1
In this Demo u have 2 static methods Thread1 and Thread2 . To make a thread we are making a object class named Thread.
The constructor of this class takes a reference of a ThreadStart class. This constructor
can send two types of exceptions; ArgumentNullException when the parameter is
a null reference or a Security Exception when program does not have permission to
The parameter of the Thread class is reference to a ThreadStart class.
ThreadStart class points to the method that should be executed first when a
thread is started. The parameter is the name of the function, which is considered as
a thread function. Thread1 is a static function so we give it with the name of class
name without making an object of the class. The thread starts execution with
Start() method of the Thread class. The output of this program is
Before start thread
This is how we using multithreading in our application ...