What to start with? (/proc directory)

The very first part to start with is the System architecture chapter from LPIC-1 exam 101. Here you may find a pretty well documented tutorial from IBM, which is also referred as an “approved training material” on the official LPI site. What’s in there?

Besides trivial things like how you hould enter a BIOS menu, how to play in BIOS menus (take a lot of care here, since it may have serious consequences), what is POST, how to configure BIOS to boot without a keyboard, what is a hotplug and coldplug device … I would start tackle this first tutorial discussing about the mysterious /proc, /dev and /sys folders, of course there are more interesting things in here, like SCSI drivers, how Linux sees and treats SCSI devices, also about USB drivers, but probably in an upcoming post.

Talking about BIOS here it worths paying attention to the fact that this is NOT the only firmware interface standard, it is indeed very common on Intel x86 machines, but for PowerPC-based systems or for Intel-based Macs, there are others, like OpenFirmware, EFI,  also hope to write something on it in the future …

So … /proc directory is una bestia extraña how I read it here. It is a folder where Linux mounted a virtual file system at boot time with the purpose of moving functionality from kernel space to user space. In other words is a way of accessing kernel data, because after all this contains imporatnt information, like processes’ IDs, which devices are connected to system, by using user memory space. Why is this important? ..because such data can be passed to utilities running in user space, like ps. If you would have the curiosity to open it by typing

# cd /proc

#ls -l

you would notice that the vast majority of the files and folders in there  have size 0 bytes, meaning that they do NOT occupy any memory on HDD. There are some folders having some numbers as names, these are the currently running processes on the system, the numbers representing the IDs of the processes and they contain info specific to that process, like cmdline, which is the command that initiated that process, fd, file descriptor, mem, statm, maps, which are related to the memory used by the process, stat, status, which reflect the status of the process, and many others …In fact the ps utility reflects the info within this directory.

Also some important folders within this virtual filesystem are:/ interrupts, which contain the IRQ table,/ ioports, memory buffers through which the CPU exchanges info with external physical devices, /pci which reflects the PCI devices attached to the system (in fact lspci utility is a displaying what’s in here) and /dma which shows the DMA devices attached to the system. Is important to mention that the devices appearing in these folders are the ones already in use, for example if a printer is attached to the system and was NOT yet used, then it will not appear under these folders.

I will stop here since for LPIC-1 is required just a conceptual understanding of these notions and I will try to outline in some future posts the other two closely related file systems: Sysfs and devfs, also their corresponding directories dev and sys. 

Advertisements

5 Responses to What to start with? (/proc directory)

  1. Pingback: Bazaar 2.0

  2. Hi,

    Here you find a FREE screencasts that explains things to you easily:

    http://paulpaulito.com/en/products/LPI101

    Have fun

    • Hi,

      I knew about that site, thanks for the notification! ..but somehow the idea of these posts is not only to write tutorials for LPIC, even if would be quite challanging for me, but also to debate, express and ask opinions about LPIC objectives. Anyhow there are quite few free screencasts out there…

  3. vasiauvi says:

    So, if you write about Linux means that you use a Linux distribution, no?
    What you use?

    • Yes, I used Xubuntu and Ubuntu 10.xx (don’t remember exactly which release since it was quite long ago), but the goal would be to purchase an embedded kit (ideally an FPGA board) and to deploy en Embedded Linux on it ..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: