[project @ 2005-05-23 15:44:10 by simonmar]
authorsimonmar <unknown>
Mon, 23 May 2005 15:44:10 +0000 (15:44 +0000)
committersimonmar <unknown>
Mon, 23 May 2005 15:44:10 +0000 (15:44 +0000)
commit6d16c4760494abbe54b449f6a9b7d51336a1e3c3
tree06c8793bb4ba625d93c756ec77e1a14324c0409d
parent58fa36245d447a336bada3de2eed05f9969370e5
[project @ 2005-05-23 15:44:10 by simonmar]
Simplify and improve the Capability-passing machinery for bound
threads.

The old story was quite complicated: if you find a thread on the run
queue which the current task can't run, you had to call
passCapability(), which set a flag saying where the next Capability
was to go, and then release the Capability.  When multiple
Capabilities are flying around, it's not clear how this story should
extend.

The new story is much simpler: each time around the scheduler loop,
the task looks to see whether it can make any progress, and if not, it
releases its Capability and wakes up a task which *can* make some
progress.  The predicate for whether we can make any progress is
encapsulated in the (inline) function ANY_WORK_FOR_ME(Condition).
Waking up an appropriate task is encapsulated in the function
threadRunnable() (previously it was in two places).

The logic in Capability.c is simpler, but unfortunately it is now more
closely connected with the Scheduler, because it inspects the run
queue.  However, performance when communicating between bound and
unbound threads might be better.

The concurrency tests still work, so hopefully this hasn't broken
anything.
ghc/rts/Capability.c
ghc/rts/Capability.h
ghc/rts/Schedule.c