l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
September 2: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2005 May 11 17:55

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
/proc, /sys, and Re: [vox-tech] [OT] Windows Question for Relative
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

/proc, /sys, and Re: [vox-tech] [OT] Windows Question for Relative



on Tue, May 10, 2005 at 09:20:24PM -0700, Bob Scofield (scofield@omsoft.com) wrote:
> On Sunday 08 May 2005 17:47, Karsten M. Self wrote:

> Okay, I'm practicing this stuff on my computer so that I'll be able to
> do it on my sister's computer.
> >
> >   - What's the CPU speed?  /proc/cpuinfo.
> 
> When I do this with Knoppix I get "permission denied."  If I type "su"
> and hit return I go back to the original prompt, and when I retry
> /proc/cpuinfo I get the same error message.

/proc is a virtual filesystem.  That is:  it doesn't exist on disk, but
instead represents kernel state in a file-based format.  This makes it
possible to read (and sometimes modify) data with standard shell tools:
less, more, cat, grep, awk, sed, etc.  In the 2.6 kernel system, there's
also /sys which provides yet more information.

Contents of /proc vary by kernel.  E.g.:  /proc/pci (< 2.4) is now
/proc/bus/pci (2.6+).

Contents are also *dynamic*.  They change to reflect current system
state.  Specific directories may or may not exist, depending on what's
currently configured / enabled / available on your system.

You'll also note that there's a certain amount of replication.  I don't
know all the features or history, but here's a stab at it:


Generally you'd 'cat' or 'less' the files to see their content.

Top level of proc.  '/' indicates a directory, '@ a symlink:

    acpi/      dma         ioports   modules     swaps
    asound/    driver/     irq/      mounts@     sys/
    buddyinfo  execdomains kallsyms  mtrr        sysvipc/
    bus/       fb          kcore     net/        tty/
    cmdline    filesystems kmsg      partitions  uptime
    cpuinfo    fs/         loadavg   scsi/       version
    crypto     ide/        locks     self@       vmstat
    devices    interrupts  meminfo   slabinfo
    diskstats  iomem       misc      stat

Other interesting files in /proc:

  - /proc/cmdline:  the system boot parameter.  E.g.:

        root=/dev/hda2 ro vga=6 noapic hdc=ide-scsi 

  - /proc/<number>:  A directory containing information on the given
    process ID.  /proc/self is the current process ID.  Significant
    contents:

      - cmdline   The issued commanline.  E.g.:  cat /proc/self/cmdline
      - cwd       Current (a/k/a present) working directory
      - environ   Shell environment
      - exe       Executable.  Link to same:
      - fd        File descriptors.  Any open files of the process.
      - maps      Memory / library maps (?)
      - mem       Process memory
      - mounts    Available mount points.
      - root      Process effective root directory
      - stat      Process statisitcs (reported by 'ps' and similar)
      - statm     Other stats.
      - status    Still more stats.
      - task      See recursion.  Not entirely sure....

  - /proc/cpuinfo:  Information on the system CPU(s)
  - /proc/filesystems:  Known filesystems (see also /etc/filesystems).
  - /proc/mounts:   Currently mounted partitions (see also /etc/mtab).
  - /proc/meminfo:  System memory usage.
  - /proc/swaps:    Swap partition/file information.
  - /proc/uptime:   System uptime and load average.
  - /proc/version:  Kernel version.
  - /proc/vmstat:   Virtual memory system stats

Some lesser-used files:

  - /proc/crypto:   Kernel crypto capabilities (this is new)
  - /proc/devices:  Character/block devices known to the system.
  - /proc/dma:      ??

Subdirectories of /proc can have some interesting components:

  - acpi:  Power control.
  - bus:   Devices on the hardware busses:  input, pccard, pci, pnp, usb
  - driver:  Driver-speific data
  - fs:    Filesystem stuff ?
  - ide:   IDE (disk) subsystem
  - irq:   Interrupts data.
  - net:   Networking.  Several tuning and firewall capabilities,
           specifically NAT or IP forwarding, are handled here.
  - scsi:  SCSI subsystem state.
  - sys:   General system information.  There's a lot of gold in here.
  - sysvipc:  System V inter-process communications.
  - tty:   Termina management.


Looking at /proc/sys:

  - abi:    Programming interfaces
  - debug:  Debugging (we presume)
  - dev:    Devices, e.g.:  cdrom, parport, rtc, scsi
  - fs:     Filesystem _state_.
  - kernel: Extensive kernel state
  - net:    Network state.  More goodness here.
  - proc:   ??
  - vm:     Virtual Memory subsystem information.



