[Courses] [FS] Lesson 5

Meredydd meredydd at everybuddy.com
Tue Dec 9 20:07:18 EST 2003


On Wednesday 10 December 2003 14:43, Telsa Gwynne wrote:
> Other thing I remember about /proc: people used to tell me never
> to use 'more /proc/somefile' or 'less /proc/somefile'. However,
> it was okay to do 'cat /proc/somefile | less' (or more). For
> reasons I have completely forgotten. I'd love to know what they
> were!

It's to do with the way proc works. You see, with the exception of usbfs 
(which is very similar in concept), proc is the only filesystem to 
actually generate its data on the fly. All the others have data 
*somewhere*, and *some* way of accessing it, and are therefore fairly 
rigorous about the whole thing. proc, by contrast, slaps together data 
each time a read() request comes in. This means that it's not all that 
good at maintaining the illusion of a coherent file when faced with 
multiple read()s for different bits of it, as any pager program would 
deliver.

A good explanation of how /proc works can be found in Akk's Anatomy of a 
Kernel Hack (accessible under Val's kernel hacking course), although I 
will say, not without a touch of pride, that I had in fact learnt this 
stuff the hard way before coming across that page.

Meredydd



More information about the Courses mailing list