Note: The mercurial server is disabled at the moment while I investigate whether it can run with an acceptably low CPU load – Mike.

An SMP version of micro:bian

Copyright © 1993–2025 J. M. Spivey
Jump to navigation Jump to search
  1. The aim is the greatest possible simplicity, so mutual exclusion should be achieved by surrounding the whole microkernel with spinlocks, placed at the top and bottom of system_call, cxt_switch and interrupt.
  2. Interrupt handling by device driver process requires that the driver process should run on the same core where the interrupt happened. A simple way of achieving this is to enable interrupts only on core 0, and schedule driver processes (those with priority P_HANDLER) only on that core. One way of arranging this is for the call to connect to reschedule the calling process on core 0; then connect must be called before any code that configures interrupts for the device.
  3. When a core is idle, it should go to sleep. That means there must be a wake-up mechanism between cores, so that when a process on one core sends or receives a message, the scheduler on the other core can act to run any processes that are awakened. (That's the purpose of WFE/SEV, isn't it?) This mechanism is also needed when a process on core 1 becomes a device driver, so that the scheduling invariant is maintained, if we care.
  4. A generalisation of the above would be to have each device interrupt enabled on only one core, but allow the client programme to choose which core is used for each interrupt, perhaps by an argument to connect.