Re: [Algorithms] General purpose task parallel threading approach
Brought to you by:
vexxed72
|
From: Jarkko L. <al...@gm...> - 2009-04-05 01:11:59
|
Sub-tasks spawn by a task are not necessarily run serially by the same worker thread though. Worker threads should pull tasks from job queue based on task priority, so those spawned tasks are likely to be executed by many worker threads instead. Cheers, Jarkko _____ From: Sebastian Sylvan [mailto:seb...@gm...] Sent: Sunday, April 05, 2009 3:51 AM To: Game Development Algorithms Subject: Re: [Algorithms] General purpose task parallel threading approach Assuming I did understand you correctly, I'll just say that I think adding (even slight) overhead to the "run" method of every single task in order to make blocking cheaper is a big mistake. The whole motivating idea behind task parallelism is that you saturate the system with way more runnable tasks than there are hardware capabilities, so that performance can scale with hardware, and that no CPU capability is left idle. If the number of runnable tasks is much larger than the actual number of worker threads, that means that most tasks will just run serially on the same worker that spawned them, which means that most synchronisation points won't block, which means that the number of thread switches will be few compared to the number of task executions, which means that optimizing for fast blocking is not as important as making sure that running a task is dirt cheap. -- Sebastian Sylvan +44(0)7857-300802 UIN: 44640862 |