Tải bản đầy đủ (.pdf) (1,786 trang)

OReilly understanding the linux kernel 3rd edition nov 2005 ISBN 0596005652

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (8.53 MB, 1,786 trang )

UnderstandingtheLinuxKernel,3rdEdition
ByDanielP.Bovet,MarcoCesati
...............................................
Publisher:O'Reilly
PubDate:November2005
ISBN:0-596-00565-2
Pages:942

TableofContents|Index

InordertothoroughlyunderstandwhatmakesLinuxtickandwhyitworkssowellona
widevarietyofsystems,youneedtodelvedeepintotheheartofthekernel.Thekernel
handlesallinteractionsbetweentheCPUandtheexternalworld,anddetermineswhich
programswillshareprocessortime,inwhatorder.Itmanageslimitedmemorysowellthat
hundredsofprocessescansharethesystemefficiently,andexpertlyorganizesdata
transferssothattheCPUisn'tkeptwaitinganylongerthannecessaryfortherelatively
slowdisks.
ThethirdeditionofUnderstandingtheLinuxKerneltakesyouonaguidedtourofthemost
significantdatastructures,algorithms,andprogrammingtricksusedinthekernel.Probing
beyondsuperficialfeatures,theauthorsoffervaluableinsightstopeoplewhowantto
knowhowthingsreallyworkinsidetheirmachine.ImportantIntel-specificfeaturesare
discussed.Relevantsegmentsofcodearedissectedlinebyline.Butthebookcoversmore
thanjustthefunctioningofthecode;itexplainsthetheoreticalunderpinningsofwhy
Linuxdoesthingsthewayitdoes.
ThiseditionofthebookcoversVersion2.6,whichhasseensignificantchangestonearly
everykernelsubsystem,particularlyintheareasofmemorymanagementandblock
devices.Thebookfocusesonthefollowingtopics:
Memorymanagement,includingfilebuffering,processswapping,andDirectmemory
Access(DMA)
TheVirtualFilesystemlayerandtheSecondandThirdExtendedFilesystems
Processcreationandscheduling


Signals,interrupts,andtheessentialinterfacestodevicedrivers
Timing
Synchronizationwithinthekernel


InterprocessCommunication(IPC)
Programexecution

UnderstandingtheLinuxKernelwillacquaintyouwithalltheinnerworkingsofLinux,but
it'smorethanjustanacademicexercise.You'lllearnwhatconditionsbringoutLinux's
bestperformance,andyou'llseehowitmeetsthechallengeofprovidinggoodsystem
responseduringprocessscheduling,fileaccess,andmemorymanagementinawide
varietyofenvironments.ThisbookwillhelpyoumakethemostofyourLinuxsystem.


UnderstandingtheLinuxKernel,3rdEdition
ByDanielP.Bovet,MarcoCesati
...............................................
Publisher:O'Reilly
PubDate:November2005
ISBN:0-596-00565-2
Pages:942

TableofContents|Index


















































Copyright
Preface
TheAudienceforThisBook
OrganizationoftheMaterial
LevelofDescription
OverviewoftheBook
BackgroundInformation
ConventionsinThisBook
HowtoContactUs
Safari®Enabled
Acknowledgments
Chapter1.Introduction
Section1.1.LinuxVersusOtherUnix-LikeKernels
Section1.2.HardwareDependency
Section1.3.LinuxVersions
Section1.4.BasicOperatingSystemConcepts
Section1.5.AnOverviewoftheUnixFilesystem
Section1.6.AnOverviewofUnixKernels

Chapter2.MemoryAddressing
Section2.1.MemoryAddresses
Section2.2.SegmentationinHardware
Section2.3.SegmentationinLinux
Section2.4.PaginginHardware
Section2.5.PaginginLinux
Chapter3.Processes














































































Section3.1.Processes,LightweightProcesses,andThreads
Section3.2.ProcessDescriptor
Section3.3.ProcessSwitch
Section3.4.CreatingProcesses
Section3.5.DestroyingProcesses
Chapter4.InterruptsandExceptions
Section4.1.TheRoleofInterruptSignals

