I use these notes to capture how operating-system behavior can depend on low-level resource semantics, scheduling policy, and the interpretation of system metrics. They include my learning about Mach port references, Apple QoS scheduling, iowait reporting, and the distinction between unsafe behavior and fundamental unsafety.
I explained that the terminal doesn’t even own the network connection; in an SSH setup, the network connection belongs to the SSH process, not the terminal.
Locally, the terminal is always just a pty.
When I SSH, ssh runs as a child of your shell as a child of your terminal, separating the SSH process from the terminal’s network responsibilities.
In that setup, the SSH process is sending data back onto the pty.
I found reverse engineering into what changes are happening under the covers the coolest part about post-WWDC.
I was particularly interested in changes around the OS, kernel, runtimes, and security; this kind of investigation connects to my interest in understanding computer fundamentals.
I said these details about Swift in the kernel is very interesting and shared https://t.co/7WDen4zGqi.
I learned that mach_port_deallocate is a reference counting mechanism.
I found that mach_port_deallocate doesn't actually deallocate a damn thing if it has a ref count.
The function I wanted was mach_port_destroy.
I said I probably should've RTFM more, while finding the distinction very unclear.
I recommended https://t.co/862UQT8ArR as a good overview of QoS classes in Apple kernel scheduling.
I described the bug argument as “this breaks all iowait reporting because it's usually used to find stalls in IO”.
I described the not-a-bug argument as “technically we're waiting on IO, even though it's just a blocking pipe due to no data”.
I said, “Its not causing any CPU or IO spin whatsoever.”
I asked “why is it fundamentally unsafe” and said I know it can be done unsafely.
Related: mach api documentation, memory reporting and attribution, macos compatibility investigations