Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
6437 commits behind the upstream repository.
  • sheaf's avatar
    5c873124
    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 wants to spawn a new jobclient subprocess, it **must**
      first acquire a single token from the semaphore, before spawning
      the subprocess. This token **must** be released once the subprocess terminates.
    
      Once work is finished, the jobserver **must** destroy the semaphore it created.
    
    - A *jobclient* is a subprocess spawned by the jobserver or another jobclient.
    
      Each jobclient starts with one available token (its *implicit token*,
      which was acquired by the parent which spawned it), and can request more
      tokens through the Jobserver Protocol by waiting on the semaphore.
    
      Each time a jobclient wants to spawn a new jobclient subprocess, it **must**
      pass on a single token to the child jobclient. This token can either be the
      jobclient's implicit token, or another token which the jobclient acquired
      from the semaphore.
    
      Each jobclient **must** release exactly as many tokens as it has acquired from
      the semaphore (this does not include the implicit tokens).
    ```
    
    Build tools such as cabal act as jobservers in the protocol and are
    responsibile for correctly creating, cleaning up and managing the
    semaphore.
    
    Adds a new submodule (semaphore-compat) for managing and interacting
    with semaphores in a cross-platform way.
    
    Fixes #19349
    5c873124
    History
    Implement -jsem: parallelism controlled by semaphores
    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 wants to spawn a new jobclient subprocess, it **must**
      first acquire a single token from the semaphore, before spawning
      the subprocess. This token **must** be released once the subprocess terminates.
    
      Once work is finished, the jobserver **must** destroy the semaphore it created.
    
    - A *jobclient* is a subprocess spawned by the jobserver or another jobclient.
    
      Each jobclient starts with one available token (its *implicit token*,
      which was acquired by the parent which spawned it), and can request more
      tokens through the Jobserver Protocol by waiting on the semaphore.
    
      Each time a jobclient wants to spawn a new jobclient subprocess, it **must**
      pass on a single token to the child jobclient. This token can either be the
      jobclient's implicit token, or another token which the jobclient acquired
      from the semaphore.
    
      Each jobclient **must** release exactly as many tokens as it has acquired from
      the semaphore (this does not include the implicit tokens).
    ```
    
    Build tools such as cabal act as jobservers in the protocol and are
    responsibile for correctly creating, cleaning up and managing the
    semaphore.
    
    Adds a new submodule (semaphore-compat) for managing and interacting
    with semaphores in a cross-platform way.
    
    Fixes #19349
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitmodules 3.88 KiB
[submodule "libraries/binary"]
	path = libraries/binary
	url = https://gitlab.haskell.org/ghc/packages/binary.git
	ignore = untracked
[submodule "libraries/bytestring"]
	path = libraries/bytestring
	url = https://gitlab.haskell.org/ghc/packages/bytestring.git
	ignore = untracked
[submodule "libraries/Cabal"]
	path = libraries/Cabal
	url = https://gitlab.haskell.org/ghc/packages/Cabal.git
	ignore = untracked
[submodule "libraries/containers"]
	path = libraries/containers
	url = https://gitlab.haskell.org/ghc/packages/containers.git
	ignore = untracked
[submodule "libraries/haskeline"]
	path = libraries/haskeline
	url = https://gitlab.haskell.org/ghc/packages/haskeline.git
	ignore = untracked
[submodule "libraries/pretty"]
	path = libraries/pretty
	url = https://gitlab.haskell.org/ghc/packages/pretty.git
	ignore = untracked
[submodule "libraries/terminfo"]
	path = libraries/terminfo
	url = https://gitlab.haskell.org/ghc/packages/terminfo.git
	ignore = untracked
[submodule "libraries/transformers"]
	path = libraries/transformers
	url = https://gitlab.haskell.org/ghc/packages/transformers.git
	ignore = untracked
[submodule "libraries/xhtml"]
	path = libraries/xhtml
	url = https://gitlab.haskell.org/ghc/packages/xhtml.git
	ignore = untracked
[submodule "libraries/Win32"]
	path = libraries/Win32
	url = https://gitlab.haskell.org/ghc/packages/Win32.git
	ignore = untracked
[submodule "libraries/time"]
	path = libraries/time
	url = https://gitlab.haskell.org/ghc/packages/time.git
	ignore = untracked
[submodule "libraries/array"]
	path = libraries/array
	url = https://gitlab.haskell.org/ghc/packages/array.git
	ignore = untracked
[submodule "libraries/deepseq"]
	path = libraries/deepseq
	url = https://gitlab.haskell.org/ghc/packages/deepseq.git
	ignore = untracked
[submodule "libraries/directory"]
	path = libraries/directory
	url = https://gitlab.haskell.org/ghc/packages/directory.git
	ignore = untracked
[submodule "libraries/filepath"]
	path = libraries/filepath
	url = https://gitlab.haskell.org/ghc/packages/filepath.git
	ignore = untracked
[submodule "libraries/hpc"]
	path = libraries/hpc
	url = https://gitlab.haskell.org/ghc/packages/hpc.git
	ignore = untracked
[submodule "libraries/parsec"]
	path = libraries/parsec
	url = https://gitlab.haskell.org/ghc/packages/parsec.git
	ignore = untracked
[submodule "libraries/text"]
	path = libraries/text
	url = https://gitlab.haskell.org/ghc/packages/text.git
	ignore = untracked
[submodule "libraries/mtl"]
	path = libraries/mtl
	url = https://gitlab.haskell.org/ghc/packages/mtl.git
	ignore = untracked
[submodule "libraries/process"]
	path = libraries/process
	url = https://gitlab.haskell.org/ghc/packages/process.git
	ignore = untracked
[submodule "libraries/unix"]
	path = libraries/unix
	url = https://gitlab.haskell.org/ghc/packages/unix.git
	ignore = untracked
	branch = 2.7
[submodule "libraries/semaphore-compat"]
	path = libraries/semaphore-compat
	url = https://gitlab.haskell.org/ghc/semaphore-compat.git
	ignore = untracked
[submodule "libraries/stm"]
	path = libraries/stm
	url = https://gitlab.haskell.org/ghc/packages/stm.git
	ignore = untracked
[submodule "utils/haddock"]
	path = utils/haddock
	url = https://gitlab.haskell.org/ghc/haddock.git
	ignore = untracked
	branch = ghc-head
[submodule "nofib"]
	path = nofib
	url = https://gitlab.haskell.org/ghc/nofib.git
	ignore = untracked
[submodule "utils/hsc2hs"]
	path = utils/hsc2hs
	url = https://gitlab.haskell.org/ghc/hsc2hs.git
	ignore = untracked
[submodule "libffi-tarballs"]
	path = libffi-tarballs
	url = https://gitlab.haskell.org/ghc/libffi-tarballs.git
	ignore = untracked
[submodule "gmp-tarballs"]
	path = libraries/ghc-bignum/gmp/gmp-tarballs
	url = https://gitlab.haskell.org/ghc/gmp-tarballs.git
[submodule "libraries/exceptions"]
	path = libraries/exceptions
	url = https://gitlab.haskell.org/ghc/packages/exceptions.git
[submodule "utils/hpc"]
	path = utils/hpc
	url = https://gitlab.haskell.org/hpc/hpc-bin.git