Inter-Process Communication
2026-10-08
This module: Unix abstractions
(Yes, some overlap with 3410/4410.)
Different ways to organize; for each, let’s talk:
Pipe properties:
mkfifo creates a named pipe (FIFO) inodecatCommon design case:
One implementation: two processes talk over pipes
Let’s talk through this with Stockfish!
ucinewgame to start a new gameposition can make move or re-describe boarduci command is run at the outsetid and option commands to GUIuciokuciok by timeoutisready / readyok to check if ready for commandsstop to ask engine to stop current thinking ASAPStockfish is C++ vs Rust, but:
std::endl to flush buffers when appropriatesync_cout and sync_endl for thisLab 7 will use named pipes with
cat < client-pipeSocket is a thing you connect to
On the server side (for Unix or TCP sockets):
use std::os::unix::net::UnixListener;
use std::io::Write;
fn main() -> std::io::Result<()> {
let args: Vec<String> = std::env::args().collect();
let listener = UnixListener::bind(&args[1])?;
let mut ticket = 0;
for stream in listener.incoming() {
let Ok(mut stream) = stream else { continue; };
writeln!(stream, "You get ticket #{ticket}")?;
ticket += 1;
}
Ok(())
}This is a stream socket
Use std::os::unix::net::UnixDatagram for datagrams
UnixStreams are closed on drop
shutdown (immediate return)
Read, Write, or BothA lot like a Unix socket!
Which is true of both named pipes and Unix sockets?
Respond at: https://PollEv.com/davidbindel252 or send davidbindel252 to 22333
It’s a tremendous pain to get right! Manage
Enjoy your break!