Presentation is loading. Please wait.

Presentation is loading. Please wait.

Threads are units of work that are created by a parent process to perform some task. By utilizing multiple threads, an application can delegate the work.

Similar presentations


Presentation on theme: "Threads are units of work that are created by a parent process to perform some task. By utilizing multiple threads, an application can delegate the work."— Presentation transcript:

1

2 Threads are units of work that are created by a parent process to perform some task. By utilizing multiple threads, an application can delegate the work to multiple workers to reduce the time it takes to complete a relatively long task. However, using threads just because you think they will make your application run faster can often backfire. In fact, using too many threads can actually cause your application to run slower. For example, you could have so many threads running that your application is spending more time swapping context between the threads than it is performing the tasks within the threads. In this case, your application will actually run slower than if it had no threading support whatsoever. The Basics of Threaded Programming

3 Thread States: Life Cycle of a Thread

4 The Windows operating system supports a concept, called timeslicing, that enables threads of equal priority to share a processor.With timeslicing, each thread receives a brief burst of processor time, called a quantum, during which the thread can execute. At the completion of the quantum,even if the thread has not finished executing, the processor is taken away from that thread and given to the next thread of equal priority, if one is available. Thread Priorities and Thread Scheduling

5 Final : Display turn over threads in graphic mode

6 Resource Microsoft® Visual C# 2005 Unleashed By Kevin Hoffman By Kevin Hoffman Deitel - C# How to Program (redistilled in one book) And special thanks to Barnamenevise forum


Download ppt "Threads are units of work that are created by a parent process to perform some task. By utilizing multiple threads, an application can delegate the work."

Similar presentations


Ads by Google