cubesatlab / cubedos

A flight software framework in SPARK/Ada
48 stars 5 forks source link

Mailbox Sizes #49

Open Eric-Edlund opened 1 year ago

Eric-Edlund commented 1 year ago

Current behavior is that modules choose the size of their mailbox at system startup. The size of the module mailbox is decided by the module alone. I thought this was a good idea at the time, but I was just reading through the design docs and read the following argument:

the author of a module can't know the maximum number of pending messages that are appropriate to specify for that module. The correct number is a system-wide artifact that depends in large measure on the number and rate of message send operations done by other modules. Setting the mailbox sizes is something best done during system integration

Ideally the size of each mailbox is decided per module per domain. I think this information belongs in name_resolver with all the other domain metadata.

Domain : aliased constant Domain_Metadata := (5, 1, (Log_Server,
                                                                  Publish_Subscribe_Server,
                                                                  Time_Server,
                                                                  File_Server,
                                                                  Interpreter));

This syntax could be altered so that the list of module ids is actually a list of (Module_ID, Mailbox_Size) pairs. Ada doesn't support any anonymous groupings like this, so we will need to create some dumb record with a name like Module_Mailbox_Size_Pair. Then there will be some work inside Message_Manager to instantiate the mailboxes during elaboration instead of later.

Then in the moduleInit procedures, the call to Register_Module shouldn't contain a mailbox size. Note that the Register_Module call shouldn't be removed completely because it allows the message system to check the cardinality of modules.