Multithreading exercise

In computing theory, job execution is programmatically spanned using the control named thread.  Each thread defines a unique flow of control, but it is controlled by the main program. If you notice that the application is a time-consuming complicated independent process, it is advisable to leverage thread programming for the efficient execution. Independent is the key for parallelism.

In .NET programming, threads are created by extending Thread class of System.Threading library.  On invoking Start() method of the extended Thread class, the system kick starts the child thread execution.  The life cycle of a thread starts when an object of the System.Threading.Thread class is created and ends when the thread is terminated or completes execution.

By design, .NET Core supports multithreaded operations in the following two ways:

  • Own threads with ThreadStart delegates
  • Using ThreadPool framework class

As best practice, it is highly recommended to create a new thread manually using ThreadStart for long-running tasks, whereas ThreadPool only for brief jobs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.204.186