Section4.2.InterruptsandExceptions
Section4.3.NestedExecutionofExceptionandInterruptHandlers
Section4.4.InitializingtheInterruptDescriptorTable
Section4.5.ExceptionHandling
Section4.6.InterruptHandling
Section4.7.SoftirqsandTasklets
Section4.8.WorkQueues
Section4.9.ReturningfromInterruptsandExceptions
Chapter5.KernelSynchronization
Section5.1.HowtheKernelServicesRequests
Section5.2.SynchronizationPrimitives
Section5.3.SynchronizingAccessestoKernelDataStructures
Section5.4.ExamplesofRaceConditionPrevention
Chapter6.TimingMeasurements
Section6.1.ClockandTimerCircuits
Section6.2.TheLinuxTimekeepingArchitecture
Section6.3.UpdatingtheTimeandDate
Section6.4.UpdatingSystemStatistics
Section6.5.SoftwareTimersandDelayFunctions
Section6.6.SystemCallsRelatedtoTimingMeasurements
Chapter7.ProcessScheduling
Section7.1.SchedulingPolicy
Section7.2.TheSchedulingAlgorithm
Section7.3.DataStructuresUsedbytheScheduler
Section7.4.FunctionsUsedbytheScheduler
Section7.5.RunqueueBalancinginMultiprocessorSystems
Section7.6.SystemCallsRelatedtoScheduling
Chapter8.MemoryManagement
Section8.1.PageFrameManagement
Section8.2.MemoryAreaManagement

Section8.3.NoncontiguousMemoryAreaManagement
Chapter9.ProcessAddressSpace














































































Section9.1.TheProcess'sAddressSpace
Section9.2.TheMemoryDescriptor
Section9.3.MemoryRegions
Section9.4.PageFaultExceptionHandler
Section9.5.CreatingandDeletingaProcessAddressSpace
Section9.6.ManagingtheHeap
Chapter10.SystemCalls
Section10.1.POSIXAPIsandSystemCalls
Section10.2.SystemCallHandlerandServiceRoutines
Section10.3.EnteringandExitingaSystemCall
Section10.4.ParameterPassing
Section10.5.KernelWrapperRoutines

Chapter11.Signals
Section11.1.TheRoleofSignals
Section11.2.GeneratingaSignal
Section11.3.DeliveringaSignal
Section11.4.SystemCallsRelatedtoSignalHandling
Chapter12.TheVirtualFilesystem
Section12.1.TheRoleoftheVirtualFilesystem(VFS)
Section12.2.VFSDataStructures
Section12.3.FilesystemTypes
Section12.4.FilesystemHandling
Section12.5.PathnameLookup
Section12.6.ImplementationsofVFSSystemCalls
Section12.7.FileLocking
Chapter13.I/OArchitectureandDeviceDrivers
Section13.1.I/OArchitecture
Section13.2.TheDeviceDriverModel
Section13.3.DeviceFiles
Section13.4.DeviceDrivers
Section13.5.CharacterDeviceDrivers
Chapter14.BlockDeviceDrivers
Section14.1.BlockDevicesHandling
Section14.2.TheGenericBlockLayer
Section14.3.TheI/OScheduler
Section14.4.BlockDeviceDrivers
Section14.5.OpeningaBlockDeviceFile
Chapter15.ThePageCache
Section15.1.ThePageCache














































































Section15.2.StoringBlocksinthePageCache
Section15.3.WritingDirtyPagestoDisk
Section15.4.Thesync(),fsync(),andfdatasync()SystemCalls
Chapter16.AccessingFiles
Section16.1.ReadingandWritingaFile
Section16.2.MemoryMapping
Section16.3.DirectI/OTransfers
Section16.4.AsynchronousI/O
Chapter17.PageFrameReclaiming
Section17.1.ThePageFrameReclaimingAlgorithm
Section17.2.ReverseMapping
Section17.3.ImplementingthePFRA
Section17.4.Swapping
Chapter18.TheExt2andExt3Filesystems
Section18.1.GeneralCharacteristicsofExt2
Section18.2.Ext2DiskDataStructures
Section18.3.Ext2MemoryDataStructures
Section18.4.CreatingtheExt2Filesystem

