phkmalloc

by fanf2on 7/1/2025, 11:42 AMwith 10 comments

by throw0101don 7/4/2025, 2:56 PM

For those unaware, "PHK" is:

* https://en.wikipedia.org/wiki/Poul-Henning_Kamp

Amongst other things (including jails), he invented the MD5crypt algorithm (originally for FreeBSD) as an alternative to the original DEScrypt of Unix:

* https://en.wikipedia.org/wiki/Crypt_(C)#MD5-based_scheme

Nowadays probably most well-known for creating Varnish:

* https://en.wikipedia.org/wiki/Varnish_(software)

by bogeholmon 7/4/2025, 5:47 PM

Nice guy by the way! Met him on a train home from work once. I was working on my computer, glanced left and saw someone with a red beard running a tiling WM on some real boy system. Since we were in the silent zone, I wrote

    phk?
In a text editor - got a nod, and we shook hands :)

by Tuna-Fishon 7/4/2025, 11:41 PM

> Because I kept the “metadata” away from the chunks themselves, and because I used a binary “buddy” layout for sub-page-sized allocations, I could detect some of the most common mistakes.

> First I thought “We’re not having any of that” and made phkmalloc abort(2) on any wrong usage. Next time I rebooted my laptop fsck(8) aborted, and left me in single user mode until I could fix things with a floppy disk.

I love everything about this anecdote.

by eltetoon 7/1/2025, 8:30 PM

"... spending an hour over breakfast, chatting with Dennis Ritchie about device nodes and timekeeping in early UNIX kernels"

Wow, what an incredible experience!

by grogerson 7/4/2025, 10:44 PM

> Reasonable people who’s opinions I respect, have called this hack anything from “brilliant” to “an afront to all morals”. I think it is OK.

It's definitely a clever hack given the constraints of malloc, but this anecdote made me smile very widely.

In addition to multi-core becoming the norm causing it to be less performant than alternatives, I imagine the "sanity checking" aspects of phkmalloc were subsumed by things like ASAN.

by dataflowon 7/5/2025, 9:09 AM

If you like Poul Henning-Kamp, also see the following by him:

- "NSA Operation ORCHESTRA: Annual Status Report": https://mirrors.dotsrc.org/fosdem/2014/Janson/Sunday/NSA_ope...

- The bikeshed email: https://phk.freebsd.dk/sagas/bikeshed/

by nasretdinovon 7/1/2025, 2:12 PM

Nice article! I wonder if now, with all the NUMA stuff and processors with hundreds of cores something changed sufficiently enough that it warrants another complete redesign similar to what happened in the article