Posts

Showing posts from 2018

Threading and Task Processing Library in C#

Image
Threading Need of Thread Let us think your computer have only on CPU or a single core processor capable of running one operation at  a time, if CPU has to process a long running task, till the time no other task would run until the current task completes, while this task run all other application will remain unresponsive which forces you to restart the system to fix the issue.              Here thread came into existence. In current windows each application have it's own processes that execute in threads, so if an application crashes only process associated with that application will affect. Context Switching:  Windows manage execution of threads to ensure their work properly, each thread is allowed to execute for a certain period of time, after this period the thread is paused and windows switches to other thread. This is called context switching. However windows has to manage the time between switching, so that it saves the state of current thread to process again in i