Section18.5.Ext2Methods
Section18.6.ManagingExt2DiskSpace
Section18.7.TheExt3Filesystem
Chapter19.ProcessCommunication
Section19.1.Pipes
Section19.2.FIFOs
Section19.3.SystemVIPC
Section19.4.POSIXMessageQueues
Chapter20.ProgramExZecution
Section20.1.ExecutableFiles
Section20.2.ExecutableFormats
Section20.3.ExecutionDomains
Section20.4.TheexecFunctions
AppendixA.SystemStartup
SectionA.1.PrehistoricAge:theBIOS
SectionA.2.AncientAge:theBootLoader
SectionA.3.MiddleAges:thesetup()Function
SectionA.4.Renaissance:thestartup_32()Functions
SectionA.5.ModernAge:thestart_kernel()Function
AppendixB.Modules
SectionB.1.ToBe(aModule)orNottoBe?

























SectionB.2.ModuleImplementation
SectionB.3.LinkingandUnlinkingModules
SectionB.4.LinkingModulesonDemand
Bibliography
BooksonUnixKernels
BooksontheLinuxKernel
BooksonPCArchitectureandTechnicalManualsonIntelMicroprocessors
OtherOnlineDocumentationSources
ResearchPapersRelatedtoLinuxDevelopment
AbouttheAuthors
Colophon
Index


UnderstandingtheLinuxKernel,ThirdEdition

byDanielP.BovetandMarcoCesati
Copyright©2006O'ReillyMedia,Inc.Allrightsreserved.
PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles(safari.oreilly.com).Formoreinformation,contact
ourcorporate/institutionalsalesdepartment:(800)998-9938or

Editor:

AndyOram

ProductionEditor:

DarrenKelly

ProductionServices:

AmyParker

CoverDesigner:

EdieFreedman

InteriorDesigner:

DavidFutato


PrintingHistory:
November2000:

FirstEdition.

December2002:

SecondEdition.

November2005:

ThirdEdition.


NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
TheLinuxseriesdesignations,UnderstandingtheLinuxKernel,
ThirdEdition,theimageofamanwithabubble,andrelated
tradedressaretrademarksofO'ReillyMedia,Inc.
Manyofthedesignationsusedbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andO'ReillyMedia,Inc.
wasawareofatrademarkclaim,thedesignationshavebeen
printedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorsassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof
theinformationcontainedherein.
ISBN:0-596-00565-2
[M]





Preface
Inthespringsemesterof1997,wetaughtacourseon
operatingsystemsbasedonLinux2.0.Theideawasto
encouragestudentstoreadthesourcecode.Toachievethis,we
assignedtermprojectsconsistingofmakingchangestothe
kernelandperformingtestsonthemodifiedversion.Wealso
wrotecoursenotesforourstudentsaboutafewcriticalfeatures
ofLinuxsuchastaskswitchingandtaskscheduling.
OutofthisworkandwithalotofsupportfromourO'Reilly
editorAndyOramcamethefirsteditionofUnderstandingthe
LinuxKernelattheendof2000,whichcoveredLinux2.2witha
fewanticipationsonLinux2.4.Thesuccessencounteredbythis
bookencouragedustocontinuealongthisline.Attheendof
2002,wecameoutwithasecondeditioncoveringLinux2.4.
Youarenowlookingatthethirdedition,whichcoversLinux2.6.
Asinourpreviousexperiences,wereadthousandsoflinesof
code,tryingtomakesenseofthem.Afterallthiswork,wecan
saythatitwasworththeeffort.Welearnedalotofthingsyou
don'tfindinbooks,andwehopewehavesucceededin
conveyingsomeofthisinformationinthefollowingpages.


TheAudienceforThisBook
AllpeoplecuriousabouthowLinuxworksandwhyitisso
efficientwillfindanswershere.Afterreadingthebook,youwill
findyourwaythroughthemanythousandsoflinesofcode,

