C# Threads – Threading in The Past

Years back, threads were implemented so isolate programs. In the early days, for example of Windows Version 3, Cooperative Multitasking was used.

With this technique, the Operating System executed all programs on a single execution loop.

The risk was that if one program encountered an error such as infinite loop, the other programs would all hang. In fact even the Operating System itself would.

Then the only situation would be a reboot.

The OS designers learnt fast and programs would be given their own virtual CPU. This was done via what we call Threads. If one of the programs entered an infinite loop, the other programs would continue doing their roles unaffected.

With threads, we moved from Cooperative Multitasking to Preemptive Multitasking. With preemptive multitasking, the OS has control of how much CPU time is assigned to each application. So one thread misbehaving does not affect the other threads.

But later on CPUs started to move from being faster and faster to having more and more cores. So this power and capability had to be taken advantage of by applications themselves as well.

Read more about threads here.


Share an Example

Share an Example

What is the capital of Egypt? ( Cairo )