Bankruptcy

Bankruptcy occurs when the critical CPU time billed to a partition exceeds its critical budget.

Note: The System partition's critical budget is infinite; this partition can never become bankrupt.

It's very important that you test your system under a full load to ensure that everything works correctly, in particular to ensure that you've chosen the correct critical budgets. One method to verify this is to start a while(1) thread in each partition to consume all available time.

Bankruptcy is always considered to be a design error on the part of the application, but the system's response is configurable. QNX Neutrino lets you set a recovery policy. The options are:

Basic (the default)
Deliver bankruptcy-notification events and make the partition out-of-budget for the rest of the scheduling window.

If you want to be notified of a bankruptcy, set up a sigevent as appropriate, and then register it by calling procmgr_event_notify() or procmgr_event_notify_add() with the PROCMGR_EVENT_APS_BANKRUPTCY flag.

When a partition runs out of critical budget, isn't allowed to run again until it receives more budget, i.e., the sliding-averaging window recalculates that partition's average CPU consumption to be a bit less than its configured CPU budget. After bankruptcy, enough time must pass for the calculated average CPU time of the partition to fall to its configured budget. At the very least, this means that a number of milliseconds equal to the critical budget must pass before that partition is scheduled again.

Cancel
The cancel option causes the bankrupt partition's critical budget to be set to zero. That prevents it from running as critical until you restore its critical budget, either through the SCHED_APS_MODIFY_PARTITION command to the SchedCtl() function, or through the -B option to the aps modify command.
Force a reboot
Make the system crash, with a brief message identifying the offending partition. This is intended for your regression testing.

You can set the bankruptcy policy with the aps utility (see the Utilities Reference) or the SCHED_APS_SET_PARMS command to SchedCtl() (see the QNX Neutrino C Library Reference).