Skip to content
  • sheaf's avatar
    Implement -jsem: parallelism controlled by semaphores · 5c873124
    sheaf authored and Marge Bot's avatar Marge Bot committed
    See https://github.com/ghc-proposals/ghc-proposals/pull/540/ for a
    complete description for the motivation for this feature.
    
    The `-jsem` option allows a build tool to pass a semaphore to GHC which
    GHC can use in order to control how much parallelism it requests.
    
    GHC itself acts as a client in the GHC jobserver protocol.
    
    ```
    GHC Jobserver Protocol
    ~~~~~~~~~~~~~~~~~~~~~~
    
    This proposal introduces the GHC Jobserver Protocol. This protocol allows
    a server to dynamically invoke many instances of a client process,
    while restricting all of those instances to use no more than <n> capabilities.
    This is achieved by coordination over a system semaphore (either a POSIX
    semaphore [6]_  in the case of Linux and Darwin, or a Win32 semaphore [7]_
    in the case of Windows platforms).
    
    There are two kinds of participants in the GHC Jobserver protocol:
    
    - The *jobserver* creates a system semaphore with a certain number of
      available tokens.
    
      Each time the jobserver w...
    5c873124