thread and fork weirdness

Simon Marlow simonmar at microsoft.com
Wed Jul 13 12:20:13 EDT 2005


Hi Ian,

The most likely suspect is a bug in Linux 2.4 on ia64.  However, if you
have a GHC build and can produce a thr_debug version of the RTS (say
GhcRTSWays += thr_debug in mk/build.mk), then you can compile with
-debug and run with +RTS -Ds to see what GHC's scheduler is doing.  That
might tell us why the forked process is missing.

Cheers,
	Simon

On 08 July 2005 22:32, Ian Lynagh wrote:

> Hi all,
> 
> I'm seeing odd behaviour, where whether I print "Here" affects
> whether a 
> block of code seems to be run on IA64/Linux 2.4. Am I doing something
> that's not guaranteed to work, or is there a bug somewhere?
> 
> 
> On "2.4.27-dsa-itanium-smp #1 SMP Wed Mar 16 07:53:43 MST 2005 ia64
> GNU/Linux" 
> 
> I get:
> 
> $ sh q.sh
> + GHC=/home/igloo/c/ghc-cvs-20050706/ghc/compiler/stage2/ghc-inplace
> + rm -f '*.o' '*.hi' timeout
> + /home/igloo/c/ghc-cvs-20050706/ghc/compiler/stage2/ghc-inplace -O
> -threaded -package unix timeout.hs -o timeout -Wall -cpp -DHERE=True
> + ./timeout 
> timeout started
> forkOSing
> Here
> Creating session
> forkOSed
> Running
> Returning
> Just ExitSuccess
> 
> real    0m3.045s
> user    0m0.012s
> sys     0m0.025s
> + rm -f timeout.o timeout.hi timeout
> + /home/igloo/c/ghc-cvs-20050706/ghc/compiler/stage2/ghc-inplace -O
> -threaded -package unix timeout.hs -o timeout -Wall -cpp -DHERE=False
> + ./timeout 
> timeout started
> forkOSing
> forkOSed
> Nothing
> 
> real    0m6.001s
> user    0m0.008s
> sys     0m0.014s
> 
> 
> 
> 
> whereas on "2.6.8.1 #1 Wed Sep 15 13:09:27 BST 2004 i686 GNU/Linux" I
> get what I expected:
> 
> $ sh q.sh
> +
>
GHC=/home/igloo/ghc-cvs/new/ghc-cvs-20050706/ghc/compiler/stage2/ghc-inp
lace
> + rm -f timeout.o timeout.hi timeout +
>
/home/igloo/ghc-cvs/new/ghc-cvs-20050706/ghc/compiler/stage2/ghc-inplace
> -O -t  
> hreaded -package unix timeout.hs -o timeout -Wall -cpp -DHERE=True
> + time ./timeout
> timeout started
> forkOSing
> Here
> forkOSed
> Creating session
> Running
> Returning
> Just ExitSuccess
> 0.00user 0.00system 0:03.00elapsed 0%CPU (0avgtext+0avgdata
> 0maxresident)k 0inputs+0outputs (0major+562minor)pagefaults 0swaps
> + rm -f timeout.o timeout.hi timeout
> +
>
/home/igloo/ghc-cvs/new/ghc-cvs-20050706/ghc/compiler/stage2/ghc-inplace
> -O -t  
> hreaded -package unix timeout.hs -o timeout -Wall -cpp -DHERE=False
> + time ./timeout
> timeout started
> forkOSing
> Creating session
> Running
> forkOSed
> Returning
> Just ExitSuccess
> 0.00user 0.00system 0:03.00elapsed 0%CPU (0avgtext+0avgdata
> 0maxresident)k 0inputs+0outputs (0major+560minor)pagefaults 0swaps
> 
> 
> 
> In both cases I have
> 
> gcc version 4.0.1 20050701 (prerelease) (Debian 4.0.0-12)
> 
> 
> Thanks
> Ian



More information about the Cvs-ghc mailing list