Ports
Modulus uses ports as an abstraction over direct IPC. This means that instead of sending a message to a specific process, the message is sent to a port opened by the receiving process. Ports are denoted by a string name with a max length of 5 characters. A process may open a port using the open()
system call, to which it will pass the name of the port and a callback function.
fn main() {
let port = open("mport", callback);
}
fn callback(body: usize) {
println!("Received message");
}
The callbacks are handled before every context switch to the receiving process. The kernel will call the callback function for each message in the port's queue and pass an address to the message's body. The time in which these callbacks are handled is not counted towards the process's CPU time.