distinguishingbetweencrucialdatastructuresandsecondary
onesinshort,becomingatrueLinuxhacker.
OurworkmightbeconsideredaguidedtouroftheLinux
kernel:mostofthesignificantdatastructuresandmany
algorithmsandprogrammingtricksusedinthekernelare
discussed.Inmanycases,therelevantfragmentsofcodeare
discussedlinebyline.Ofcourse,youshouldhavetheLinux
sourcecodeonhandandshouldbewillingtoexpendsome
effortdecipheringsomeofthefunctionsthatarenot,forsake
ofbrevity,fullydescribed.
Onanotherlevel,thebookprovidesvaluableinsighttopeople
whowanttoknowmoreaboutthecriticaldesignissuesina
modernoperatingsystem.Itisnotspecificallyaddressedto
systemadministratorsorprogrammers;itismostlyforpeople
whowanttounderstandhowthingsreallyworkinsidethe
machine!Aswithanygoodguide,wetrytogobeyond
superficialfeatures.Weofferabackground,suchasthehistory
ofmajorfeaturesandthereasonswhytheywereused.


OrganizationoftheMaterial
Whenwebegantowritethisbook,wewerefacedwithacritical
decision:shouldwerefertoaspecifichardwareplatformorskip
thehardware-dependentdetailsandconcentrateonthepure
hardware-independentpartsofthekernel?
OthersbooksonLinuxkernelinternalshavechosenthelatter
approach;wedecidedtoadopttheformeroneforthefollowing
reasons:
Efficientkernelstakeadvantageofmostavailablehardware
features,suchasaddressingtechniques,caches,processor

exceptions,specialinstructions,processorcontrolregisters,
andsoon.Ifwewanttoconvinceyouthatthekernel
indeeddoesquiteagoodjobinperformingaspecifictask,
wemustfirsttellwhatkindofsupportcomesfromthe
hardware.
EvenifalargeportionofaUnixkernelsourcecodeis
processor-independentandcodedinClanguage,asmall
andcriticalpartiscodedinassemblylanguage.Athorough
knowledgeofthekernel,therefore,requiresthestudyofa
fewassemblylanguagefragmentsthatinteractwiththe
hardware.
Whencoveringhardwarefeatures,ourstrategyisquitesimple:
onlysketchthefeaturesthataretotallyhardware-drivenwhile
detailingthosethatneedsomesoftwaresupport.Infact,we
areinterestedinkerneldesignratherthanincomputer
architecture.
Ournextstepinchoosingourpathconsistedofselectingthe
computersystemtodescribe.AlthoughLinuxisnowrunningon
severalkindsofpersonalcomputersandworkstations,we


decidedtoconcentrateontheverypopularandcheapIBMcompatiblepersonalcomputersandthusonthe80x86
microprocessorsandonsomesupportchipsincludedinthese
personalcomputers.Theterm80x86microprocessorwillbe
usedintheforthcomingchapterstodenotetheIntel80386,
80486,Pentium,PentiumPro,PentiumII,PentiumIII,and
Pentium4microprocessorsorcompatiblemodels.Inafew
cases,explicitreferenceswillbemadetospecificmodels.
Onemorechoicewehadtomakewastheordertofollowin
studyingLinuxcomponents.Wetriedabottom-upapproach:

startwithtopicsthatarehardware-dependentandendwith
thosethataretotallyhardware-independent.Infact,we'llmake
manyreferencestothe80x86microprocessorsinthefirstpart
ofthebook,whiletherestofitisrelativelyhardwareindependent.SignificantexceptionsaremadeinChapter13and
Chapter14.Inpractice,followingabottom-upapproachisnot
assimpleasitlooks,becausetheareasofmemory
management,processmanagement,andfilesystemsare
intertwined;afewforwardreferencesthatis,referencesto
topicsyettobeexplainedareunavoidable.
Eachchapterstartswithatheoreticaloverviewofthetopics
covered.Thematerialisthenpresentedaccordingtothe
bottom-upapproach.Westartwiththedatastructuresneeded
tosupportthefunctionalitiesdescribedinthechapter.Thenwe
usuallymovefromthelowestleveloffunctionstohigherlevels,
oftenendingbyshowinghowsystemcallsissuedbyuser
applicationsaresupported.




