Lightweight Preemptible Functions
summary
Introduces a synchronous function-call timeout that runs preemptible code on the same kernel thread, enabling pause/resume/cancel without processes or kernel threads; implements this as libinger and exposes a launch/resume API with microbenchmarks showing launch and resume cost about 5 µs each (kernel thread spawn ~30 µs, fork ~200 µs), cancel is slower but offloaded to a reaper; builds a preemptive userland thread library libturquoise and shows it limits head‑of‑line latency (99th‑percentile stays controlled while cooperative systems collapse).
AI-written summary · about
chapters (26)
- 0:00Intro
- 2:02Problem: calling a function cedes control
- 2:36Two approaches to multitasking
- 3:16Problem: futures are cooperative
- 4:33Alternative: kernel threading
- 5:09Problem: SLAs and graceful degradation
- 5:48Observation: cancellation is hard
- 6:43Problem: object ownership and lifetime
- 8:28A new application primitive lightweight preemptible function: function invoked with a timeout
- 9:20The interface: launch() and resume
- 10:14The interface: cancel()
- 10:26Concurrency: explicit sharing counter = @
- 12:46Implementation: timer signal
- 13:26Implementation: cleanup
- 13:50Preemption mechanism
- 15:12libinger cancels runaway image decoding quickly
- 16:52Problem: non-reentrancy
- 18:31library copying
- 19:09Dynamic symbol binding
- 19:57Selective relinking
- 20:58uncopyable functions
- 21:30": blocking syscalls
- 22:05libgotcha microbenchmarks
- 23:50hyper latency benchmark: experimental setup
- 24:28hyper latency benchmarks: results
- 25:42Summary lightweight preemptible function: function invoked with a timeout • Synchronous preemption abstraction • Supports resuming and cancellation • Interoperable with legacy software • Exciting systems applications
related talks
19mRuntime verification monitors for real-time
18mCode That Can't Fail
19mPROMPT: A Fast and Extensible Memory Profiling Framework
16mMemory Allocation Profiling upcoming features
40mLaunching new processes with `io_uring_spawn` for fast builds
44mMaking apps seem faster without optimizing
24mGHC Plugin for Setting Breakpoints
38mProcrastination as a Service: Caching and Queueing
