[GHC] #8521: Tight loop prevents other threads from running in available cores
GHC
ghc-devs at haskell.org
Mon Nov 11 12:45:03 UTC 2013
#8521: Tight loop prevents other threads from running in available cores
-------------------------------------+-------------------------------------
Reporter: facundo.dominguez | Owner: simonmar
Type: bug | Status: new
Priority: normal | Milestone:
Component: Runtime System | Version: 7.6.3
Keywords: | Operating System: Unknown/Multiple
Architecture: x86_64 (amd64) | Type of failure: None/Unknown
Difficulty: Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: |
-------------------------------------+-------------------------------------
The following program does not terminate when compiled with:
{{{ghc --make -O -threaded test.hs}}}
and executed on linux on an amd64 machine with 16 cores with:
{{{./test}}}
{{{
import Control.Concurrent
import Control.Monad
import System.Environment
main :: IO ()
main = do
y <- getArgs
mv0 <- newEmptyMVar
mv1 <- newEmptyMVar
forkIO $ do
takeMVar mv0
putMVar mv1 ()
loop (y == ["yield"])
putMVar mv0 ()
takeMVar mv1
>>= print
loop :: Bool -> IO ()
loop cooperative = go
where
go = when cooperative yield >> go
}}}
Here [1] is the discussion about it so far.
[1] http://www.haskell.org/pipermail/glasgow-haskell-
users/2013-October/024412.html
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8521>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list