Creating Threads

The preparation and dispatching of secondary threads within applications is greatly simplified under OS/2 Version 2.0. Under previous versions of OS/2, the application was required to explicitly allocate and deallocate memory for the stack segment of a secondary thread. Version 2.0 allows the operating system to perform the allocation of the stack memory object on the application's behalf as part of the DosCreateThread() function, and to free the stack segment when the thread terminates. The application need only specify the required size of the segment in the DosCreateThread() call.

OS/2 Version 2.0 uses the guard page technique described in Memory Management to progressively commit each thread's stack during execution, up to the maximum size specified in the DosCreateThread() function. This minimizes the real storage requirement of the stack, makes the most efficient use of available real storage, and thereby improves overall system performance.


[Back: Thread Management]
[Next: Controlling Threads]