LevelofDescription
Linuxsourcecodeforallsupportedarchitecturesiscontainedin
morethan14,000Candassemblylanguagefilesstoredin
about1000subdirectories;itconsistsofroughly6millionlines
ofcode,whichoccupyover230megabytesofdiskspace.Of
course,thisbookcancoveronlyaverysmallportionofthat
code.JusttofigureouthowbigtheLinuxsourceis,consider
thatthewholesourcecodeofthebookyouarereading
occupieslessthan3megabytes.Therefore,wewouldneed
morethan75bookslikethistolistallcode,withouteven

commentingonit!
Sowehadtomakesomechoicesaboutthepartstodescribe.
Thisisaroughassessmentofourdecisions:
Wedescribeprocessandmemorymanagementfairly
thoroughly.
WecovertheVirtualFilesystemandtheExt2andExt3
filesystems,althoughmanyfunctionsarejustmentioned
withoutdetailingthecode;wedonotdiscussother
filesystemssupportedbyLinux.
Wedescribedevicedrivers,whichaccountforroughly50%
ofthekernel,asfarasthekernelinterfaceisconcerned,
butdonotattemptanalysisofeachspecificdriver.
Thebookdescribestheofficial2.6.11versionoftheLinux
kernel,whichcanbedownloadedfromthewebsite
.
BeawarethatmostdistributionsofGNU/Linuxmodifythe
officialkerneltoimplementnewfeaturesortoimproveits


efficiency.Inafewcases,thesourcecodeprovidedbyyour
favoritedistributionmightdiffersignificantlyfromtheone
describedinthisbook.
Inmanycases,weshowfragmentsoftheoriginalcode
rewritteninaneasier-to-readbutlessefficientway.Thisoccurs
attime-criticalpointsatwhichsectionsofprogramsareoften
writteninamixtureofhand-optimizedCandassemblycode.
Onceagain,ouraimistoprovidesomehelpinstudyingthe
originalLinuxcode.
Whilediscussingkernelcode,weoftenendupdescribingthe
underpinningsofmanyfamiliarfeaturesthatUnixprogrammers

haveheardofandaboutwhichtheymaybecurious(shared
andmappedmemory,signals,pipes,symboliclinks,andsoon).




OverviewoftheBook
Tomakelifeeasier,Chapter1,Introduction,presentsageneral
pictureofwhatisinsideaUnixkernelandhowLinuxcompetes
againstotherwell-knownUnixsystems.
TheheartofanyUnixkernelismemorymanagement.Chapter
2,MemoryAddressing,explainshow80x86processorsinclude
specialcircuitstoaddressdatainmemoryandhowLinux
exploitsthem.
ProcessesareafundamentalabstractionofferedbyLinuxand
areintroducedinChapter3,Processes.Herewealsoexplain
howeachprocessrunseitherinanunprivilegedUserModeorin
aprivilegedKernelMode.TransitionsbetweenUserModeand
KernelModehappenonlythroughwell-establishedhardware
mechanismscalledinterruptsandexceptions.Theseare
introducedinChapter4,InterruptsandExceptions.
Inmanyoccasions,thekernelhastodealwithburstsof
interruptsignalscomingfromdifferentdevicesandprocessors.
Synchronizationmechanismsareneededsothatallthese
requestscanbeservicedinaninterleavedwaybythekernel:
theyarediscussedinChapter5,KernelSynchronization,for
bothuniprocessorandmultiprocessorsystems.
OnetypeofinterruptiscrucialforallowingLinuxtotakecareof
elapsedtime;furtherdetailscanbefoundinChapter6,Timing
Measurements.

Chapter7,ProcessScheduling,explainshowLinuxexecutes,in
turn,everyactiveprocessinthesystemsothatallofthemcan
progresstowardtheircompletions.
Nextwefocusagainonmemory.Chapter8,Memory
Management,describesthesophisticatedtechniquesrequiredto


