Scheduling Question

Hello,

I’am now testing the Posix scheduling function on Qnx. But when I fork
two process with priority 30 and Fifo agorithm they execute themself
alternatively. I think the right way should be one process till completion
then the other one till completion.

Please help me… :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first one printf AAAAA
and the second one CCCCC) in it → no blocking instructions.

The result I get is:

AAAAA
CCCCC
AAAAA
CCCCC
AAAAA
CCCCC
AAAAA

Hercot Jean-Yves <fa063821@skynet.be> wrote:

Hello,

I’am now testing the Posix scheduling function on Qnx. But when I fork
two process with priority 30 and Fifo agorithm they execute themself
alternatively. I think the right way should be one process till completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first one printf AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is responsible
for stdout. Therefore, you are causing a rescheduling event to happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at www.parse.com.

I have tried with write on file desc. 2 and it’s also the same. What should
I use to print something on the screen without calling the scheduler?
(maybe a trace in a log file?)

“Robert Krten” <rk@parse.com> a écrit dans le message de news:
b5sar1$es7$1@inn.qnx.com

Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
Hello,

I’am now testing the Posix scheduling function on Qnx. But when I
fork
two process with priority 30 and Fifo agorithm they execute themself
alternatively. I think the right way should be one process till
completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first one printf
AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is responsible
for stdout. Therefore, you are causing a rescheduling event to happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .

Hercot Jean-Yves <fa063821@skynet.be> wrote:

I have tried with write on file desc. 2 and it’s also the same. What should
I use to print something on the screen without calling the scheduler?
(maybe a trace in a log file?)

Nothing. The only way to print something to the screen without rescheduling
(i.e., without “sending a message”) would be to access the screen memory
directly and store your characters there. This is not recommended.
Same thing with putting anything to a file – you are sending a message
to the filesystem.

Why do you need to print something in the middle of a FIFO test?
If all you want to do is verify that the other thread is not running
then you might be able to take time snapshots (using ClockCycles, perhaps)
and compare them after the two programs have finished. One program should
show a start and end time that is outside of the other program’s start and
end time range.

Cheers,
-RK

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sar1$es7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
Hello,

I’am now testing the Posix scheduling function on Qnx. But when I
fork
two process with priority 30 and Fifo agorithm they execute themself
alternatively. I think the right way should be one process till
completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first one printf
AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is responsible
for stdout. Therefore, you are causing a rescheduling event to happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at www.parse.com.

Ok I’ll try that and post the result here as soon as possible.

Thanx

“Robert Krten” <rk@parse.com> a écrit dans le message de news:
b5sbqj$fg7$1@inn.qnx.com

Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried with write on file desc. 2 and it’s also the same. What
should
I use to print something on the screen without calling the scheduler?
(maybe a trace in a log file?)

Nothing. The only way to print something to the screen without
rescheduling
(i.e., without “sending a message”) would be to access the screen memory
directly and store your characters there. This is not recommended.
Same thing with putting anything to a file – you are sending a message
to the filesystem.

Why do you need to print something in the middle of a FIFO test?
If all you want to do is verify that the other thread is not running
then you might be able to take time snapshots (using ClockCycles, perhaps)
and compare them after the two programs have finished. One program
should
show a start and end time that is outside of the other program’s start and
end time range.

Cheers,
-RK

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sar1$es7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
Hello,

I’am now testing the Posix scheduling function on Qnx. But when
I
fork
two process with priority 30 and Fifo agorithm they execute themself
alternatively. I think the right way should be one process till
completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first one
printf
AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is
responsible
for stdout. Therefore, you are causing a rescheduling event to happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .

Instead of “printf()”, you can have both process write some mark into
same memory space, and dump out the memory space later.

This is easy if you scheduling 2 threads, but since you are doing “fork()”,
this will involve pre-allocate shared memory, locking while writing…
In this case (2 process), log running time and dump it might be
easier.

-xtang

Hercot Jean-Yves <fa063821@skynet.be> wrote in message
news:b5scb1$ggg$1@inn.qnx.com

