linux kernel overview 2013


Published on

linux kernel

Published in: Education, Technology
  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

linux kernel overview 2013

  1. 1. LINUX KERNELPresented by:Rohit Pratap SinghCS- 05/09Jorhat Engineering College
  2. 2. Background on LinuxLinus Torvalds– Creator of LinuxOpen Source Operating SystemFree SoftwareSource Code Available
  4. 4. KERNELArchitectureMonolithicContains allthe OSrelated stuff1. MicrokernelContains onlythe OS core2. HybridCombinationof Monolithic& Microkernel3.Linux Kernel is implemented using Monolithic Architecture
  5. 5. Difference
  6. 6. KERNEL MODULE Sections of kernel code that can be compiled, loaded, andunloaded independent of the rest of the kernel. A kernel module may typically implement a device driver, afile system, or a networking protocol. The module interface allows third parties to write anddistribute, on their own terms, device drivers or file systemsthat could not be distributed under the GPL. Kernel modules allow a Linux system to be set up with astandard, minimal kernel, without any extra device driversbuilt in. Three components to Linux module support:◦ module management◦ driver registration◦ conflict resolution
  7. 7. Module Management Supports loading modules into memory and lettingthem talk to the rest of the kernel. Module loading is split into two separate sections:◦ Managing sections of module code in kernelmemory◦ Handling symbols that modules are allowed toreference The module requestor manages loading requested,but currently unloaded, modules; it also regularlyqueries the kernel to see whether a dynamicallyloaded module is still in use, and will unload itwhen it is no longer actively needed.
  8. 8. Driver Registration Allows modules to tell the rest of the kernel that anew driver has become available. The kernel maintains dynamic tables of all knowndrivers, and provides a set of routines to allowdrivers to be added to or removed from thesetables at any time. Registration tables include the following items:◦ Device drivers◦ File systems◦ Network protocols◦ Binary format
  9. 9. Conflict Resolution A mechanism that allows different device drivers toreserve hardware resources and to protect thoseresources from accidental use by another driver The conflict resolution module aims to:◦ Prevent modules from clashing over access tohardware resources◦ Prevent auto probes from interfering with existingdevice drivers◦ Resolve conflicts with multiple drivers trying toaccess the same hardware
  10. 10. Linux Kernel FunctionalOverviewProcess ManagementMemory ManagementKernel SynchronizationFile System ManagementInter-process communicationDevice and I/O ManagementNetwork ManagementSecurity
  11. 11. Process ManagementLinuximplements thefork() and exec()process model.Process identity consists of-•Process ID (PID): unique identifier, used to specify theprocess to the kernel when an application makes a systemcall to signal, modify, or wait for another process.•Credentials: Each process must have an associated user IDand one or more group IDs that determine the process’s rightsto access system resources and files.•Personality: Not traditionally found on UNIX systems, butunder Linux each process has an associated personalityidentifier that can slightly modify the semantics of certainsystem calls.Used primarily by emulation libraries to request that systemcalls be compatible with certain specific flavors of UNIX.The process’s environment is inherited from itsparent, and is composed of two null-terminatedvectors:The argument vector lists the command-linearguments used to invoke the running program;conventionally starts with the name of theprogram itselfThe environment vector is a list of“NAME=VALUE” pairs that associates namedenvironment variables with arbitrary textualvalues.Process context: state of the runningprogram; includes scheduling context,accounting information, file table, file-systemcontext, signal-handler table, and virtualmemory context
  12. 12. Memory ManagementThe Linux kernelallocates memory toitself using the buddysystem as well as slaballocation.Virtual memory pagingsystem allocatesmemory to processes.The pageout-policyalgorithm decides whichpages to write out todisk.Uses a modifiedversion of thesecond-chance(clock) algorithm.Each page has anage that isadjusted on eachpass of the clock.The age valueallows thealgorithm to selectpages on a LRUpolicy.The paging mechanismactually carries out thetransfer, and pages databack into physicalmemory as needed:Supports pagingboth to dedicatedswap partitionsand to normal files.Uses a next-fitalgorithm to writepages tocontiguous diskblocks.
  13. 13. Splitting of Memory in a BuddyHeap
  14. 14. Kernel SynchronizationA request forkernel-modeexecution canoccur in two waysA running program mayrequest an operatingsystem service, eitherexplicitly via a systemcall, or implicitly, forexample, when a pagefault occurs.A device driver maydeliver a hardwareinterrupt that causes theCPU to start executing akernel-defined handler forthat interrupt.Kernelsynchronizationrequires aframework thatwill allow thekernel’s criticalsections to runwithoutinterruption byanother criticalsection.Linux introduceda preemptivekernel in Version2.6Linux providessemaphores for locking inthe kernel.Multiprocessor machinesuse spinlocks for shortdurations; singleprocessor machinesdisable preemptioninstead.
  15. 15. File System To the user, Linux’s file system appears as a hierarchicaldirectory tree obeying UNIX semantics. Internally, the kernel hides implementation details andmanages the multiple different file systems via an abstractionlayer, that is, the virtual file system (VFS). The Linux VFS is designed around object-oriented principlesand is composed of two components:◦ A set of definitions that define what a file object is allowedto look like The inode-object and the file-object structures representindividual files the file system object represents an entire file system◦ A layer of software to manipulate those objects.
  16. 16. The Linux Ext2fs File System Ext2fs uses a mechanism similar to that of BSD Fast FileSystem (ffs) for locating data blocks belonging to a specificfile. The main differences between ext2fs and ffs concern theirdisk allocation policies.◦ In ffs, the disk is allocated to files in blocks of 8Kb, withblocks being subdivided into fragments of 1Kb to storesmall files or partially filled blocks at the end of a file.◦ Ext2fs does not use fragments; it performs its allocations insmaller units. The default block size on ext2fs is 1Kb,although 2Kb and 4Kb blocks are also supported.◦ Ext2fs uses allocation policies designed to place logicallyadjacent blocks of a file into physically adjacent blocks ondisk, so that it can submit an I/O request for several diskblocks as a single operation.
  17. 17. Ext2fs Block-AllocationPolicies
  18. 18. More ext standards (theextended file system)• Journaling file system: keeps trackof changes to be made in a journal,which makes the system easier torestore after a crashext3:• Can pre-allocate on-disk space for afile• Provides timestamps measured innanosecondsext4:
  19. 19. Input and OutputDevice drivers appear as normal files.• Users open an access channel to a device in thesame way they open any other file.• Devices are protected by the same permissionsystem as files.Linux recognizes three classes of devices:• Block devices: allow random access to independent, fixed-size blocksof data (e.g. disks, CD-ROMs, flash memory)• Character devices: sequential access, data not necessarily in blocks• Network devices: users communicate with network devices throughthe kernel’s network subsystem
  20. 20. Interprocess CommunicationLinux informs processesthat an event hasoccurred via signals.• There is a limited number ofsignals, and they cannotcarry information.• Communication within thekernel is accomplished viascheduling states and waitqueue structures.Mechanisms for passingdata between processes:• The pipe mechanismallows a child process toinherit a communicationchannel to its parent, datawritten to one end of thepipe can be read a theother.• Shared memory: any data writtenby one process to a shared memory regioncan be read immediately by any otherprocess that has mapped that region into itsaddress space.
  21. 21. Network ManagementNetworking is a key area offunctionality for Linux.• It supports the standardInternet protocols forUNIX-to-UNIXcommunications.• It also implementsprotocols native to non-UNIX operating systems,e.g., Appletalk and IPX.Networking in the Linuxkernel is implemented bythree software layers:• Socket interface: workswith network addresses fora variety of networkprotocols• Protocol drivers:implements creation andreassembly of packets,routing between hosts, etc.• Network device drivers:interface with specificdevices
  22. 22. SecurityAuthentication: no one can access system without entryrights• Uses a password file to store encrypted passwords.• Pluggable authentication modules (PAM): allows on-demand loading ofauthentication modules that improve securityAccess control: no one can access objects within thesystem without access rights• Files, devices, and other objects share the same access-control system.• Implemented through numeric identifiers for users (UID) and groups (GID)• Objects have a protection mask that specifies which access modes (read,write, or execute) are granted to owner, group, and world.
  23. 23. Linux Source Tree Layout/usr/src/linuxDocumentationarchfsinit kernelincludeipcdriversnetmmlibscriptsalphaarmi386ia64m68kmipsmips64ppcs390shsparcsparc64acornatmblockcdromchardiofc4i2ci2oideieee1394isdnmacintoshmiscnet…adfsaffsautofsautofs4bfscodecramfsdevfsdevptsefsext2fathfshpfs…asm-alphaasm-armasm-genericasm-i386asm-ia64asm-m68kasm-mipsasm-mips64linuxmath-emunetpcmciascsivideo …adfsaffsautofsautofs4bfscodecramfsdevfsdevptsefsext2fathfshpfs …802appletalkatmax25bridgecoredecneteconetethernetipv4ipv6ipxirdakhttpdlapb…
  24. 24. Linux kernel developmentcycle
  25. 25. Linux kernel developmentcycle Version 0.01 (May 1991) had no networking, ran only on80386-compatible Intel processors and on PC hardware, hadextremely limited device-drive support, and supported onlythe Minix file system. Linux 1.0 (March 1994) included these new features:◦ Support for UNIX’s standard TCP/IP networking protocols◦ BSD-compatible socket interface for networkingprogramming◦ Device-driver support for running IP over an Ethernet◦ Enhanced file system◦ Support for a range of SCSI controllers forhigh-performance disk access◦ Extra hardware support Version 1.2 (March 1995) was the final PC-only Linux kernel.
  26. 26. Linux 2.0 Released in June 1996, 2.0 added two major newcapabilities:◦ Support for multiple architectures, including a fully 64-bitnative Alpha port.◦ Support for multiprocessor architectures Other new features included:◦ Improved memory-management code◦ Improved TCP/IP performance◦ Support for internal kernel threads, for handlingdependencies between loadable modules, and forautomatic loading of modules on demand.◦ Standardized configuration interface
  27. 27. ConclusionStabilityRuns onoldhardwareFree andopensourceSecurity
  28. 28. THANK YOUContact info –
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.