handlethemostpreciousresourceinthesystem(besidesthe
processors,ofcourse):availablememory.Thisresourcemust
begrantedbothtotheLinuxkernelandtotheuser
applications.Chapter9,ProcessAddressSpace,showshowthe
kernelcopeswiththerequestsformemoryissuedbygreedy
applicationprograms.
Chapter10,SystemCalls,explainshowaprocessrunningin
UserModemakesrequeststothekernel,whileChapter11,
Signals,describeshowaprocessmaysendsynchronization
signalstootherprocesses.Nowwearereadytomoveonto
anotheressentialtopic,howLinuximplementsthefilesystem.A
seriesofchapterscoverthistopic.Chapter12,TheVirtual
Filesystem,introducesagenerallayerthatsupportsmany
differentfilesystems.SomeLinuxfilesarespecialbecausethey
providetrapdoorstoreachhardwaredevices;Chapter13,I/O
ArchitectureandDeviceDrivers,andChapter14,BlockDevice
Drivers,offerinsightsonthesespecialfilesandonthe
correspondinghardwaredevicedrivers.
Anotherissuetoconsiderisdiskaccesstime;Chapter15,The
PageCache,showshowacleveruseofRAMreducesdisk
accesses,thereforeimprovingsystemperformancesignificantly.
Buildingonthematerialcoveredintheselastchapters,wecan
nowexplaininChapter16,AccessingFiles,howuser

applicationsaccessnormalfiles.Chapter17,PageFrame
Reclaiming,completesourdiscussionofLinuxmemory
managementandexplainsthetechniquesusedbyLinuxto
ensurethatenoughmemoryisalwaysavailable.Thelast
chapterdealingwithfilesisChapter18,TheExt2andExt3
Filesystems,whichillustratesthemostfrequentlyusedLinux
filesystem,namelyExt2anditsrecentevolution,Ext3.
ThelasttwochaptersendourdetailedtouroftheLinuxkernel:
Chapter19,ProcessCommunication,introducescommunication
mechanismsotherthansignalsavailabletoUserMode
processes;Chapter20,ProgramExecution,explainshowuser
applicationsarestarted.


Last,butnotleast,aretheappendixes:AppendixA,System
Startup,sketchesouthowLinuxisbooted,whileAppendixB,
Modules,describeshowtodynamicallyreconfiguretherunning
kernel,addingandremovingfunctionalitiesasneeded.The
SourceCodeIndexincludesalltheLinuxsymbolsreferencedin
thebook;hereyouwillfindthenameoftheLinuxfiledefining
eachsymbolandthebook'spagenumberwhereitisexplained.
Wethinkyou'llfinditquitehandy.




BackgroundInformation
Noprerequisitesarerequired,exceptsomeskillinC
programminglanguageandperhapssomeknowledgeofan
assemblylanguage.





ConventionsinThisBook
Thefollowingisalistoftypographicalconventionsusedinthis
book:

ConstantWidth
Usedtoshowthecontentsofcodefilesortheoutputfrom
commands,andtoindicatesourcecodekeywordsthat
appearincode.

Italic
Usedforfileanddirectorynames,programandcommand
names,command-lineoptions,andURLs,andfor
emphasizingnewterms.


HowtoContactUs
Pleaseaddresscommentsandquestionsconcerningthisbookto
thepublisher:
O'ReillyMedia,Inc.
1005GravensteinHighwayNorth
Sebastopol,CA95472
(800)998-9938(intheUnitedStatesorCanada)
(707)829-0515(internationalorlocal)
(707)829-0104(fax)
Wehaveawebpageforthisbook,wherewelisterrata,
examples,oranyadditionalinformation.Youcanaccessthis

pageat:
/>Tocommentorasktechnicalquestionsaboutthisbook,send
emailto:

Formoreinformationaboutourbooks,conferences,Resource
Centers,andtheO'ReillyNetwork,seeourwebsiteat:



Safari®Enabled

