Scheduling Scheduling is the job of allocating cpu(central processing unit) time to different tasks within an operating system. Scheduling includes - : Process scheduling , kernel synchronization and symmetric multiprocessing .
Process scheduling Linux hastwo separateprocess-schedulingalgorithms . One is the time – sharingalgorithm for fair , preemptive scheduling amongmultiple processes ; the otheris designedfor real – time tasks, where absoluteprioritiesare more important than fairness. The Linux scheduler is a preemptive , priority – based algorithm with two separate priority ranges : a real- time range from 0 to 99 and a nice value ranging from 100 to 140 . These two ranges map into a global priority scheme whereby numerically lower values indicate higher priorities. there are two real time scheduling classes – first-come first-served (fcfs) and round-robin (rr)
Kernel synchronization Kernel synchronizationinvolves muchmore thanjust process scheduling . A framework is requiredthat allows kernel tasks to run without violatingthe integrityof shared data. Prior to version 2.6 , Linux was a non preemptive kernel , meaning that a process running in kernel mode could not be pre- empted – even if a higher-priority process became available to run . With version 2.6 , the linux kernel became fully preemptive ; so a task can now be pre-empted when it is running in the kernel . The Linuxkernelprovidesspinlocks and semaphores for lockingin the kernel. On single–processor machines spinlocks are inappropriatefor use and are replacedby enablingand disablingkernel pre-emption .
Symmetric multiprocessing The linux2. 0 kernelwas the first stablelinuxkernel to support symmetric multiprocessor(smp) hardware , allowing separateprocessesto executein parallelon separateprocessors . implementation Restriction– onlyone processat a time couldbe executingkernel- mode code . Version 2.2 In version2.2 of the kernel , a single kernel spinlockwas createdto allow multiple processes to be active in the kernel concurrently. Laterwiththe releases of the kernel made the (smp) implementation more scalable by splitting this single kernel spinlockinto multiple locks, eachof which protects the small subset of the kernel’s data structures.
Input and output Linuxsplitsalldevicesintothreedevices: blockde vices characterdevices networkdevices Definition Block devices – include all devices that allowrandom access to completelyindependent , fixed-sizedblocks of data, including hard disks and floppydisks, CD-ROMs and flashmemory. character devices– include most other devices, such as mice and keyboards. Network devices – are dealt withdifferentlyfromblockand characterdevices .
Block devices Blockdevicesprovidethemaininterfaceto alldiskdevicesina system. A blockrepresentstheunitwithwhichthekernelperformsI/o. Whena block isreadintomemory, it isstoredina buffer. The requestmanageris thelayerof softwarethatmanagesthe readingandwritingof buffer contentsto andfroma block-devicedriver. Scheduling of i/o versions A separate list of requests is kept for each block-device driver. Traditionally, these requestshave beenscheduled accordingto a unidirectional-elevator (c-scan) algorithmthat exploitsthe order in whichrequests are inserted in and removed fromthe list . The request lists are maintained in sorted orderof increasing starting – sector number . Whena request is acceptedfor processing by a block-device driver , it is not removed fromthe list. It is removed onlyafterthe i/o is complete, at whichpoint the driver continues withthe next request in the list , even if newrequests have been inserted intothe list before the activerequest .
Character devices A character–devicedrivercanbe almostanydevicedriverthatdoesnotofferrandomaccessto fixedblocksof data. Anycharacter– devicedrivers registeredto theLinuxkernelmustalsoregistera setof functionsthatimplementthefilei/ooperationsthatthe drivercanhandle. Thekernelperforms almostno preprocessingof a filereador writerequestto a characterdevice;it simplypassestherequestto thedevicein questionandletsthedevicedeal withtherequest. Line discipline A linedisciplineisan interpreterfortheinformationfromtheterminaldevice.Themostcommonlinedisciplineisthetty discipline, whichgluesthe terminal’sdatastreamontothestandardinput andoutputstreamsof a user’srunningprocesses, allowingthoseprocessesto communicatedirectlywith theuser’sterminal. Thisjob iscomplicatedbythefactthatseveralsuchprocessesmaybe runningsimultaneously, andthettylinedisciplineisresponsibleforattachingand detachingtheterminal’sinputandoutputfromthevariousprocessesconnectedto it asthoseprocessesaresuspendedor awakenedby theuser.
Thank you Effortsby sanidhyachugh Bca/25017/17 Source of information Operatingsystemconcepts 8th edition

