[commit: base] : Parallel IO manager supports increasing and decreasing number of capabilities. (0fbe9c8)

Johan Tibell johan.tibell at gmail.com
Tue Feb 12 07:50:57 CET 2013

Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : 



commit 0fbe9c8d5ffa3f735ee3e650045a441e70df92ac
Author: Andreas Voellmy <andreas.voellmy at gmail.com>
Date:   Sat Dec 22 20:56:02 2012 -0500

    Parallel IO manager supports increasing and decreasing number of capabilities.
    We never deallocate the backend files (e.g. epoll instance, eventfd files) when decreasing number of capabilities. Nor do we exit the poll loop for that instance. However, that thread will naturally empty its queue over time and eventually stay out in a foreign call indefinitely. There is a remote possibility that a Haskell thread got a reference to an IO manager just before the number of capabilities was decreased and then this thread finally registers a callback at some time far in the future. This scenario is the motivation for leaving the backend instance and thread servicing that instance alive.
    The main change is now in adding new capabilities. Since those capabilites may have been active in the past, we may already have backend files available for use. We signal to the old thread servicing that backend to release the backend and exit. Upon exiting it fills an MVar. We start a new thread bound to the new capability and it waits to enter the poll loop until the MVar is full.

 GHC/Event/Manager.hs |   43 +++++++++++++++++++-------
 GHC/Event/Thread.hs  |   82 +++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 95 insertions(+), 30 deletions(-)

Diff suppressed because of size. To see it, use:

    git show 0fbe9c8d5ffa3f735ee3e650045a441e70df92ac

More information about the ghc-commits mailing list