Cann't set scheduling policy...

Hi all,

I want to change process default scheduling algrithm RR to FIFO, the
code like this:

setprio( 0, 25 );
sched_setscheduler( 0, SCHED_FIFO, NULL );

and the ‘errno’ indicated “Bad address”, then I chosen other alternative
functions and still has such problem.

Which function can help me change the SCHED??

Thanks in advance.


\

hcchen@ipp.ac.cn
Hichun Chen

“Hichun Chen” <hcchen@mail.ipp.ac.cn> wrote in message
news:b3l11g$423$1@inn.qnx.com

Hi all,

I want to change process default scheduling algrithm RR to FIFO, the
code like this:

snip

setprio( 0, 25 );
sched_setscheduler( 0, SCHED_FIFO, NULL );
/snip

and the ‘errno’ indicated “Bad address”, then I chosen other alternative
functions and still has such problem.

Please read documention, last argument of sched_setscheduler cannot be NULL
( which is why you get Bad address) error. Also don’t use setpri() look at
bottom of doc page for reason why (they are QNX4 function).

I’m curious why do you want to use SCHED_FIFO. If it’s for data protection
that is usually a bad idea to rely on FIFO mode for that as it will break on
SMP machine.

Which function can help me change the SCHED??

Thanks in advance.


\

hcchen@ipp.ac.cn
Hichun Chen

I’m curious why do you want to use SCHED_FIFO. If it’s for data
protection
that is usually a bad idea to rely on FIFO mode for that as it will break
on
SMP machine.

ok, that is my careless in using sched_setscheduler() function.

My application focus on realtime control field, why cann’t use SCHED_FIFO to
replace system default policy(RR) or other scheduling policy(Adaptive,
Sporadic)???

“Hichun Chen” <hcchen@mail.ipp.ac.cn> wrote in message
news:b3qhhq$b0h$1@inn.qnx.com

snip

I’m curious why do you want to use SCHED_FIFO. If it’s for data
protection
that is usually a bad idea to rely on FIFO mode for that as it will
break
on
SMP machine.


ok, that is my careless in using sched_setscheduler() function.

My application focus on realtime control field, why cann’t use SCHED_FIFO
to
replace system default policy(RR) or other scheduling policy(Adaptive,
Sporadic)???

I’m not saying you can’t use SCHED_FIFO. What I meant to say is very often
people use SCHED_FIFO for the wrong reasons (ensure data protection). Main
issue with SCHED_FIFO is it’s doesn’t really work on SMP since two processes
of same priority can run at same time.

If you want a better answer specify why you want/need to use FIFO mode.


hcchen@ipp.ac.cn
Hichun Chen
“Mario Charest” postmaster@127.0.0.1 wrote in message
news:b3ruor$qie$1@inn.qnx.com

“Hichun Chen” <> hcchen@mail.ipp.ac.cn> > wrote in message
news:b3qhhq$b0h$> 1@inn.qnx.com> …
snip

I’m curious why do you want to use SCHED_FIFO. If it’s for data
protection
that is usually a bad idea to rely on FIFO mode for that as it will
break
on
SMP machine.


ok, that is my careless in using sched_setscheduler() function.

My application focus on realtime control field, why cann’t use
SCHED_FIFO
to
replace system default policy(RR) or other scheduling policy(Adaptive,
Sporadic)???

I’m not saying you can’t use SCHED_FIFO. What I meant to say is very often
people use SCHED_FIFO for the wrong reasons (ensure data protection).
Main
issue with SCHED_FIFO is it’s doesn’t really work on SMP since two
processes
of same priority can run at same time.

If you want a better answer specify why you want/need to use FIFO mode.

:slight_smile:

On other hand,I’m wondering why cann’t specify other scheduling policy
except RR and FIFO by programmer,since QNX support Adaptive and Sporadic
policy.

The result of running ‘pidin’ doesn’t indicated any process or thread under
Adaptive and Sporadic scheduling algrithm, so I am curious where these
policy been used.

“Hichun Chen” <hcchen@mail.ipp.ac.cn> wrote in message
news:b3scfb$al6$1@inn.qnx.com


hcchen@ipp.ac.cn
Hichun Chen
“Mario Charest” postmaster@127.0.0.1 wrote in message
news:b3ruor$qie$> 1@inn.qnx.com> …

“Hichun Chen” <> hcchen@mail.ipp.ac.cn> > wrote in message
news:b3qhhq$b0h$> 1@inn.qnx.com> …
snip

I’m curious why do you want to use SCHED_FIFO. If it’s for data
protection
that is usually a bad idea to rely on FIFO mode for that as it will
break
on
SMP machine.


ok, that is my careless in using sched_setscheduler() function.

My application focus on realtime control field, why cann’t use
SCHED_FIFO
to
replace system default policy(RR) or other scheduling policy(Adaptive,
Sporadic)???

I’m not saying you can’t use SCHED_FIFO. What I meant to say is very
often
people use SCHED_FIFO for the wrong reasons (ensure data protection).
Main
issue with SCHED_FIFO is it’s doesn’t really work on SMP since two
processes
of same priority can run at same time.

If you want a better answer specify why you want/need to use FIFO mode.


:slight_smile:

On other hand,I’m wondering why cann’t specify other scheduling policy
except RR and FIFO by programmer,since QNX support Adaptive and Sporadic
policy.

The result of running ‘pidin’ doesn’t indicated any process or thread
under
Adaptive and Sporadic scheduling algrithm, so I am curious where these
policy been used.

As far as I know they are not use by any program in QNX6.