1. Thread Class: Use the System.Threading.Thread class to create threads.
2. Thread Constructor: Pass a ThreadStart delegate or a ParameterizedThreadStart delegate to the constructor.
3. ThreadStart Delegate: Represents the method to be executed by the thread.
Example:
using System.Threading;
class Program
{
static void Main()
{
Thread thread = new Thread(new ThreadStart(MyMethod));
thread.Start();
}
static void MyMethod()
{
Console.WriteLine("Thread is running.");
}
}
Processes-
1. Independent units of execution
2. Own memory space (virtual address space)
3. Created by operating system
4. Communicate through Inter-Process Communication (IPC) mechanisms