Search This Blog

Wednesday, February 22, 2017

Threads in .NET

process is the "heaviest" unit of kernel scheduling.
kernel thread is the "lightest" unit of kernel scheduling.
User threads as implemented by virtual machines (frameworks). In this article we probably
 speak about the  user threads..
In the next figure is showed the structure of CLR:

As  you can see there is the "Thread Support" block  in CLR structure

Generally speaking  for Threads :

  • The base namespace used for threading is System.Threading
  • The more frequently used classes of this namespace are :Thread ,Monitor,Timer,and Intrerlocked
  • The more frequently used structure of this namespace is :AsyncFlowControl
  • The more frequently used Delegate of this namespace is :
    ThreadStart 
  • Threads are managed under the Common Language Runtime, programmers don’t have to manage any threads explicitly
  • Threads are implemented when you have situations in which you want to perform more then one task at a time.
  • In case of synchronization, since you have limited amount of recourses, you may have to restrict the access to the resources to one thread at a time. In these situations, you may implement locking on the threading to over come the scenarios.
  • We have two types of threads :Foreground and Background Threads.
  • Each Thread have some priority.(ThreadPriority Enumeration)
  • Each Thread at any time must be in some state.( ThreadState enumeration) 
  • The Threads are the basis for  both  asynchronous and parallel programming


About Me

An seasoned developer, architect and with some Team Leading exposure, offering full project life cycle experiences within multi cultural, multi National environments and within differing business streams and all primarily on a .Net platform.