Linuxis cost-freeYou can install a complete Unix system atno expense otherthan the hardware (of course).Linuxisfullycustomizableinall itscomponentsThanksto thecompilationoptions,youcancustomizethekernelbyselectingonlythefeatures really needed.Moreover, thanks to the GPL,you are allowed to freely read andmodify the source code of thekernel and of all system programs.[Manycommercialcompanies arenow supporting their products underLinux.However,manyofthem aren'tdistributedunder an open source license, so you might not be allowed to read or modify their source code.Linuxrunsonlow-end,inexpensivehardwareplatformsYouareabletobuildanetworkserverusinganoldIntel80386systemwith4MBofRAMLinuxispowerfulLinux systems are very fast, because they fully exploit the features of the hardwarecomponents.The main Linux goal is efficiency,and indeed many design choices ofcommercial variants,liketheSTREAMSI/Osubsystem,havebeen rejectedbyLinusbecauseof their impliedperformancepenalty.Linux developers are excellent programmersLinux systems are very stable;theyhavea verylowfailure rate and system maintenancetime.TheLinuxkernelcanbeverysmallandcompactIt is possible to fit a kernel image, including a few system programs, on just one 1.44 MBfloppydisk.Asfarasweknow,noneofthecommercialUnixvariantsisabletobootfromasinglefloppydisk.Linuxishighly compatiblewithmany commonoperating systemsLinuxletsyoudirectlymountfilesystems forall versions ofMS-DoSandMicrosoft Windows,SVR4,OS/2,MacOSX,Solaris,SunOS,NEXTSTEP,manyBSDvariants,andsoon.Linuxalsoisabletooperatewithmanynetworklayers,suchasEthernet(aswellasFastEthernetGigabitEthernet,and10GigabitEthernet),FiberDistributedDataInterface(FDDI),High21
21 Linux is cost-free You can install a complete Unix system at no expense other than the hardware (of course). Linux is fully customizable in all its components Thanks to the compilation options, you can customize the kernel by selecting only the features really needed. Moreover, thanks to the GPL, you are allowed to freely read and modify the source code of the kernel and of all system programs.[*] [*] Many commercial companies are now supporting their products under Linux. However, many of them aren't distributed under an open source license, so you might not be allowed to read or modify their source code. Linux runs on low-end, inexpensive hardware platforms You are able to build a network server using an old Intel 80386 system with 4 MB of RAM. Linux is powerful Linux systems are very fast, because they fully exploit the features of the hardware components. The main Linux goal is efficiency, and indeed many design choices of commercial variants, like the STREAMS I/O subsystem, have been rejected by Linus because of their implied performance penalty. Linux developers are excellent programmers Linux systems are very stable; they have a very low failure rate and system maintenance time. The Linux kernel can be very small and compact It is possible to fit a kernel image, including a few system programs, on just one 1.44 MB floppy disk. As far as we know, none of the commercial Unix variants is able to boot from a single floppy disk. Linux is highly compatible with many common operating systems Linux lets you directly mount filesystems for all versions of MS-DOS and Microsoft Windows , SVR4, OS/2 , Mac OS X , Solaris , SunOS , NEXTSTEP , many BSD variants, and so on. Linux also is able to operate with many network layers, such as Ethernet (as well as Fast Ethernet, Gigabit Ethernet, and 10 Gigabit Ethernet), Fiber Distributed Data Interface (FDDI), High
Performance Parallel Interface (HIPPI), IEEE 802.11 (Wireless LAN), and IEEE 802.15(Bluetooth).By using suitable libraries,Linux systems are even able to directly runprograms written for other operating systems.For example, Linux is able to execute someapplicationswrittenforMS-DOS,MicrosoftWindows,SVR3andR4,4.4BSD,SCOUnix,Xenix,andothersonthe80x86platform.Linuxiswell supportedBelieve it or not, it may be a lot easier to get patches and updates for Linux than for anyproprietaryoperating system.Theanswerto a problemoften comesbackwithinafewhours after sending a message to some newsgroup ormailing list.Moreover,drivers forLinux areusually available afewweeks afternewhardwareproductshavebeen introducedonthemarket.Bycontrast,hardwaremanufacturers releasedevicedriversfor onlyafewcommercialoperatingsystemsusuallyMicrosoft's.Therefore,all commercialUnixvariantsrunonarestrictedsubsetofhardwarecomponents.Withan estimated installedbaseof several tens ofmillions,peoplewhoareused to certain featuresthat are standard under other operating systemsare starting to expect the same from Linux.Inthatregard,thedemand on Linux developers is also increasing.Luckily,though,Linuxhas evolvedundertheclosedirectionof Linusandhissubsystemmaintainerstoaccommodatetheneedsofthemasses.1.2.HardwareDependencyLinuxtriestomaintaina neatdistinctionbetweenhardware-dependentand hardware-independentsource code.To that end,both the arch and the includedirectories include23 subdirectories thatcorrespondtothedifferenttypesof hardwareplatformssupported.Thestandardnamesof theplatforms are:alphaHewlett-Packard's Alpha workstations (originally Digital, then Compaq; no longermanufactured)arm,arm26ARMprocessor-basedcomputerssuchasPDAsandembeddeddevicescris22
22 Performance Parallel Interface (HIPPI), IEEE 802.11 (Wireless LAN), and IEEE 802.15 (Bluetooth). By using suitable libraries, Linux systems are even able to directly run programs written for other operating systems. For example, Linux is able to execute some applications written for MS-DOS, Microsoft Windows, SVR3 and R4, 4.4BSD, SCO Unix , Xenix , and others on the 80x86 platform. Linux is well supported Believe it or not, it may be a lot easier to get patches and updates for Linux than for any proprietary operating system. The answer to a problem often comes back within a few hours after sending a message to some newsgroup or mailing list. Moreover, drivers for Linux are usually available a few weeks after new hardware products have been introduced on the market. By contrast, hardware manufacturers release device drivers for only a few commercial operating systems usually Microsoft's. Therefore, all commercial Unix variants run on a restricted subset of hardware components. With an estimated installed base of several tens of millions, people who are used to certain features that are standard under other operating systems are starting to expect the same from Linux. In that regard, the demand on Linux developers is also increasing. Luckily, though, Linux has evolved under the close direction of Linus and his subsystem maintainers to accommodate the needs of the masses. 1.2. Hardware Dependency Linux tries to maintain a neat distinction between hardware-dependent and hardware-independent source code. To that end, both the arch and the include directories include 23 subdirectories that correspond to the different types of hardware platforms supported. The standard names of the platforms are: alpha Hewlett-Packard's Alpha workstations (originally Digital, then Compaq; no longer manufactured) arm, arm26 ARM processor-based computers such as PDAs and embedded devices cris
"CodeReducedInstructionSet"CPUsusedbyAxisinitsthin-servers,suchaswebcamerasordevelopmentboardsfrvEmbeddedsystemsbasedonmicroprocessorsoftheFujitsu'sFR-Vfamilyh8300Hitachih8/300andh8SRISC8/16-bitmicroprocessorsi386IBM-compatiblepersonalcomputersbasedon80x86microprocessorsia64WorkstationsbasedontheIntel64-bitItaniummicroprocessorm32rComputersbasedontheRenesasM32Rfamilyofmicroprocessorsm68k,m68knommuPersonalcomputersbasedonMotorolaMC680x0microprocessorsmipsWorkstationsbasedonMipSmicroprocessors,suchasthosemarketedbySiliconGraphicspariscWorkstationsbasedonHewlettPackardHP9oooPA-RISCmicroprocessorsppc,ppc64Workstationsbasedonthe32-bitand64-bitMotorola-IBMPowerPCmicroprocessors$390IBMESA/390andzSeriesmainframes23
23 "Code Reduced Instruction Set" CPUs used by Axis in its thin-servers, such as web cameras or development boards frv Embedded systems based on microprocessors of the Fujitsu's FR-V family h8300 Hitachi h8/300 and h8S RISC 8/16-bit microprocessors i386 IBM-compatible personal computers based on 80x86 microprocessors ia64 Workstations based on the Intel 64-bit Itanium microprocessor m32r Computers based on the Renesas M32R family of microprocessors m68k, m68knommu Personal computers based on Motorola MC680x0 microprocessors mips Workstations based on MIPS microprocessors, such as those marketed by Silicon Graphics parisc Workstations based on Hewlett Packard HP 9000 PA-RISC microprocessors ppc, ppc64 Workstations based on the 32-bit and 64-bit Motorola-IBM PowerPC microprocessors s390 IBM ESA/390 and zSeries mainframes
sh, sh64Embedded systems based on SuperH microprocessors developed by Hitachi andSTMicroelectronicssparc, sparc64WorkstationsbasedonSunMicrosystemsSPARCand64-bitUltraSPARCmicroprocessorsumUser Mode Linux,a virtual platform that allows developers to run a kernel in User Modev850NEc v85o microcontrollers that incorporate a 32-bit RISC core based on the Harvardarchitecturex86_64WorkstationsbasedontheAMD's64-bitmicroprocessorssuchAthlonandOpteronandIntel'sia32e/EM64T64-bitmicroprocessors1.3.LinuxVersionsUp tokernel version2.5,Linuxidentifiedkernelsthrough a simple numbering scheme.Eachversionwascharacterizedbythreenumbers,separatedbyperiods.Thefirsttwonumberswereused to identify the version; the third number identified the release. The first version number,namely 2,has stayed unchanged since 1996.The second version number identified the type ofkernel:if itwaseven,itdenotedastableversion;otherwise,itdenotedadevelopmentversion.Asthenamesuggests,stableversionswerethoroughlychecked byLinuxdistributorsandkernelhackers.Anewstableversionwasreleasedonlytoaddressbugsand toaddnewdevicedriversDevelopmentversions,on the otherhand,differed quite significantlyfrom one another;kerneldevelopers were freeto experimentwithdifferentsolutions that occasionally lead todrastickernelchanges.Users who relied on developmentversions for running applications could experienceunpleasant surprises whenupgrading theirkernel to a newerreleaseDuring development of Linux kernel version 2.6, however, a significant change in the versionnumbering schemehastakenplace.Basically,thesecondnumberno longeridentifies stableor24
24 sh, sh64 Embedded systems based on SuperH microprocessors developed by Hitachi and STMicroelectronics sparc, sparc64 Workstations based on Sun Microsystems SPARC and 64-bit Ultra SPARC microprocessors um User Mode Linux, a virtual platform that allows developers to run a kernel in User Mode v850 NEC V850 microcontrollers that incorporate a 32-bit RISC core based on the Harvard architecture x86_64 Workstations based on the AMD's 64-bit microprocessorssuch Athlon and Opteron and Intel's ia32e/EM64T 64-bit microprocessors 1.3. Linux Versions Up to kernel version 2.5, Linux identified kernels through a simple numbering scheme. Each version was characterized by three numbers, separated by periods. The first two numbers were used to identify the version; the third number identified the release. The first version number, namely 2, has stayed unchanged since 1996. The second version number identified the type of kernel: if it was even, it denoted a stable version; otherwise, it denoted a development version. As the name suggests, stable versions were thoroughly checked by Linux distributors and kernel hackers. A new stable version was released only to address bugs and to add new device drivers. Development versions, on the other hand, differed quite significantly from one another; kernel developers were free to experiment with different solutions that occasionally lead to drastic kernel changes. Users who relied on development versions for running applications could experience unpleasant surprises when upgrading their kernel to a newer release. During development of Linux kernel version 2.6, however, a significant change in the version numbering scheme has taken place. Basically, the second number no longer identifies stable or
development versions; thus,nowadayskernel developers introduce largeand significant changesin the current kernel version 2.6.A new kernel 2.7 branch will be created only when kerneldeveloperswill havetotesta reallydisruptivechange;this2.7branchwill leadtoanewcurrentkernel version,orit will bebackportedtothe2.6version,orfinallyit will simplybedroppedasadead end.The new model of Linux development implies that two kernels having the same version butdifferent release numbersfor instance, 2.6.10 and 2.6.11can differ significantly even in corecomponents and infundamental algorithms.Thus,when a new kernel release appears,it ispotentially unstable and buggy.Toaddress this problem, the kernel developers may releasepatchedversionsofanykernel,whichareidentifiedbyafourthnumberintheversionnumberingscheme.For instance,at the time this paragraph was written,thelatest"stable"kernel version was2.6.11.12.Please be aware that thekernel versiondescribed in this book is Linux2.6.11.1.4.BasicOperatingSystemConceptsEach computer system includes a basic set of programs called the operating system.The mostimportantprogramintheset iscalledthekernel.Itisloaded intoRAMwhenthesystembootsandcontainsmanycritical proceduresthatareneededforthesystemtooperate.Theotherprogramsare less crucial utilities;they can providea wide variety of interactiveexperiences forthe useraswell asdoingall thejobstheuserboughtthecomputerforbuttheessential shapeandcapabilitiesof the system are determined by the kernel.The kernel provides key facilities to everything else onthesystemanddeterminesmany of thecharacteristicsof highersoftware.Hence,weoftenusetheterm"operating system"asa synonymfor"kernel."Theoperatingsystemmustfulfilltwomainobjectives:Interact with the hardware components, servicing all low-level programmable elementsincluded inthehardwareplatform.Provideanexecution environmenttotheapplications that run on thecomputersystem (theso-calleduserprograms).Someoperatingsystems allowalluserprograms todirectlyplaywith thehardwarecomponents (atypical example is MS-Dos).In contrast, a Unix-like operating system hides all low-level detailsconcerning thephysical organizationof thecomputerfromapplicationsrunbytheuser.Whenaprogram wants to use a hardware resource, it must issue a request to the operating system.The25
25 development versions; thus, nowadays kernel developers introduce large and significant changes in the current kernel version 2.6. A new kernel 2.7 branch will be created only when kernel developers will have to test a really disruptive change; this 2.7 branch will lead to a new current kernel version, or it will be backported to the 2.6 version, or finally it will simply be dropped as a dead end. The new model of Linux development implies that two kernels having the same version but different release numbersfor instance, 2.6.10 and 2.6.11can differ significantly even in core components and in fundamental algorithms. Thus, when a new kernel release appears, it is potentially unstable and buggy. To address this problem, the kernel developers may release patched versions of any kernel, which are identified by a fourth number in the version numbering scheme. For instance, at the time this paragraph was written, the latest "stable" kernel version was 2.6.11.12. Please be aware that the kernel version described in this book is Linux 2.6.11. 1.4. Basic Operating System Concepts Each computer system includes a basic set of programs called the operating system. The most important program in the set is called the kernel. It is loaded into RAM when the system boots and contains many critical procedures that are needed for the system to operate. The other programs are less crucial utilities; they can provide a wide variety of interactive experiences for the useras well as doing all the jobs the user bought the computer forbut the essential shape and capabilities of the system are determined by the kernel. The kernel provides key facilities to everything else on the system and determines many of the characteristics of higher software. Hence, we often use the term "operating system" as a synonym for "kernel." The operating system must fulfill two main objectives: Interact with the hardware components, servicing all low-level programmable elements included in the hardware platform. Provide an execution environment to the applications that run on the computer system (the so-called user programs). Some operating systems allow all user programs to directly play with the hardware components (a typical example is MS-DOS ). In contrast, a Unix-like operating system hides all low-level details concerning the physical organization of the computer from applications run by the user. When a program wants to use a hardware resource, it must issue a request to the operating system. The