Evan Klitzke
eklitzke.org · Personal blog · on HN since 2016
Evan Klitzke writes about Linux internals and systems programming, including dd, linkers, stdout buffering, and uninterruptible sleep.
What HN saysHN links it for explanatory systems posts like "The cult of dd" and "PATH_MAX Is Tricky", and lists it among favorite personal blogs.
47HN people shared it
15linked it in comments
96stories submitted
2.9Kstory points
3 years agolast shared
2016people per year2026
Most-shared posts
- 1The cult of dd (2017)4 people · 558 points · first shared 2017 · 226 comments on HN
- 2Uninterruptible Sleep4 people · 2 points · first shared 2020 · discussion on HN
- 3Homepage4 people · first shared 2017
- 4Lobotomizing Gnome3 people · 230 points · first shared 2018 · 221 comments on HN
- 5PATH_MAX Is Tricky3 people · 67 points · first shared 2017 · 58 comments on HN
- 6Stdout Buffering3 people · 9 points · first shared 2016 · discussion on HN
- 7How Many Bitcoins Did Satoshi Nakamoto Mine?3 people · 8 points · first shared 2017 · discussion on HN
- 8All About Linkers3 people · 7 points · first shared 2017 · discussion on HN
- 9Misunderstanding Mlock(2) and Mlockall(2) (2015)3 people · 3 points · first shared 2019 · discussion on HN
- 10How Tail Call Optimization Works2 people · 221 points · first shared 2020 · 208 comments on HN
- 11In Defense of C++2 people · 198 points · first shared 2017 · 331 comments on HN
- 12Unexpected places you can and can’t use null bytes2 people · 67 points · first shared 2017 · 71 comments on HN
- 13How TCP Sockets Work2 people · 7 points · first shared 2017 · discussion on HN
- 14Production Tornado Deployment with Systemd2 people · 5 points · first shared 2017 · discussion on HN
- 15Blocking I/O, Nonblocking I/O, and Epoll2 people · 5 points · first shared 2017 · discussion on HN
What HN people wrote when they linked it
andythemoron · 2017-07-25
Julia Evans' blog is one of my favorites! It was a big inspiration for starting my own blog (https://andythemoron.com). I also love High Scalability and Dan Luu's blog which have been mentioned in other comments.
I "follow" several which are mostly defunct, but in terms of blogs that still feature active updates:
Evan Klitze's blog: lots of topics around Linux, C++, etc. https://eklitzke.org/
Sutter's Mill: lots of "state of the world" for C++, but also context, history, etc. https://herbsutter.com/
IT Hare: C++, game programming http://ithare.com/
The Erlangelist: Erlang/Elixir http://theerlangelist.com/
null program: lots of miscellaneous topics http://nullprogram.com/
Fluent C++: the name speaks for itself http://www.fluentcpp.com/
Another Programmer's Blog: Linux, C, C++, C#, MSSQL https://www.stev.org/
theonemind · 2022-05-23
chrsig · 2021-11-21
This is actually an incredibly frustrating thing -- when doing disk i/o, the process goes into an uninterruptible sleep state[0].
So if your shell is doing some tab completion that goes into an uninterruptible sleep, there's no escape sequence you can send it to cancel that operation.
Where I've seen this be the most vexing is in AWS if an EBS volume dies (surprisingly more frequent of an occurrence than you'd think!). It effectively prevents the machine from cleanly shutting down, and you wind up having to wait for the instance to be forcefully terminated.
[0] https://eklitzke.org/uninterruptible-sleep
yrro · 2021-07-21
https://eklitzke.org/path-max-is-tricky
The Linux kernel defines upper limits for NAME_MAX (255) and PATH_MAX (4096).
The glibc doesn't enforce this limit because it was originally written to run on GNU HURD which I guess doesn't have these limits.
But systemd only runs on glibc on Linux. So I don't see why it doesn't at least sanity check the length of absolute paths with PATH_MAX...
arkj · 2021-07-17
Adding a few more that helped me to learn few things,
Evan Klitzke - https://eklitzke.org
Eli Bendersky - https://eli.thegreenplace.net
Bartosz Milewski - https://bartoszmilewski.com
Jeff Preshing - https://preshing.com
Robert O'Callahan - https://robert.ocallahan.org
Marek's idea of the day - https://idea.popcount.org
Chris Wellons - https://nullprogram.com
Andrej Karpathy - https://karpathy.github.io/
davegauer · 2021-02-26
I realize I'm replying six days later - but I can't help mentioning that the "dd situation" is even crazier than it first appears: you can just use `cp foo.iso /dev/sdb` or `cat > /dev/sdb`.
https://unix.stackexchange.com/a/189091/220387
https://eklitzke.org/the-cult-of-dd
Reelin · 2020-03-27
https://eklitzke.org/uninterruptible-sleep
> If the process is in uninterruptible sleep then the process can’t be interrupted, which will cause the strace process itself to hang forever. Remarkably, it appears that the ptrace(2) system call is itself uninterruptible, which means that if this happens you may not be able to kill the strace process!
Everything about this is broken and makes no sense. The Night Watch is as relevant as ever. (https://www.usenix.org/system/files/1311_05-08_mickens.pdf)
amelius · 2020-03-26
For anyone who was wondering, I found a post explaining why threads can be in "uninterruptible sleep" in the first place:
https://eklitzke.org/uninterruptible-sleep
LeonB · 2019-12-13
I just read up on this. If what I read is true, TSP is NP-hard not NP complete. You can’t trivially prove that the solution is optimum.
Reference: https://eklitzke.org/the-traveling-salesman-problem-is-not-np-complete
neilparikh · 2019-09-04
This isn't exactly what you're talking about, but I found this blog post to be an interesting exploration of some related ideas: https://eklitzke.org/the-halting-problem
Artemis2 · 2018-10-17
Good addition! Here are some more:
https://ferd.ca
https://blog.filippo.io
https://lethain.com
http://movingpackets.net
https://www.integralist.co.uk
https://peter.bourgon.org/blog
https://engineering.linkedin.com/blog
https://begriffs.com
https://mijailovic.net
http://tatiyants.com
http://blog.pentestbegins.com (seems down right now?)
https://kalzumeus.com/archive
http://blog.stephenwolfram.com
https://paragonie.com/blog
https://www.filfre.net
https://brandur.org/articles
http://archagon.net
https://eklitzke.org
I guess I could go on forever…
gcp · 2017-02-06
Gah, another one of those promotional posts about Rust.
More seriously, the large enough Noto Sans font with a hint of extra weight renders so gorgeous in Firefox (it's even bearable in Chrome!). I wish all webpages were as readable.
As for the content, well, going back to: https://eklitzke.org/c++-java-go-and-rust I think the problem of the author is that he doesn't realize it's possible to do much better than C++. Claiming Rusts' ownership and borrow checking is exactly equivalent to std::unique_ptr or that Rusts' concurrency support is comparable to std::thread betrays very deep nativity, misunderstanding or just a mindset that can't see beyond what C++ offers.
staticassertion · 2022-09-12
I believe that when a file is mmap'd a page table is created for it in the . As you perform read/write on the file a fault loads the actual entries into that page table. As pages can be mapped they so too can be unmapped under pressure, without that falling back to swap (since it is already a file backed map, you wouldn't swap a file backed map to a different file after all).
There are a few relevant bits to this. You can MAP_POPULATE the file to prepopulate the entries and you can MAP_LOCKED to MAP_POPULATE + lock the pages in (unreliably). As mentioned in the man page for mmap MAP_LOCKED has some failure modes that you don't get with mlock.
https://www.man7.org/linux/man-pages/man2/mmap.2.html
I also found this page:
https://eklitzke.org/mlock-and-mlockall
Oh, and this: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux…
scottlamb · 2021-03-13
And I find your comment to be a super-annoying combination of pedantic and mostly wrong. I'm not going to go through every example but just pick a few:
> > For example, in C I'd be tempted to reuse a buffer allocated for one purpose for another purpose later (a technique known as HEARTBLEED).
> You can do that in Java (with byte arrays) or in Common Lisp, so what is the point here? It is not practice in Java, Lisp nor in C and C++.
C is a really old language with ancient libraries that are still widely used even though they are simply bad by modern standards. For that reason, I roll my eyes when people say something is not practice in C or talk about "sane" C libraries. A big part of working with C is dealing with ancient insanity.
You can make much stronger statements about what is idiomatic in Rust (and to some extent Java) simply because it's newer and more cohesive.
> > It's convenient to have fixed-size buffers for variable-size data (e.g. PATH_MAX) to avoid (re)allocation of growing buffers
> This is because OS/Kernel/filesystem guarantee path max size.
I think you've got that backwards. There's an advertised max path size because people wanted to stick paths in fixed-size buffers rather than deal with dynamic allocation. PATH_MAX is fairly arbitrary considering that there are certainly ways of creating and opening files which have paths exceeding that limit. I found this doc talking about this: https://eklitzke.org/path-max-is-tricky
> printf is not shipped…