Ask a questionAsk a question
 

AnswerRelation between different task_group instances

  • Sunday, November 01, 2009 8:58 AMAlex Farber Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I tried to run n tasks using n different task_group instances. Result: only two tasks are activated at the same time on my 2 processors computer. My guess is that task_group instances use some shared resources. Understanding of this issue is important to PPL users. What happens inside of task_group class?

Answers

  • Sunday, November 01, 2009 10:01 PMrickmolloyMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    The PPL is built on top of the Concurrency Runtime, a cooperative-by-default-scheduler please read this which discusses this in detail.  Essentially this means that on a 2-core system you will see approximately 2 threads unless you make a call that the runtime understands as blocking like task_group::wait or agent::wait, Context::Block or event::wait. You can also force thread injection with a call to Concurrency::Oversubscribe or ask for a different number of threads with a scheduler policy.  Additionally on Win7 x64 ConcRT supports User Mode Scheduled threads and will get a notification of blocking for any call whick blocks in the kernel and the runtime will use this as an opportunity there is also a help topic here which is useful to demonstrate this.


    Rick Molloy Parallel Computing Platform : http://blogs.msdn.com/nativeconcurrency http://parallelroads.com/blog

All Replies

  • Sunday, November 01, 2009 10:01 PMrickmolloyMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    The PPL is built on top of the Concurrency Runtime, a cooperative-by-default-scheduler please read this which discusses this in detail.  Essentially this means that on a 2-core system you will see approximately 2 threads unless you make a call that the runtime understands as blocking like task_group::wait or agent::wait, Context::Block or event::wait. You can also force thread injection with a call to Concurrency::Oversubscribe or ask for a different number of threads with a scheduler policy.  Additionally on Win7 x64 ConcRT supports User Mode Scheduled threads and will get a notification of blocking for any call whick blocks in the kernel and the runtime will use this as an opportunity there is also a help topic here which is useful to demonstrate this.


    Rick Molloy Parallel Computing Platform : http://blogs.msdn.com/nativeconcurrency http://parallelroads.com/blog