summaryrefslogtreecommitdiff
path: root/ghc/rts/Main.c
diff options
context:
space:
mode:
authorsimonmar <unknown>1999-11-02 15:06:05 +0000
committersimonmar <unknown>1999-11-02 15:06:05 +0000
commitf6692611aad945e46ffb615bde1df7def3fc742f (patch)
tree04e2e2af9c43eba1b60312b89eb3ac8f34209e2c /ghc/rts/Main.c
parent947d2e363f75e9e230d535c876ecdafba45174b5 (diff)
downloadhaskell-f6692611aad945e46ffb615bde1df7def3fc742f.tar.gz
[project @ 1999-11-02 15:05:38 by simonmar]
This commit adds in the current state of our SMP support. Notably, this allows the new way 's' to be built, providing support for running multiple Haskell threads simultaneously on top of any pthreads implementation, the idea being to take advantage of commodity SMP boxes. Don't expect to get much of a speedup yet; due to the excessive locking required to synchronise access to mutable heap objects, you'll see a slowdown in most cases, even on a UP machine. The best I've seen is a 1.6-1.7 speedup on an example that did no locking (two optimised nfibs in parallel). - new RTS -N flag specifies how many pthreads to start. - new driver -smp flag, tells the driver to use way 's'. - new compiler -fsmp option (not for user comsumption) tells the compiler not to generate direct jumps to thunk entry code. - largely rewritten scheduler - _ccall_GC is now done by handing back a "token" to the RTS before executing the ccall; it should now be possible to execute blocking ccalls in the current thread while allowing the RTS to continue running Haskell threads as normal. - you can only call thread-safe C libraries from a way 's' build, of course. Pthread support is still incomplete, and weird things (including deadlocks) are likely to happen.
Diffstat (limited to 'ghc/rts/Main.c')
-rw-r--r--ghc/rts/Main.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/ghc/rts/Main.c b/ghc/rts/Main.c
index 01c05e6089..a15a0375b1 100644
--- a/ghc/rts/Main.c
+++ b/ghc/rts/Main.c
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------------
- * $Id: Main.c,v 1.11 1999/09/16 08:29:01 sof Exp $
+ * $Id: Main.c,v 1.12 1999/11/02 15:05:58 simonmar Exp $
*
* (c) The GHC Team 1998-1999
*
@@ -13,7 +13,6 @@
#include "RtsAPI.h"
#include "SchedAPI.h"
#include "RtsFlags.h"
-#include "Schedule.h" /* for MainTSO */
#include "RtsUtils.h"
#ifdef DEBUG
@@ -45,19 +44,14 @@ int main(int argc, char *argv[])
startupHaskell(argc,argv);
# ifndef PAR
- MainTSO = createIOThread(stg_max(BLOCK_SIZE_W,
- RtsFlags.GcFlags.initialStkSize),
- (StgClosure *)&mainIO_closure);
- status = schedule(MainTSO,NULL);
+ /* ToDo: want to start with a larger stack size */
+ status = rts_evalIO((StgClosure *)&mainIO_closure, NULL);
# else
if (IAmMainThread == rtsTrue) {
/*Just to show we're alive */
fprintf(stderr, "Main Thread Started ...\n");
- MainTSO = createIOThread(stg_max(BLOCK_SIZE_W,
- RtsFlags.GcFlags.initialStkSize),
- (StgClosure *)&mainIO_closure);
- status = schedule(MainTSO,NULL);
+ status = rts_evalIO((StgClosure *)&mainIO_closure, NULL);
} else {
WaitForPEOp(PP_FINISH,SysManTask);
exit(EXIT_SUCCESS);