Re: What /proc should contain [was: /proc/driver/microcode]

Date: Thu Feb 24 2000 - 15:26:43 EST

Jamie Lokier wrote:
> Would a binary file in each /proc/PID directory containing just the right
> information for /proc be ok?

You mean for ps or top ? Why stop there ? If all you want is a highly
efficient interface for top, create a single binary interface that
just spits out those bits of information in fixed-size binary records,
for all processes at once. For kernel version independence, you can
create a map for the binary data, a bit like ksyms.


$ cat /proc/
#field offset size
pid 0 2
pri 2 2
uid 4 4

Then read and lseek on /proc/psbin to extract all the data.

If necessary, add filtering capabilities, e.g. turn "offset" into an
ID number and let the user write a filter that picks fields based on
their ID. You can further optimize this in the kernel into a list of
parameters to memcpy, handling adjacent fields in a single copy. Now
this really screams ;-)

It's easy to optimize for a small number of well-defined and reasonably
stable cases. You still have the more general and less efficient text
files for more special uses, where performance is less critical (e.g.
things like fuser). Also, the text files have better granularity for
permissions than such an all-or-nothing /proc/psbin.

- Werner

 / Werner Almesberger, ICA, EPFL, CH /

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to Please read the FAQ at

This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:10 EST