Multi-Core Programming: Increasing Performance through Software Multithreading

Key Points

This chapter provided an overview of two threading APIs: the Microsoft Windows model, and the POSIX threads (Pthreads) model. When developing applications based on these APIs, you should keep the following points in mind:

  • Multi-threaded applications targeting Microsoft Windows can be written in either native or managed code.

  • Since the CreateThread() function does not perform per-thread initialization of C runtime datablocks and variables, you cannot reliably use CreateThread() in any application that uses the C runtime library. Use _beginthreadex() function instead.

  • Thread termination should be handled very carefully. Avoid using functions such as TerminateThread().

  • Threads can communicate with one another using Events.

  • Thread synchronization may be accomplished through the use of Mutexes, Semaphores, CriticalSections, and Interlocked functions.

  • Thread pool support is built into the API.

  • Windows supports multiple thread-priority levels.

  • Processor affinity is a mechanism that allows the programmer to specify which processor a thread should try to run on.

  • POSIX threads (Pthreads) is a portable threading API that is supported on a number of platforms.

  • Different platforms support different Pthreads capabilities. Features may not be available in all Pthreads environments.

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Threading Dies
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.