[lkml]   [2000]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: What /proc should contain [was: /proc/driver/microcode]
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

 \ /
  Last update: 2005-03-22 13:56    [W:0.104 / U:1.016 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site