jump to navigation

Linux Ramfs August 12, 2005

Posted by Coolguy in Linux.
add a comment

Linux File descriptors August 12, 2005

Posted by Coolguy in Linux.
add a comment

Linux Boot Process August 11, 2005

Posted by Coolguy in Linux.
add a comment
  • When a PC is booted it starts running a BIOS program which is a memory resident program on an EEPROM integrated circuit.
  • The BIOS program will eventually try to read the first sector on a booting media such as a hard or floppy drive
  • The boot sector contains a small program that the BIOS will load and attempt to pass run control to
  • This program will attempt to read the operating system from the disk and run it
  • LILO is the program that Linux systems typically use to give users a choice of operating systems to run.
  • It is usually installed in the boot sector which is also called the master boot record
  • If the user chooses to boot Linux, LILO will attempt to load the Linux kernel

Boot process

  • LILO will have a timeout period for the user to press the TAB key. If the user does not press the TAB key before the timeout occurs, LILO will run the default operating system selected when it was installed
  • the user presses the TAB key, LILO will present the user with a choice of systems to boot from based upon the labels and images as set up in the /etc/lilo.conf file that controlled the last LILO install
  • Lines in this file are
  • # Boot up Linux by default:
  • default=Linux
  • image=/boot/vmlinuz
  • label=Linux
  • Since the Linux kernel is installed compressed, containing a small program to de-compress itself, it will uncompress itself.
  • If the kernel recognizes that the system has a video card which supports some special text modes (such as 100 columns by 40 rows), Linux may ask which mode to use
  • The kernel checks the hardware (hard disks, floppies, network adapters, etc), and configures some of its device drivers, while outputting messages about its findings
  • The kernel will try to mount the root filesystem.The location of the filesystem is configurable at compilation time, with the rdev program, or with LILO. The filesystem type is detected automatically.
  • If mounting the root filesystem fails, the kernel will panic and halt the system. The root filesystem is usually mounted read-only so that the filesystem can be checked while it is mounted
  • The kernel starts the program “init” which becomes process number 1. Init will start the rest of the system

The Init Program

  • Kernel will start a program called init, if it finds it
  • The init process reads the file “/etc/inittab” and uses this file to determine how to create processes
  • init is always running and can dynamically do things and run processes based upon various signals

More:

http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlbootproc.html

Linux Run-Levels August 11, 2005

Posted by Coolguy in Linux.
add a comment
  • A runlevel is a software configuration of the system that allows only a selected group of processes to exist
  • Linux has 6 different run levels (or operating modes):
    rc1.d – Single User Mode
    rc2.d – Single User Mode with Networking
    rc3.d – Multi-User Mode – boot up in text mode
    rc4.d – Not yet Defined
    rc5.d – Multi-User Mode – boot up in X Windows
    rc6.d – Shutdown
  • Most of the time when your server boots up it will start in runlevel 3 or 5 depending on what it is set to. This setting can be found in the file /etc/inittab
  • Eg: Line in inittab: id:3:initdefault:
  • NEVER change it to runlevel 6 or else you will set your server to shutdown on bootup
  • In the folder: /etc/rc.d are all the run level folders starting from rc1.d to rc6.d and including init.d
  • If you change directory into /etc/rc.d/rc3.d all the files that start with a capital S are the services that will start at this runlevel.
  • All the files that start with a K are the services that will be killed at that runlevel

More:

http://howtos.linux.com/guides/sag/x2111.shtml

http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlrunlevels.html

Linux memory management August 11, 2005

Posted by Coolguy in Linux.
add a comment
  • 32-bit architectures can reference 4 GB of physical memory
  • Processors that have an MMU (Memory Management Unit) support the concept of virtual memory
  • Page tables are set up by the kernel which map “virtual addresses” to “physical addresses
  • This means each process can access 4 GB of memory, thinking it’s the only process running on the machine
  • The virtual address to physical address mappings are done by the kernel
  • When a new process is forked, the kernel creates a new set of page tables for the process
  • The addresses referenced within a process in user-space are virtual addresses
  • They do not necessarily map directly to the same physical address
  • The virtual address is passed to the MMU (Memory Management Unit of the processor) which converts it to the proper physical address based on the tables set up by the kernel.
  • Hence, two processes can refer to memory address 0x08329, but they would refer to two different locations inmemory.
  • The Linux kernel splits the 4 GB virtual address space of a process in two parts: 3 GB and 1 GB
  • The lower 3 GB of the process virtual address space is accessible as the user-space virtual addresses and the upper 1 GB space is reserved for the kernel virtual addresses
  • The kernel virtual area (3 – 4 GB address space) maps to the first 1GB of physical RAM.
  • The 3 GB addressable RAM available to each process is mapped to the available physical RAM
  • The basic problem here is, the kernel can just address 1 GB of virtual addresses, which can translate to a maximum of 1 GB of physical memory

Solution

  • HIGHMEM is a kernel configuration option that allows Linux to handle optionally 4giga of RAM or 64giga of RAM (64giga is possible using PAE physical address extension three level pagetables) on IA32

More:

http://kerneltrap.org/node/2450