Unbounded buffer (VS10)- shows unprocessed messages in debug view

Answered Unbounded buffer (VS10)- shows unprocessed messages in debug view

  • Thursday, July 12, 2012 3:11 PM
     
     

    I use unbounded buffer like this in VS10:

    bool accepted = asend(this->workQueue, work); //returns true

    On a Ms server 2003 R2 SP2 in debug view every time I add a message to the workQueue I see the unprocessed messages growing for the unbounded buffer. Can I use PPL on that platform ? I have to mention that my implementation works on later platforms, and don't know the reason I could get this issues (asend returns true)

    Thanks for your help !



    PS: the way I observed the issue was because I was adding messages to the buffer and from another agent(thread) I was consuming messages but dequeue() method does not return the new work added.
    • Edited by raiderG Thursday, July 12, 2012 3:12 PM
    • Edited by raiderG Thursday, July 12, 2012 3:13 PM
    • Edited by raiderG Thursday, July 12, 2012 3:14 PM
    •  

All Replies

  • Thursday, July 12, 2012 3:27 PM
     
      Has Code

    Just wanted to add how I do the dequeueing from a ppl agent (dequeue gets stuck in this case even if I added elements as described in previous post)

     auto value = this->workQueue.dequeue()

    EDIT: I just discovered that in some cases debug view helper for unbounded_buffer shows that I also have messages (not unprocessed messages) but I am still not able to get them...
    • Edited by raiderG Thursday, July 12, 2012 3:29 PM
    •  
  • Friday, July 13, 2012 10:28 AM
     
     

    I've found out the conditions in which this bug reproduces. I've done my tests on on vmWare machine with has allocated only 1 core.

    As soon as I've increased my number of cores to 3 things described didn't happen anymore. A little context about my application. I use ppl task_group and agents. I only use about 3 agents though. I guess this isn't supposed to happen. I also tried using 2 cores and reproduced the bug until I increased to 3 cores.

  • Monday, July 16, 2012 3:24 PM
     
     Answered Has Code

    I've found out how to fix the limitation/bug in ppl/agents as described above. If I set at application startup a default scheduler with min concurrency 3 or 4 things work as expected (this basically fixed problems that arise when my virtual machine has assigned less than 3 cores). Here is the code

    // there is a bug using agents/ppl with some virtual machines at least, where if concurrency is too low     
    // (machine has less than 3 cores for example) agents/ppl don't work as expected    
    Concurrency::SchedulerPolicy minConcurrencyPolicy(1, Concurrency::MinConcurrency, 4);   
    Concurrency::Scheduler::SetDefaultSchedulerPolicy(minConcurrencyPolicy);

    • Marked As Answer by raiderG Monday, July 16, 2012 3:25 PM
    •