C Sharp Multithreading

C# Multithreading

The process in which multiple threads work simultaneously to achieve multitasking is called Multithreading in C#. Since multiple tasks can be executed at a time through multithreading in C#, thus it saves time. The System.Threading namespace is used in C# to create a multithreaded application.

System.Threading Namespace:

Various classes and interfaces are present in a System.Threading namespace to provide the facility of multithreaded programming and to synchronize the thread resource. The most popular classes of the System.Threading namespace is listed below:

  • Thread
  • Mutex
  • Timer
  • Monitor
  • Semaphore
  • ThreadLocal
  • ThreadPool
  • Volatile etc.

Process and Thread:

A process being a heavyweight component represents an application. A thread, on the other hand, is a lightweight subprocess (executed inside a process) representing a module of the application. Also, a separate memory area is occupied every time a process is created, whereas a common memory area is shared by the threads.

Please Share