A couple of purposes of .NET is to help accelerate programming and to improve processing speed. One way that is done is with multithreading. To understand that, simply create a program that for has more than 1 star threading data to be handled. We see that with current technology hardware is developing and becoming powerful, computers and the mobile devices are equipped with multi-core processors capable of doing more thatn one thing at once, therefore many jobs are done in parallel. development Programs are run multithreaded. Also very large-sector telecommunications networks help to increase speed and improve transmission line signals.
In .NET the Thread class is defined in the namespace System.Threading. A program using multithreading has more than 1 thread that handles simultaneous and synchronized work using .NET.
1. For example illustrate about MultiThread
In the first example below we initialize 3 the Threads t1, t2 and t3. Corresponding to those 3 Threads will have 3 static functions, a (), b () and c (). Ta see when to initialize a Thread we pass an argument such as a function pointer. And it is evident that when a Thread starts then it will perform the assigned work. The results of the functions a (), b () and c () are printed out; the characters are defined inside it. If that is performed often then we call the 3 functions in the same order as in the following wallet example, then the results obtained will be: Print out 100 characters "+", 100 characters "-" and finally is 100 characters "o". But here we for 3 functions are the same parallel implementation, should the characters be printed out interspersed among each other.
using System;
using System.Threading;
using System.Diagnostics;
namespace ConsoleApplication2
{
class Program
{
static void Main()
{
Thread t1 = new Thread(new ThreadStart(a));
Thread t2 = new Thread(new ThreadStart(b));
Thread t3 = new Thread(new ThreadStart(c));
t1.Start();
t2.Start();
t3.Start();
Console.Read();
}
static void a()
{
for (int i = 0; i < 100; i++)
{
Console.Write("+ ");
}
}
static void b()
{
for (int i = 0; i < 100; i++)
{
Console.Write("- ");
}
}
static void c()
{
for (int i = 0; i < 100; i++)
{
Console.Write("o ");
}
}
}
}
2. Some commonly used methods for handling Threads
- Abort (): With this method after calling, the thread will turn to the steady state, and returns the attribute value ThreadState Stopped.
- Suspend (): Thread is running if the method calls Suspend () then it will stop operating until called back by the Resume method ().
- Sleep (): When a thread is running if Sleep is called then it will fall into the standby status for the period of time t (in milliseconds) then will continue to operate. For example: "System.Threading.Thread.Sleep (1000);". When this method is called, the thread will pause for 1000 milliseconds. I see this is a static method that can be called without any thread through an instance.
- Join (): This is a method I found very commonly used when handling threads. We can understand the meaning of this method as follows: When a thread calls the Join the thread that will be given a priority in the system. The intent of the Join method is that it is to be executed only when the thread ends. The command has run since before it was implemented with the current thread, and does not affect anything.



Join the conversation! Your thoughts help the community grow.