I've written a script which gleans some of the more useful information
out of /proc (and some other places) called "system-info", which can be
useful for documenting what you've got and how it's configured:

    http://twiki.iwethey.org/Main/LinuxSystemInfoScript

...you might want to run this and print output.



As for /sys, we'll just take a quick peek:

Top level:

    block/	bus/  class/  devices/	firmware/  module/  power/

Tree (max depth = 2)

    /sys
    |-- block
    |     hda	loop3	loop7	ram3	ram7	ram11	ram15
    |     loop0	loop4	ram0	ram4	ram8	ram12	sr0
    |     loop1	loop5	ram1	ram5	ram9	ram13
    |     loop2	loop6	ram2	ram6	ram10	ram14
    |-- bus
    |     i2c		ci		np		usb-serial
    |     de		cmcia		csi
    |     eee1394	platform	sb
    |-- class
    |     graphics	mem		printer		tty
    |     i2c-adapter	misc		scsi_device	usb
    |     ieee1394	net		scsi_generic	usb_host
    |     ieee1394_host	pci_bus		scsi_host	vc
    |     ieee1394_node	pcmcia_socket	scsi_tape
    |     input		ppp		sound
    |-- devices
    |     pci0000:00 platform
    |     pnp0 pnp1 system
    |-- firmware
    |     acpi edd
    |-- module
    |     8139cp		ohci1394
    |     8139too		ohci_hcd
    |     ac97_codec		parport
    |     af_packet		parport_pc
    |     agpgart		pci_hotplug
    |     ata_piix		pciehp
    |     autofs4		pcmcia_core
    |     capability		pcspkr
    |     cdrom			ppp_async
    |     cfbcopyarea		ppp_generic
    |     cfbfillrect		reiserfs
    |     cfbimgblt		rtc
    |     commoncap		scsi_mod
    |     crc32			sd_mod
    |     dm_mod		serial_cs
    |     ds			sg
    |     e1000			shpchp
    |     edd			sir_dev
    |     ehci_hcd		sis5513
    |     eth1394		sis_agp
    |     evdev			slhc
    |     ext2			smbfs
    |     ext3			snd
    |     fat			snd_ac97_codec
    |     font			snd_intel8x0
    |     gameport		snd_mixer_oss
    |     i2c_core		snd_mpu401_uart
    |     i2c_isa		snd_page_alloc
    |     i2c_sensor		snd_pcm
    |     i810_audio		snd_pcm_oss
    |     ide_cd		snd_rawmidi
    |     ide_core		snd_seq
    |     ide_disk		snd_seq_device
    |     ide_generic		snd_seq_midi_event
    |     ide_scsi		snd_seq_oss
    |     ieee1394		snd_timer
    |     ip_tables		soundcore
    |     iptable_filter	sr_mod
    |     ipv6			st
    |     ircomm		tekram_sir
    |     ircomm_tty		tsdev
    |     irda			tun
    |     irtty_sir		uhci_hcd
    |     isofs			unix
    |     jbd			usb_storage
    |     joydev		usbcore
    |     libata		usbhid
    |     loop			usbkbd
    |     lp			usbserial
    |     mbcache		vesafb
    |     mii			vfat
    |     minix			visor
    |     mousedev		w83781d
    |     nls_cp437
    `-- power
        `-- state


> >   - How much memory?       'free'
> >
> >   - What's hard drive performance?
> >
> >        hdparm /dev/hda      # show Knoppix's autoconfigured settings.
> >
> >        hdparm -tT /dev/hda  # test actual performance.
> >
> >    The critical value is the second number, buffered disk reads.  Good
> >    values are in the 10 - 50+ MiB/s range.  Anything < 1 MiB/s indicates
> >    a pathalogically slow drive.  I got *massive* system performance
> >    boosts by swapping out a disk getting ~150 KiB/s (yes, kilobytes) for
> >    one hitting 60-80 MiB/s.
> 
> I assume that your "MiB/s" is the same as MB/sec, right?  I'm getting 50.99 
> MB/sec on my computer.

    http://physics.nist.gov/cuu/Units/binary.html

That's a nice throughput.  If you can find out that legacy MS Windows is
doing similarly (not sure what profiling tools exist) you're OK there.


> PS.  It seems like Knoppix is really important for Windows machines.

Aye.


Peace.

-- 
Karsten M. Self <kmself@ix.netcom.com>        http://kmself.home.netcom.com/
 What Part of "Gestalt" don't you understand?
    Jeff Waugh, in his own words, An agony in seven fits:
    http://zgp.org/pipermail/linux-elitists/2004-January/008588.html

Attachment: signature.asc
Description: Digital signature

_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.