Linux scheduling and input and output

  • 1.
    Scheduling Scheduling is thejob of allocating cpu(central processing unit) time to different tasks within an operating system. Scheduling includes - : Process scheduling , kernel synchronization and symmetric multiprocessing .
  • 2.
    Process scheduling Linux hastwoseparateprocess-schedulingalgorithms . One is the time – sharingalgorithm for fair , preemptive scheduling amongmultiple processes ; the otheris designedfor real – time tasks, where absoluteprioritiesare more important than fairness. The Linux scheduler is a preemptive , priority – based algorithm with two separate priority ranges : a real- time range from 0 to 99 and a nice value ranging from 100 to 140 . These two ranges map into a global priority scheme whereby numerically lower values indicate higher priorities. there are two real time scheduling classes – first-come first-served (fcfs) and round-robin (rr)
  • 3.
    Kernel synchronization Kernel synchronizationinvolvesmuchmore thanjust process scheduling . A framework is requiredthat allows kernel tasks to run without violatingthe integrityof shared data. Prior to version 2.6 , Linux was a non preemptive kernel , meaning that a process running in kernel mode could not be pre- empted – even if a higher-priority process became available to run . With version 2.6 , the linux kernel became fully preemptive ; so a task can now be pre-empted when it is running in the kernel . The Linuxkernelprovidesspinlocks and semaphores for lockingin the kernel. On single–processor machines spinlocks are inappropriatefor use and are replacedby enablingand disablingkernel pre-emption .
  • 4.
    Symmetric multiprocessing The linux2.0 kernelwas the first stablelinuxkernel to support symmetric multiprocessor(smp) hardware , allowing separateprocessesto executein parallelon separateprocessors . implementation Restriction– onlyone processat a time couldbe executingkernel- mode code . Version 2.2 In version2.2 of the kernel , a single kernel spinlockwas createdto allow multiple processes to be active in the kernel concurrently. Laterwiththe releases of the kernel made the (smp) implementation more scalable by splitting this single kernel spinlockinto multiple locks, eachof which protects the small subset of the kernel’s data structures.
  • 5.
    Input and output Linuxsplitsalldevicesintothreedevices: blockde vices characterdevices networkdevices Definition Blockdevices – include all devices that allowrandom access to completelyindependent , fixed-sizedblocks of data, including hard disks and floppydisks, CD-ROMs and flashmemory. character devices– include most other devices, such as mice and keyboards. Network devices – are dealt withdifferentlyfromblockand characterdevices .
  • 6.
    Block devices Blockdevicesprovidethemaininterfaceto alldiskdevicesinasystem. A blockrepresentstheunitwithwhichthekernelperformsI/o. Whena block isreadintomemory, it isstoredina buffer. The requestmanageris thelayerof softwarethatmanagesthe readingandwritingof buffer contentsto andfroma block-devicedriver. Scheduling of i/o versions A separate list of requests is kept for each block-device driver. Traditionally, these requestshave beenscheduled accordingto a unidirectional-elevator (c-scan) algorithmthat exploitsthe order in whichrequests are inserted in and removed fromthe list . The request lists are maintained in sorted orderof increasing starting – sector number . Whena request is acceptedfor processing by a block-device driver , it is not removed fromthe list. It is removed onlyafterthe i/o is complete, at whichpoint the driver continues withthe next request in the list , even if newrequests have been inserted intothe list before the activerequest .
  • 7.
    Character devices A character–devicedrivercanbealmostanydevicedriverthatdoesnotofferrandomaccessto fixedblocksof data. Anycharacter– devicedrivers registeredto theLinuxkernelmustalsoregistera setof functionsthatimplementthefilei/ooperationsthatthe drivercanhandle. Thekernelperforms almostno preprocessingof a filereador writerequestto a characterdevice;it simplypassestherequestto thedevicein questionandletsthedevicedeal withtherequest. Line discipline A linedisciplineisan interpreterfortheinformationfromtheterminaldevice.Themostcommonlinedisciplineisthetty discipline, whichgluesthe terminal’sdatastreamontothestandardinput andoutputstreamsof a user’srunningprocesses, allowingthoseprocessesto communicatedirectlywith theuser’sterminal. Thisjob iscomplicatedbythefactthatseveralsuchprocessesmaybe runningsimultaneously, andthettylinedisciplineisresponsibleforattachingand detachingtheterminal’sinputandoutputfromthevariousprocessesconnectedto it asthoseprocessesaresuspendedor awakenedby theuser.
  • 8.
    Thank you Effortsby sanidhyachugh Bca/25017/17 Source ofinformation Operatingsystemconcepts 8th edition