[previous] [up] [next]     [index]
Next: MzScheme Architecture Up: Overview Previous: Embedding MzScheme into a

MzScheme and Threads

In its normal configuration, MzScheme implements threads for Scheme programs without aid from the operating system. On a few platforms, including Windows, Solaris, and Linux, MzScheme can be compiled to map each Scheme thread to a separate operating system thread.[footnote] The advantage of the OS-thread configuration is that different Scheme threads can take advantage of different processors on a multi-processor machine.

In either configuration, MzScheme can co-exist with additional OS threads that are created by an extension or an embedding program. However, the additional OS threads must not call any scheme_ function. In the normal configuration, only the OS thread that originally calls scheme_basic_env can call scheme_ functions.[footnote] In the OS-thread configuration, only the scheme_basic_env thread and other OS threads created by MzScheme (via the thread Scheme function or the scheme_thread C function) should call or scheme_ functions.

In the normal configuration, when scheme_basic_env is called a second time to reset the interpreter, it can be called in an OS thread that is different from the original call to scheme_basic_env. Thereafter, all calls to scheme_ functions must originate from the new thread.

See section 2.7 for more information about threads, including the possible effects of MzScheme's thread implementation on extension and embedding C code.



PLT