WhenyouseeaSafari®Enabledicononthecoverof
yourfavoritetechnologybook,itmeansthebookisavailable
onlinethroughtheO'ReillyNetworkSafariBookshelf.
Safarioffersasolutionthat'sbetterthane-books.It'savirtual
librarythatletsyoueasilysearchthousandsoftoptechnology
books,cutandpastecodesamples,downloadchapters,and
findquickanswerswhenyouneedthemostaccurate,current
information.Tryitforfreeat.


Acknowledgments
Thisbookwouldnothavebeenwrittenwithouttheprecious
helpofthemanystudentsoftheUniversityofRomeschoolof
engineering"TorVergata"whotookourcourseandtriedto
decipherlecturenotesabouttheLinuxkernel.Theirstrenuous
effortstograspthemeaningofthesourcecodeledusto
improveourpresentationandcorrectmanymistakes.
AndyOram,ourwonderfuleditoratO'ReillyMedia,deservesa
lotofcredit.HewasthefirstatO'Reillytobelieveinthis

project,andhespentalotoftimeandenergydecipheringour
preliminarydrafts.Healsosuggestedmanywaystomakethe
bookmorereadable,andhewroteseveralexcellent
introductoryparagraphs.
Wehadsomeprestigiousreviewerswhoreadourtextquite
carefully.Thefirsteditionwascheckedby(inalphabeticalorder
byfirstname)AlanCox,MichaelKerrisk,PaulKinzelman,Raph
Levien,andRikvanRiel.
ThesecondeditionwascheckedbyErezZadok,Jerry
Cooperstein,JohnGoerzen,MichaelKerrisk,PaulKinzelman,Rik
vanRiel,andWaltSmith.
ThiseditionhasbeenreviewedbyCharlesP.Wright,Clemens
Buchacher,ErezZadok,RaphaelFinkel,RikvanRiel,andRobert
P.J.Day.Theircomments,togetherwiththoseofmanyreaders
fromallovertheworld,helpedustoremoveseveralerrorsand
inaccuraciesandhavemadethisbookstronger.
MarcoCesati
July2005
DanielP.Bovet





Chapter1.Introduction
Linux[*]isamemberofthelargefamilyofUnix-likeoperating
systems.Arelativenewcomerexperiencingsuddenspectacular
popularitystartinginthelate1990s,LinuxjoinssuchwellknowncommercialUnixoperatingsystemsasSystemVRelease
4(SVR4),developedbyAT&T(nowownedbytheSCOGroup);
the4.4BSDreleasefromtheUniversityofCaliforniaat

Berkeley(4.4BSD);DigitalUNIXfromDigitalEquipment
Corporation(nowHewlett-Packard);AIXfromIBM;HP-UXfrom
Hewlett-Packard;SolarisfromSunMicrosystems;andMacOSX
fromAppleComputer,Inc.BesideLinux,afewother
opensourceUnix-likekernelsexist,suchasFreeBSD,NetBSD,
andOpenBSD.
[*]LINUX®isaregisteredtrademarkofLinusTorvalds.

LinuxwasinitiallydevelopedbyLinusTorvaldsin1991asan
operatingsystemforIBM-compatiblepersonalcomputersbased
ontheIntel80386microprocessor.Linusremainsdeeply
involvedwithimprovingLinux,keepingitup-to-datewith
varioushardwaredevelopmentsandcoordinatingtheactivityof
hundredsofLinuxdevelopersaroundtheworld.Overtheyears,
developershaveworkedtomakeLinuxavailableonother
architectures,includingHewlett-Packard'sAlpha,Intel's
Itanium,AMD'sAMD64,PowerPC,andIBM'szSeries.
OneofthemoreappealingbenefitstoLinuxisthatitisn'ta
commercialoperatingsystem:itssourcecodeundertheGNU
GeneralPublicLicense(GPL)[ ]isopenandavailabletoanyone
tostudy(aswewillinthisbook);ifyoudownloadthecode(the
officialsiteis)orcheckthesourcesona
LinuxCD,youwillbeabletoexplore,fromtoptobottom,one
ofthemostsuccessfulmodernoperatingsystems.Thisbook,in
fact,assumesyouhavethesourcecodeonhandandcanapply


×