X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdocs%2Fcomm%2Frts-libs%2Fmulti-thread.html;h=67a544be85983ef77469775538bd8a02fafe8155;hb=28a464a75e14cece5db40f2765a29348273ff2d2;hp=7e87f898c63d336c431e56742269509b461e985f;hpb=239d2048d8f0b6d6243571aee67c1b3bbeb1e3b2;p=ghc-hetmet.git diff --git a/ghc/docs/comm/rts-libs/multi-thread.html b/ghc/docs/comm/rts-libs/multi-thread.html index 7e87f89..67a544b 100644 --- a/ghc/docs/comm/rts-libs/multi-thread.html +++ b/ghc/docs/comm/rts-libs/multi-thread.html @@ -28,7 +28,7 @@ OS threads may safely call Haskell functions concurrently. Section -

Calling out

+

The problem: foreign calls that block

When a Concurrent Haskell(CH) thread calls a 'foreign import'ed function, the runtime system(RTS) has to handle this in a manner @@ -48,25 +48,45 @@ threads (pthreads) and one for the Win32 threads.

Multi-threading the RTS

-From an RTS perspective, a simple and efficient way to implement this -is to retain the property that only one OS thread is allowed to +A simple and efficient way to implement non-blocking foreign calls is like this: +

+

+The rest of this section describes the mechanics of implementing all +this. There's two parts to it, one that describes how a native (OS) thread leaves the RTS to service the external call, the other how the same thread handles returning the result of the external call back to the Haskell thread. @@ -240,6 +260,15 @@ Scheduler may side-track it and also ask it to evaluate other Haskell threads. +

+Note: As of 20020413, the implementation of the RTS API +only serializes access to the allocator between multiple OS threads wanting +to call into Haskell (via the RTS API.) It does not coordinate this access +to the allocator with that of the OS worker thread that's currently executing +within the RTS. This weakness/bug is scheduled to be tackled as part of an +overhaul/reworking of the RTS API itself. + +

Subsystems introduced/modified