Ok I’ll try that and post the result here as soon as possible.

Thanx

“Robert Krten” <> rk@parse.com> > a écrit dans le message de news:
b5sbqj$fg7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried with write on file desc. 2 and it’s also the same. What
should
I use to print something on the screen without calling the scheduler?
(maybe a trace in a log file?)

Nothing. The only way to print something to the screen without
rescheduling
(i.e., without “sending a message”) would be to access the screen memory
directly and store your characters there. This is not recommended.
Same thing with putting anything to a file – you are sending a message
to the filesystem.

Why do you need to print something in the middle of a FIFO test?
If all you want to do is verify that the other thread is not running
then you might be able to take time snapshots (using ClockCycles,
perhaps)
and compare them after the two programs have finished. One program
should
show a start and end time that is outside of the other program’s start
and
end time range.

Cheers,
-RK

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sar1$es7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
Hello,

I’am now testing the Posix scheduling function on Qnx. But
when
I
fork
two process with priority 30 and Fifo agorithm they execute
themself
alternatively. I think the right way should be one process till
completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first one
printf
AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is
responsible
for stdout. Therefore, you are causing a rescheduling event to
happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .

Hercot Jean-Yves <fa063821@skynet.be> wrote:

I have tried without printf (using a shm) and it works perfectly (thanks you
all for your help). Now I have to try the same process just changing the
policy to SCHED_RR. And again it doesn’t work. > :frowning: > In fact the execution
is exactly the same than for SCHED_FIFO. I thought it was because the time
slice never happen but even if my process execute during a long time there
is no scheduling… :’(

Have you got an idea? > :slight_smile:

How do you know it doesn’t work? I.e., what’s the testcase?

Cheers,
-RK

“Xiaodan Tang” <> xtang@qnx.com> > a ecrit dans le message news:
b5se3s$bi7$> 1@nntp.qnx.com> …
Instead of “printf()”, you can have both process write some mark into
same memory space, and dump out the memory space later.

This is easy if you scheduling 2 threads, but since you are doing
“fork()”,
this will involve pre-allocate shared memory, locking while writing…
In this case (2 process), log running time and dump it might be
easier.

-xtang

Hercot Jean-Yves <> fa063821@skynet.be> > wrote in message
news:b5scb1$ggg$> 1@inn.qnx.com> …
Ok I’ll try that and post the result here as soon as possible.

Thanx

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sbqj$fg7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried with write on file desc. 2 and it’s also the same.
What
should
I use to print something on the screen without calling the
scheduler?
(maybe a trace in a log file?)

Nothing. The only way to print something to the screen without
rescheduling
(i.e., without “sending a message”) would be to access the screen
memory
directly and store your characters there. This is not recommended.
Same thing with putting anything to a file – you are sending a
message
to the filesystem.

Why do you need to print something in the middle of a FIFO test?
If all you want to do is verify that the other thread is not running
then you might be able to take time snapshots (using ClockCycles,
perhaps)
and compare them after the two programs have finished. One program
should
show a start and end time that is outside of the other program’s start
and
end time range.

Cheers,
-RK

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sar1$es7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
Hello,

I’am now testing the Posix scheduling function on Qnx. But
when
I
fork
two process with priority 30 and Fifo agorithm they execute
themself
alternatively. I think the right way should be one process till
completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first one
printf
AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is
responsible
for stdout. Therefore, you are causing a rescheduling event to
happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and
Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .

\


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at www.parse.com.

I have tried without printf (using a shm) and it works perfectly (thanks you
all for your help). Now I have to try the same process just changing the
policy to SCHED_RR. And again it doesn’t work. :frowning: In fact the execution
is exactly the same than for SCHED_FIFO. I thought it was because the time
slice never happen but even if my process execute during a long time there
is no scheduling… :’(

Have you got an idea? :slight_smile:

“Xiaodan Tang” <xtang@qnx.com> a écrit dans le message news:
b5se3s$bi7$1@nntp.qnx.com

Instead of “printf()”, you can have both process write some mark into
same memory space, and dump out the memory space later.

This is easy if you scheduling 2 threads, but since you are doing
“fork()”,
this will involve pre-allocate shared memory, locking while writing…
In this case (2 process), log running time and dump it might be
easier.

-xtang

Hercot Jean-Yves <> fa063821@skynet.be> > wrote in message
news:b5scb1$ggg$> 1@inn.qnx.com> …
Ok I’ll try that and post the result here as soon as possible.

Thanx

“Robert Krten” <> rk@parse.com> > a écrit dans le message de news:
b5sbqj$fg7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried with write on file desc. 2 and it’s also the same.
What
should
I use to print something on the screen without calling the
scheduler?
(maybe a trace in a log file?)

Nothing. The only way to print something to the screen without
rescheduling
(i.e., without “sending a message”) would be to access the screen
memory
directly and store your characters there. This is not recommended.
Same thing with putting anything to a file – you are sending a
message
to the filesystem.

Why do you need to print something in the middle of a FIFO test?
If all you want to do is verify that the other thread is not running
then you might be able to take time snapshots (using ClockCycles,
perhaps)
and compare them after the two programs have finished. One program
should
show a start and end time that is outside of the other program’s start
and
end time range.

Cheers,
-RK

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sar1$es7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
Hello,

I’am now testing the Posix scheduling function on Qnx. But
when
I
fork
two process with priority 30 and Fifo agorithm they execute
themself
alternatively. I think the right way should be one process till
completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first one
printf
AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is
responsible
for stdout. Therefore, you are causing a rescheduling event to
happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and
Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .
\

In fact both process do a while loop (1000 or 10000 times) where they put a
letter in the shm (‘A’ for the first one and ‘C’ for the second one). When
the process have finished I print the content of the shm on the screen and
the result is the same than with Fifo policy.

→ A
A
A
A

C
C
C
C

→ it’s like the process have never pre-empted by time slice.

“Robert Krten” <rk@parse.com> a écrit dans le message de news:
b5svii$ei1$1@inn.qnx.com

Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried without printf (using a shm) and it works perfectly (thanks
you
all for your help). Now I have to try the same process just changing
the
policy to SCHED_RR. And again it doesn’t work. > :frowning: > In fact the
execution
is exactly the same than for SCHED_FIFO. I thought it was because the
time
slice never happen but even if my process execute during a long time
there
is no scheduling… :’(

Have you got an idea? > :slight_smile:

How do you know it doesn’t work? I.e., what’s the testcase?

Cheers,
-RK

“Xiaodan Tang” <> xtang@qnx.com> > a ecrit dans le message news:
b5se3s$bi7$> 1@nntp.qnx.com> …
Instead of “printf()”, you can have both process write some mark into
same memory space, and dump out the memory space later.

This is easy if you scheduling 2 threads, but since you are doing
“fork()”,
this will involve pre-allocate shared memory, locking while writing…
In this case (2 process), log running time and dump it might be
easier.

-xtang

Hercot Jean-Yves <> fa063821@skynet.be> > wrote in message
news:b5scb1$ggg$> 1@inn.qnx.com> …
Ok I’ll try that and post the result here as soon as possible.

Thanx

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sbqj$fg7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried with write on file desc. 2 and it’s also the same.
What
should
I use to print something on the screen without calling the
scheduler?
(maybe a trace in a log file?)

Nothing. The only way to print something to the screen without
rescheduling
(i.e., without “sending a message”) would be to access the screen
memory
directly and store your characters there. This is not recommended.
Same thing with putting anything to a file – you are sending a
message
to the filesystem.

Why do you need to print something in the middle of a FIFO test?
If all you want to do is verify that the other thread is not
running
then you might be able to take time snapshots (using ClockCycles,
perhaps)
and compare them after the two programs have finished. One
program
should
show a start and end time that is outside of the other program’s
start
and
end time range.

Cheers,
-RK

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sar1$es7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
Hello,

I’am now testing the Posix scheduling function on Qnx.
But
when
I
fork
two process with priority 30 and Fifo agorithm they execute
themself
alternatively. I think the right way should be one process
till
completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first
one
printf
AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is
responsible
for stdout. Therefore, you are causing a rescheduling event to
happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and
Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and
Instructor-led
Training, Consulting and Software Products at > www.parse.com> .






\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .

Hercot Jean-Yves <fa063821@skynet.be> wrote:

In fact both process do a while loop (1000 or 10000 times) where they put a
letter in the shm (‘A’ for the first one and ‘C’ for the second one). When
the process have finished I print the content of the shm on the screen and
the result is the same than with Fifo policy.

→ A
A
A
A

C
C
C
C

→ it’s like the process have never pre-empted by time slice.

How long do the processes run? The time slice is 50ms, so you’d want
to run them for at least a few hundred ms…

Also, are you sure that they are running RR? Do a “pidin” and
see if the state is “R” instead of “F”

Cheers,
-RK


“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5svii$ei1$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried without printf (using a shm) and it works perfectly (thanks
you
all for your help). Now I have to try the same process just changing
the
policy to SCHED_RR. And again it doesn’t work. > :frowning: > In fact the
execution
is exactly the same than for SCHED_FIFO. I thought it was because the
time
slice never happen but even if my process execute during a long time
there
is no scheduling… :’(

Have you got an idea? > :slight_smile:

How do you know it doesn’t work? I.e., what’s the testcase?

Cheers,
-RK

“Xiaodan Tang” <> xtang@qnx.com> > a ecrit dans le message news:
b5se3s$bi7$> 1@nntp.qnx.com> …
Instead of “printf()”, you can have both process write some mark into
same memory space, and dump out the memory space later.

This is easy if you scheduling 2 threads, but since you are doing
“fork()”,
this will involve pre-allocate shared memory, locking while writing…
In this case (2 process), log running time and dump it might be
easier.

-xtang

Hercot Jean-Yves <> fa063821@skynet.be> > wrote in message
news:b5scb1$ggg$> 1@inn.qnx.com> …
Ok I’ll try that and post the result here as soon as possible.

Thanx

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sbqj$fg7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried with write on file desc. 2 and it’s also the same.
What
should
I use to print something on the screen without calling the
scheduler?
(maybe a trace in a log file?)

Nothing. The only way to print something to the screen without
rescheduling
(i.e., without “sending a message”) would be to access the screen
memory
directly and store your characters there. This is not recommended.
Same thing with putting anything to a file – you are sending a
message
to the filesystem.

Why do you need to print something in the middle of a FIFO test?
If all you want to do is verify that the other thread is not
running
then you might be able to take time snapshots (using ClockCycles,
perhaps)
and compare them after the two programs have finished. One
program
should
show a start and end time that is outside of the other program’s
start
and
end time range.

Cheers,
-RK

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sar1$es7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
Hello,

I’am now testing the Posix scheduling function on Qnx.
But
when
I
fork
two process with priority 30 and Fifo agorithm they execute
themself
alternatively. I think the right way should be one process
till
completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first
one
printf
AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is
responsible
for stdout. Therefore, you are causing a rescheduling event to
happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and
Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and
Instructor-led
Training, Consulting and Software Products at > www.parse.com> .






\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at www.parse.com.

Hercot Jean-Yves <fa063821@skynet.be> wrote:

In fact both process do a while loop (1000 or 10000 times) where they put a
letter in the shm (‘A’ for the first one and ‘C’ for the second one). When
the process have finished I print the content of the shm on the screen and
the result is the same than with Fifo policy.

Can you post the actual code?

Also, ticksize defaults to 4ms – you may be completing your entire
loop before you get to be timesliced out.

Grab a ClockCycles() value before your loop, and afterwards as well
in each process, and print out the value, and the difference (they
are 64-bit values). (You may also want to print out cycles per second
from the system page – or know that on Pentium class machines and
above know that it is, essentially, your CPU speed.)

Then look at how long your loops take to run – they probably take
less than 4 ms.

-David

→ A
A
A
A

C
C
C
C

→ it’s like the process have never pre-empted by time slice.

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5svii$ei1$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried without printf (using a shm) and it works perfectly (thanks
you
all for your help). Now I have to try the same process just changing
the
policy to SCHED_RR. And again it doesn’t work. > :frowning: > In fact the
execution
is exactly the same than for SCHED_FIFO. I thought it was because the
time
slice never happen but even if my process execute during a long time
there
is no scheduling… :’(

Have you got an idea? > :slight_smile:

How do you know it doesn’t work? I.e., what’s the testcase?

Cheers,
-RK

“Xiaodan Tang” <> xtang@qnx.com> > a ecrit dans le message news:
b5se3s$bi7$> 1@nntp.qnx.com> …
Instead of “printf()”, you can have both process write some mark into
same memory space, and dump out the memory space later.

This is easy if you scheduling 2 threads, but since you are doing
“fork()”,
this will involve pre-allocate shared memory, locking while writing…
In this case (2 process), log running time and dump it might be
easier.

-xtang

Hercot Jean-Yves <> fa063821@skynet.be> > wrote in message
news:b5scb1$ggg$> 1@inn.qnx.com> …
Ok I’ll try that and post the result here as soon as possible.

Thanx

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sbqj$fg7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
I have tried with write on file desc. 2 and it’s also the same.
What
should
I use to print something on the screen without calling the
scheduler?
(maybe a trace in a log file?)

Nothing. The only way to print something to the screen without
rescheduling
(i.e., without “sending a message”) would be to access the screen
memory
directly and store your characters there. This is not recommended.
Same thing with putting anything to a file – you are sending a
message
to the filesystem.

Why do you need to print something in the middle of a FIFO test?
If all you want to do is verify that the other thread is not
running
then you might be able to take time snapshots (using ClockCycles,
perhaps)
and compare them after the two programs have finished. One
program
should
show a start and end time that is outside of the other program’s
start
and
end time range.

Cheers,
-RK

“Robert Krten” <> rk@parse.com> > a ecrit dans le message de news:
b5sar1$es7$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
Hello,

I’am now testing the Posix scheduling function on Qnx.
But
when
I
fork
two process with priority 30 and Fifo agorithm they execute
themself
alternatively. I think the right way should be one process
till
completion
then the other one till completion.

Please help me… > :slight_smile:

Thanx

Ps: the process just do a while loop with printf (the first
one
printf
AAAAA
and the second one CCCCC) in it → no blocking instructions.

printf() is a blocking call. It sends a message to whoever is
responsible
for stdout. Therefore, you are causing a rescheduling event to
happen.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and
Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and
Instructor-led
Training, Consulting and Software Products at > www.parse.com> .






\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at > www.parse.com> .


QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

“Robert Krten” <rk@parse.com> wrote in message
news:b5uqf9$5ft$1@inn.qnx.com

Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
In fact both process do a while loop (1000 or 10000 times) where they
put a
letter in the shm (‘A’ for the first one and ‘C’ for the second one).
When
the process have finished I print the content of the shm on the screen
and
the result is the same than with Fifo policy.

→ A
A
A
A

C
C
C
C

→ it’s like the process have never pre-empted by time slice.

How long do the processes run? The time slice is 50ms, so you’d want
to run them for at least a few hundred ms…

timeslice is 4*ticksize in QNX6

Igor Kovalenko <kovalenko@attbi.com> wrote:

“Robert Krten” <> rk@parse.com> > wrote in message
news:b5uqf9$5ft$> 1@inn.qnx.com> …
Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
In fact both process do a while loop (1000 or 10000 times) where they
put a
letter in the shm (‘A’ for the first one and ‘C’ for the second one).
When
the process have finished I print the content of the shm on the screen
and
the result is the same than with Fifo policy.

→ A
A
A
A

C
C
C
C

→ it’s like the process have never pre-empted by time slice.

How long do the processes run? The time slice is 50ms, so you’d want
to run them for at least a few hundred ms…

D’oh! :slight_smile:

Thanks, Igor.

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training, Consulting and Software Products at www.parse.com.