The future of concurrent programming

BCS BCS at pathlink.com
Tue May 29 13:40:39 PDT 2007


Sean Kelly wrote:
> Jeff Nowakowski wrote:
> 
>> freeagle wrote:
>>
>>> Why do people think there is a need for another language/paradigm to 
>>> solve concurrent problem? OSes deal with parallelism for decades, 
>>> without special purpose languages. Just plain C, C++. Just check Task 
>>> manager in windows and you'll notice there's about 100+ threads running.
>>
>>
>> Why limit yourself to hundreds of threads when you can have thousands?
> 
> 
> Because context switching is expensive.  Running thousands of threads on 
> a system with only a few CPUs may use more time simply switching between 
> threads than it does executing the thread code.
> 
> 
> Sean

Why burn cycle on the context switch? If the CPU had a "back door" to 
swap out the register values on a second bank of registers, then a 
context switch could run in the time it takes to drain and refill the 
internal pipes. This would requirer a separate control system to manage 
the scheduling but that would have some interesting uses in and of it's 
self (drop user/kernel mode for user/kernel CPU's).



More information about the Digitalmars-d mailing list