priorities in resmngr

Hello,

I’m writing a simple resource manager. In main() I create some other thread
to do all other work not related to IO messages. After starting thread in
main() I do some printf. So if thread’s prity is 10 of below everything is
ok, printf works just fine. But if thread’s priority is above 10 (10 is main
thread’s priority), then printf do not print anythin, but handling IO
messages work. Why? Handling all resource manager’s stuff is done when
thread is started, so if thread’s priority is higher and scheduling policy
is FIFO, so no main() functions could take any processors time.
It was very hard for me to explain in english so if you do not understand my
question I will try again :slight_smile:

Best regards,
Darius

Darius <alpha_byte@safe-mail.net> wrote:
D > Hello,

D > I’m writing a simple resource manager. In main() I create some other thread
D > to do all other work not related to IO messages. After starting thread in
D > main() I do some printf. So if thread’s prity is 10 of below everything is
D > ok, printf works just fine. But if thread’s priority is above 10 (10 is main
D > thread’s priority), then printf do not print anythin, but handling IO
D > messages work. Why? Handling all resource manager’s stuff is done when
D > thread is started, so if thread’s priority is higher and scheduling policy
D > is FIFO, so no main() functions could take any processors time.
D > It was very hard for me to explain in english so if you do not understand my
D > question I will try again :slight_smile:

D > Best regards,
D > Darius


Hi Darius

I’m sorry I don’t understand your problem well enough.

Don’t be afraid to post in your native language. Many people do.
Someone out there will be able to read it. You might try including both
languages in the same post.

Hello,

Don’t be afraid to post in your native language. Many people do.
Someone out there will be able to read it. You might try including both
languages in the same post.

I don’t believe that there is some people understanding lithuanian :slight_smile:)) lets
talk in C:

here I have my resource manager

main()
{

// there I create some thread with scheduling policy FIFO and some priority

printf(“I get there”);

// here goes all stuff for resource manager (attaching name, etc till
dispatch loop)
}

so main() priority is 10 is I run it from shell. If thread that I am
creating has priority <=10 than I get message “I get there” in the shell. If
thread’s priority is >10 then I get no message. I suppose printf isn’t
executing. But all resource manager works just fine: it manages my custom
IO_READ requests so dispatch loop is working. Question: why dispatch loop is
working, but printf isn’t?
Hope you’ll understand


Best regards,
Darius

“Darius” <alpha1@takas.lt> wrote in message news:ckhj2m$7q4$1@inn.qnx.com

Hello,

Don’t be afraid to post in your native language. Many people do.
Someone out there will be able to read it. You might try including both
languages in the same post.

I don’t believe that there is some people understanding lithuanian > :slight_smile:> ))
lets talk in C:

here I have my resource manager

main()
{

// there I create some thread with scheduling policy FIFO and some
priority

printf(“I get there”);

You should have a “\n” otherwise data doesn’t get flush but stays in buffer
until buffer is full.

// here goes all stuff for resource manager (attaching name, etc till
dispatch loop)
}

so main() priority is 10 is I run it from shell. If thread that I am
creating has priority <=10 than I get message “I get there” in the shell.
If thread’s priority is >10 then I get no message. I suppose printf isn’t
executing. But all resource manager works just fine: it manages my custom
IO_READ requests so dispatch loop is working. Question: why dispatch loop
is working, but printf isn’t?

Hope you’ll understand



Best regards,
Darius

Darius <alpha1@takas.lt> wrote:

Hello,

Don’t be afraid to post in your native language. Many people do.
Someone out there will be able to read it. You might try including both
languages in the same post.

I don’t believe that there is some people understanding lithuanian > :slight_smile:> )) lets
talk in C:

here I have my resource manager

main()
{

// there I create some thread with scheduling policy FIFO and some priority

What does this thread do? If this thread doesn’t block (wait for
message, interrupt, or something else) it will use 100% of the CPU
time. If it is at a higher priority than 10, the rest of the resource
manager will never get scheduled, it will always be pre-empted by this
higher-priority thread.

That sounds like what is happening – but without knowing what is in
that thread, it is hard to say for sure.

-David


printf(“I get there”);

// here goes all stuff for resource manager (attaching name, etc till
dispatch loop)
}

so main() priority is 10 is I run it from shell. If thread that I am
creating has priority <=10 than I get message “I get there” in the shell. If
thread’s priority is >10 then I get no message. I suppose printf isn’t
executing. But all resource manager works just fine: it manages my custom
IO_READ requests so dispatch loop is working. Question: why dispatch loop is
working, but printf isn’t?
Hope you’ll understand



Best regards,
Darius


David Gibbs
QNX Training Services
dagibbs@qnx.com

Hello,

Thank you for helping me out. I found that the problem was flushing
buffer :slight_smile:) I used printf without \n, but if threads priority was <10
then I got message printed even without \n, if priority of thread was

10 printf didnt worked. My thread simply prints some text. When I used
while(1) in the thread with priority >10 all system hanged up > :slight_smile:> )) I

know why :slight_smile:
So thank you for clear answer and sorry for my english.

Darius

alpha <alpha1@takas.lt> wrote:
a > Hello,

a > Thank you for helping me out. I found that the problem was flushing
a > buffer :slight_smile:) I used printf without \n, but if threads priority was <10
a > then I got message printed even without \n, if priority of thread was

10 printf didnt worked. My thread simply prints some text. When I used
a > while(1) in the thread with priority >10 all system hanged up > :slight_smile:> )) I

a > know why :slight_smile:
a > So thank you for clear answer and sorry for my english.

a > Darius

It seems like you have a high priority CPU loop. Try putting some kind
of delay in your loop. I.E.

while(1)
{
// do the important stuff
delay( 1 );
}

Of course in a multi-tasking OS like QNX what you really want to do it to
wait for some kind of external exenv of signal. That way your no
spinning your wheels at a high priority unless there really is work to
be done.