It would help if kernel provided process information in binary form instead of serializing it into text. Or even better to provide specific syscalls for it like on macOS, Windows, OpenBSD, Solaris and others.
It would help if kernel provided process information in binary form instead of serializing it into text. Or even better to provide specific syscalls for it like on macOS, Windows, OpenBSD, Solaris and others.
> While I agree that it is _less_ efficient than some other ways, in what way is that _significant_?
This gets noticeable when every connected user/session runs the htop.
I don't know, but I don't see doing random reads from kernel memory as particularly sane API to get list of processes and procfs is several orders of magnitude cleaner solution.
This is not correct - /dev/kmem and similar are typically only readable by root. If what you say were correct, ps and friends wouldn't work for unprivileged users (unless they were setuid root, which they're not).
You can see a ps.c implementation here: https://searchcode.com/codesearch/view/29853364/
which uses kvm library: https://www.freebsd.org/cgi/man.cgi?query=kvm&sektion=3&apro...
> Or even better to provide specific syscalls for it like on macOS, Windows, OpenBSD, Solaris and others.
top manages to take 6% CPU on my Macbook.