Darius <firstname.lastname@example.org> wrote:
As I know thread in QNX can have priority and scheduling algorithms attached
Yes, and threads are scheduled on a system-wide basis.
But what about processes? I know they can have priority.
Technically, a process doesn’t have a priority. (1)
There is a lot of carry-over from the process as the smallest unit
of execution/scheduling Unix tradition in both POSIX and QNX. There
are a bunch of utilities (e.g. nice, renice) and library routines
(getprio(), setprio()) that modify priority and/or scheduling algorithm
for a process.
If a process has only one thread, that QNX process can be thought of,
and treated as, an old-style-process with priority & scheduling
If a process has more than one thread, then applying the PROCESS
oriented functions/utilities for modifying that process’s priority
or scheduling will result in undefined behaviour. (POSIX does not
expect or require this to do anything sensible.) It is a bad thing
to do. (In fact, under QNX, it will apply the prio/shed changes to
thread 1 in the process, if it exists. If it doesn’t it will probably
apply the change to the lowest numbered thread. I’ve tested the first
behaviour, not the second. But, the behaviour is not a documented
behaviour – you should not depend on it, or expect it to continue that
use the same scheduling algorithms as threads? Can I use the same
priority/shceduling models for processes?
Properly a process doesn’t have either of these. (Properly a process
is a holder of resources such as memory, timers, or open files and one
or more threads.)
In the single thread process case, you can think of thread priority/sched
algorithm and process priority/sched algorithm as being interchangeable.
But, you can ONLY do this in the case of the single-threaded process.
(1) There is, in fact, a priority value stored in the process entry – though
there is no scheduling algorithm stored. This “process” priority is used
to schedule a thread that receives a pulse where the pulse priority has a
value of -1 (PULSE_PRIO_INHERIT in <sys/neutrino.h> I think).
Please follow-up to newsgroup, rather than personal email.
QNX Training Services