multi-threaded squeak

Bob Hartwig bob at bobjectsinc.com
Mon Jun 18 16:03:57 UTC 2001


>
>One common use of threads is to allow other tasks to run while one
>task is blocked on IO. Does tihs work in Squeak? If so, how? If
>there's only one operating system thread, won't the entire Squeak
>process block on that IO request?
>

Yes it will, and this can be a real problem for some applications.  It's
not just a problem for IO primitives, any long-running API function will
cause everything to block.

Several commercial Smalltalks have addressed this by maintaining a cache of
OS threads, and using them to make the API function call.  The sending
Smalltalk process waits on a Semaphore until the function call returns.  

IBM supports this technique through "Coroutine Platform Functions", VSE
called the technique "Non-blocking API", and you could get there in /V for
OS/2 through a third party framework called "API threads".  We used to call
this the "95% solution" to OS thread support, because about 95% of us who
were clamoring for OS thread support only needed them to keep foreign
functions from blocking Smalltalk.

It would be great to have this for FFI, and it's not particularly difficult
to implement.  I don't know if there is any explicit support for doing this
for Plugin primitives, but I suspect not.  Am I right about that?

	-Bob





More information about the Squeak-dev mailing list