Messages in this thread | | | Date | Thu, 24 Feb 2000 21:26:43 +0100 | From | almesber@lrc ... | Subject | Re: 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.
Example:
$ cat /proc/psbin.map #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 werner.almesberger@ica.epfl.ch / /_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |