Skip to content

Add functionality for automatically assigning priorities to PDs #7

@JE-Archer

Description

@JE-Archer

Almost all of the time, a system designer does not care about the specific integer values of each PD priority, because it has no functional significance. It's more of an implementation detail of the kernel which is exposed to userspace for performance reasons. What a system designer actually cares about is the ordering of priorities of components. We want PD_a to be higher priority than PD_b, but we don't care at all whether the actual integers are (254, 0), (2, 1) or (70, 30). Having to assign integers to each component forces the designer to operate on a level of detail only the computer cares about and make decisions where they are not necessary, as well as making it harder to tell whether a system is correct or to update it.

We should try to figure out a way of expressing what actually matters, which is the ordering of priorities between components. We could have a data structure that works as a set of constraints, as well as a method to solve the constraints and actually assign the integer priorities.

We also need to allow subsystems to provide information about their priority ordering constraints, which can then be composed with such information from other subsystems and from the system designer to create the full set of constraints which can be solved.

What would be required is some kind of data structure that can record constraints and be merged with other instances of the same data structure:

class ConstraintSet {
    method AddGreaterThanConstraint(PD a, PD b)
    method AddEqualConstraint(PD a, PD b)
    method AddGreaterThanOrEqual(PD a, PD b)
}

function MergeConstraints(ConstraintSet a, ConstraintSet b) -> ConstraintSet

Then we can imagine composing a system like this:

constraints.add_gt_constraint(client0, client1)

net_constraints = net_system.connect()
serial_constraints = serial_system.connect()

constraints = merge_priority_constraints(constraints, net_constraints)
constraints = merge_priority_constraints(constraints, serial_constraints)

if not constraints.solve():
    print("contradictory priority constraints")
    sys.exit()

constraints.assign_priorities()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions