|
Boost : |
Subject: Re: [boost] [threadpool] new version v12
From: Oliver Kowalke (k-oli_at_[hidden])
Date: 2008-11-03 06:41:34
> Here's the problem: if you take a task from the global queue or the
> worker queue of another thread and *don't* do thread migration, then
> you risk delaying a task and potentially deadlocking the pool.
>
> Consider the sequence above: at step 5, task A is blocked, and the
> only task it is waiting for (B) has been picked up by an idle worker
> thread. The thread running task A now takes a new task from the global
> queue (task N). Suppose this is a really long-running task (calculate
> PI to 3 million digits, defrag a hard disk, etc.). Without thread
> migration, task A cannot resume until task N is complete.
>
> Obviously, if task N blocks on a future you can then reschedule task
> A, but if it doesn't then you don't get that opportunity. If task N
> waits for another event to be triggered from task A (e.g. a notify on
> a condition variable) then it will never get it because task A is
> suspended, and so the pool thread will deadlock *even when task A is
> ready to run*.
Wouldn't this also happen in the recursive execution of tasks (without fibers)?
Oliver
-- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk