Processes and Threads
The SSCLI provides a rich set of threading features to the developer, and because of this, it makes some heavy demands on the operating system beneath its PAL. The PAL specification requires support for:
Process creation
Process termination
Process exit code access
Interprocess memory access
Interprocess communication using memory mapping
Interprocess communication using events
Inheritance of standard handles through process creation
Between the C runtime, POSIX system calls, and pthreads
(the POSIX threads package), the Unix PAL has most of what it needs to implement these features on Mac OS X and FreeBSD.
PAL Processes
The model for process isolation in the PAL is simple: each process created is mapped to an underlying operating system process. The first process is created by a program that wishes to host the PAL, which can then create additional subordinate processes by calling CreateProcess
. (CreateProcess
, as with many Win32 APIs, comes in two related flavors: CreateProcessA
for use with ANSI string arguments and CreateProcessW
for use with Unicode string arguments.) The API ensures that the executable file being used is either a valid CLI PE file or else a native executable. If it is a CLI executable, the name of the application launcher, clix
, is prepended to the command line. From there, the Unix PAL uses fork
to create the new process and execve
to launch it, inheriting standard filehandles if requested.
Information about processes is divided between two important ...
Get Shared Source CLI Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.