QNX provides both POSIX processes and POSIX threads. So, the process management is the responsible for the process creation and destruction as well as the management of process attributes.
QNX realizes the POSIX processes creation and destruction, basically, using these POSIX functions: spawn(), fork() and exec().
Moreover, QNX provides other non-POSIX functions. These primitives are: spawnl(), spawnle(), spawnlp(), spawnlpe(), spawnp(), spawnv(), spawnve(), spawnvp(), spawnvpe(), execlpe() and execvpe().
The QNX microkernel provides the following scheduling algorithms:
FIFO scheduling:
Round-Robin scheduling:
Adaptive scheduling: A thread behaves as follows:
If the thread consumes its timeslice, its priority is reduced by 1. Note that it will only drop one level below its original priority.
If the threads blocks, it inmediately comes back to its original priority.
Sporadic scheduling: Essentially, this algorithm allows a thread to service aperiodic events without exposing the hard deadlines of other threads or processes in the system.
QNX does not provide functions to implement directly periodic threads. Therefore, it is necessary to use timers calls to perform this functioning. Moreover, using timers, the following notification types may be used: signal, pulses and thread creation.
Each thread can have a range of priorities from 0 to 31 (the highest priority), independently of the scheduling policy. The special idle thread (in the process manager) has priority 0 and is always ready to run. Moreover, a thread have a real priority and a effective priority, and it is scheduled in accordance with its effective priority.
There is no limit thread creation in the same process, except the memory space, of course.
QNX provides a full-POSIX API for managing the thread creation and deletion. The following table shows these functions as well as the microkernel primitives used by these routines:
Table 11-1. Thread creation and deletion calls
POSIX call | Microkernel call | Description |
---|---|---|
pthread_create() | ThreadCreate() | Create a new thread of execution. |
pthread_exit() | ThreadDestroy() | Destroy a thread. |
pthread_cancel() | ThreadCancel() | Cancel a thread at the next cancellation point. |
pthread_detach() | ThreadDetach() | Detach a thread so it doesn't need to be joined. |
pthread_join() | ThreadJoin() | Join a thread waiting for its exit status. |