Budgets

The operation is quick and doesn't reset the scheduler or cause any change to the partition's history of CPU usage that is stored in the averaging window.

However, if you change the budget of a partition from 90% to 10%, the partition could suddenly become over budget. In this situation, the partition may not run again until enough window rotations have occurred to lower the partition's used cycles below its budget.

When does a change in budgets take effect?

A change in budget takes effect at the next tick interrupt or next scheduling operation i.e. typically, in less than one millisecond.

What is a partition with zero budget?

Threads in a partition with a defined budget of zero runs if all nonzero partitions are sleeping. These threads also run if they inherit the partition of thread that sends a message. Zero-budget partitions are most useful for resource managers with no internal daemon threads. They're also useful for turning off unused partitions.

How does the scheduler guarantee that the sum of all partitions' budgets is 100%?

At startup, QNX Neutrino creates the first partition (the System partition) with a budget of 100%. Thereafter, when a thread running in a partition creates a new partition, the current partition is considered as the parent and the new partition is the child. The budget of the child is always taken from the budget of the parent, and may never reduce the parent's budget below zero. So creating partitions produces a hierarchy of partitions that subdivide the System's original budget of 100%.

How does the scheduler prevent an untrusted thread from increasing its partition's budget?

For any change to occur, the scheduler partition security would have to be:

unlocked to permit budget changes

set to permit processes that don't have the PROCMGR_AID_APS_ROOT ability enabled to modify budgets

set to permit a partition to modify its own budget (usually only the parent can modify a partition's budget)

Note that a thread in a partition can't increase its budget more than the budget of its parent partition.

How can I cheat to exceed my partition's budget?

You can:

change the window size often

provide your partition an infinite critical budget and set yourself to run as critical

Note:
In order to do either of these, you must have the PROCMGR_AID_APS_ROOT ability enabled,
unlock the scheduler partition configuration and turn off the scheduler partition security.

The following ideas look promising, but:

Giving your own partition more budget (it can't exceed its parent's, even if security is off).

Setting your thread priority to 255 (you can starve everything else in your partition, but not another partition).

Setting your thread policy to FIFO and loop (you can starve everything else in your partition, but not another partition.)