Problems while setting a process-priority

Hello,
I’m using QNX 6.3 on my embedded PowerPC (MPC8360) and my goal is to test the OS-Performance. I wanted to send data over TCP/IP while I’m running a process which calculates something to get more cpu-load. The sending over TCP/IP is more important so I want to set the priority from this process to 11 instead of 10. So I started it with

nice -n-1 netio ....

But exaclty in this moment only this process gets CPU-Time. QCONN gets disconnected and the terminal doesn’t react on my inputs anymore. After the process is terminated I see the inputs which I had entered while this process was running.
Is this the philosophy of a RealTime OS? ;-)
Anyone know whats wrong?

MasterFx,

I assume you mean you did:

nice --n1 netio

If your netio program is using 100% of the CPU then indeed, qconn will be ‘starved’ for CPU time.

That is expected behavior. QNX (or another other realtime O/S for that matter) doesn’t promise any CPU time to lower priority tasks when higher priority tasks are running.

What you should do if you want to run QCONN and enter inputs while running your netio process is to set QCONN’s priority to 12 (1 more than your netio) so you don’t lose the console. You can do that with ‘renice’ as in

renice -2 -p (QCONN’s pid)

Then when you run netio you won’t lose your console.

If you want low priority tasks to get CPU time when high priority tasks should be running you will need to look at ‘sporadic scheduling’.

Tim

No! I mean -n-1. Abstract of the help:

      If you enter: 	n                        	  ice:
A positive value (e.g. -n2 or -n+2) 	 	Lowers the priority of the program, making it "nice"
A negative value (e.g. -n-2) 	 	 	 	Raises the priority of the program, making it "mean"

I already renice the qconn to priority 14. But when I run my benchmark (calculates some primenumbers) with 11, the console didn’t work either.
When I do

nice -n1 benchmark

eg. benchmark on priority 9 everthing is ok. Renice did the same. I also set ksh to 14. But when I start benchmark on prio 11 nothin else is working anymore (only qconn when on prio 14 works). But when I start netio with prio. 11 my qconn connection is down while running netio.

MasterFx,

I typically don’t use QCONN (I have a monitor/keyboard directly connected to my QNX PC for these kinds of tests). But I suspect there is at least one other process besides QCONN and ksh that is running at priority 10 that needs it’s priority set to 14. That other process is the one now being starved when you run your test at priority 11.

What I’d do, is go into /etc/rc/rc.sysinit (or rc.local) where you start QCONN. There I’d change the initial priorty from the default of 10 to 14 by doing:

qconn qconn_prio=14 child_prio=14 &

That should make all the child processes that QCONN spawns run at the parents priority of 14 (unless they have some built in default priority instead of inheriting one). With luck this will set your missing process to a priority of 14.

Tim

I don’t have any init-skripts. All at default on my embedded system.
The real problem isn’t qconn (i don’t need this for my performance tests). The problem is, if I raise the priority of my benchmark by one I can’t use any other application.
I thought if I raise the priority of one process, this process gets more CPU-Time than all others, but it gets ALL CPU time and the others are not able to react anymore.

MasterFx,

As I mentioned above, that is the expected behavior. You’ve told QNX that this process is more important than everything below it and so it will use as much CPU as possible. If that happens to be 100% of the CPU then every other process with a lower priority will be starved. The O/S has no idea you only want your benchmark to use 99% or 98% or 90% etc of the available CPU.

If the behaviour you want is that the processes below yours priority wise get some CPU then you will need to change to use Sporadic Scheduling instead of FIFO Scheduling. Take a look at Sporadic Scheduling in the HelpViewer to see how to change your benchmark process accordingly.

Tim

Not quite true. Check out the Adaptative Partition System.

Yes it is.

Well, technically Tims answer is true, just not complete :slight_smile:

Within a partition Tims explanation is complete, but with the addition of partitions, there can be some “real-time domains” that are not schedulable, and these domains will not affect the schedulability of other domains in the same instance of the operating system.

I definitely think you are far better of using Adaptive Partitioning rather than sporadic scheduling, since sporadic scheduling is quite difficult to configure properly, whereas Adaptive Partitioning is remarkably easy to configure properly (almost too easy).

Of course, the OP clearly doesn’t understand real-time programming, so they are probably best off believing Tim first, and understanding Adaptive Partitioning second :slight_smile:

Indeed, but for those who can’t afford Adaptive Partitioning sporadic scheduling is the next best thing ;-!

Apparently I need to get outside my QNX comfort zone more! I didn’t realize Adaptive Partitioning existed. Even the advanced Momentic’s IDE course I took at QNX doesn’t mention it (just checked the manuals I got from it) tho the HelpViewer contains all the info one would need.

Mario, when you say ‘can’t afford’ do you mean can’t afford price wise (as in it costs extra to have this feature) or can’t afford overhead wise on the CPU?

Tim

I meant price wise. It’s included in the development kit so you can play with it, but if you want to use it in a run-time system you need to pay for it. Same principle as the SMP TDK.