script: add Magic Ring Buffer comment

This commit is contained in:
Nigel Tao committed 2026-06-23 10:47:26 +10:00
1 parent 731578a4e7
commit e0a44a0c40
1 file changed
+11 -7
+11 -7
View File
@@ -19,14 +19,18 @@
// without having to explicitly wrap around the ring-buffer boundaries. // without having to explicitly wrap around the ring-buffer boundaries.
// //
// This is similar to the technique discussed in // This is similar to the technique discussed in
// https://lo.calho.st/quick-hacks/employing-black-magic-in-the-linux-page-table/ // https://lo.calho.st/posts/black-magic-buffer/
// //
// This program differs from that web page's discussion by mapping the physical // It's also known as the Magic Ring Buffer:
// memory three times, not just two. This lets us read or write, implicitly // https://fgiesen.wordpress.com/2012/07/21/the-magic-ring-buffer/
// wrapping, both forwards (after the middle mapping's end) and backwards //
// (before the middle mapping's start). That web page only considers forwards // This program differs from those blog posts' discussion by mapping the
// reads or writes. Backwards reads are useful when decoding a Lempel-Ziv style // physical memory three times, not just two. This lets us read or write,
// compression format, copying from history (recently decoded bytes). // implicitly wrapping, both forwards (after the middle mapping's end) and
// backwards (before the middle mapping's start). Those blog posts only
// consider forwards reads or writes. Backwards reads are useful when decoding
// a Lempel-Ziv style compression format, copying from history (recently
// decoded bytes).
// //
// Its output should be: // Its output should be:
// //