Next: , Previous: Specifying a Run-Time Library, Up: Platform-Specific Information for the Run-Time Libraries


A.3 Choosing between Native and FSU Threads Libraries

Some GNAT implementations offer a choice between native threads and FSU threads.

From these considerations, it might seem that FSU threads are the better choice, but that is by no means always the case. The FSU threads package operates with all Ada tasks appearing to the system to be a single thread. This is often considerably more efficient than operating with separate threads, since for example, switching between tasks can be accomplished without the (in some cases considerable) overhead of a context switch between two system threads. However, it means that you may well lose concurrency at the system level. Notably, some system operations (such as I/O) may block all tasks in a program and not just the calling task. More significantly, the FSU threads approach likely means you cannot take advantage of multiple processors, since for this you need separate threads (or even separate processes) to operate on different processors.

For most programs, the native threads library is usually the better choice. Use the FSU threads if absolute conformance to Annex D is important for your application, or if you find that the improved efficiency of FSU threads is significant to you.

Note also that to take full advantage of Florist and Glade, it is highly recommended that you use native threads.