unit I operating system

Embed Size (px)

Citation preview

  • 8/13/2019 unit I operating system

    1/25

    Operating System 1 (ECS-501)

    Unit- I Introduction

    1.1 Operating System:

    An operating system is a program that manages the computer hardware. It aso pro!ides a "asis

    #or appication programs and acts as an intermediary "etween the computer user and the

    computer hardware.

    Components of Computer System:

    $he hardwarethe central processing unit (CU!" the memory" and the input#output

    (I#O! de$ices%pro!ides the "asic computing resources #or the system.

    $he application program de#ine the ways in which these resources are used to so!e

    users& computing pro"ems.

    $he operating system contros and coordinates the use o# the hardware among the

    !arious appication programs #or the !arious users.

  • 8/13/2019 unit I operating system

    2/25

    Operating System 2 (ECS-501)

    Operating system can %e e&plored from two $iew points:

    A. 'ser iew . System !iew

    '. User iew:

    *esigned mosty #or ease o# use.

    some attention paid to per#ormance.

    +one paid to resource utili)ation

    *. System iew:

    Operating system as a resource allocator (C,' time memory space #ie-storage space

    IO de!ices and so on.)

    Control program (manages the e/ecution o# user programs to pre!ent errors and

    improper use o# the computer.)

    1.+ Classification of Operating System:

    '. *atch Systems:

    ,&ecuting a series of no interacti$e similar types of o%sall at one time. $he term

    originated in the days when usersenteredprogramson punch cards. $hey woud gi!e a

    "atch o# these programmed cards to the systemoperator who woud #eed them into the

    computer.

    *atch o%s can %e stored up during woring hours and then e&ecuted during the

    e$ening or whene$er the computer is idle . atch processing is particuary use#u #or

    operations that reuire the computer or a periphera de!ice#or an e/tended period o#

    time. Once a "atch o" "egins it continues unti it is done or unti an error occurs. +ote

    that "atch processing impies that there is no interaction with the user whie the program

    is "eing e/ecuted.

    http://www.webopedia.com/TERM/E/execute.htmlhttp://www.webopedia.com/TERM/J/job.htmlhttp://www.webopedia.com/TERM/U/user.htmlhttp://www.webopedia.com/TERM/U/user.htmlhttp://www.webopedia.com/TERM/P/program.htmlhttp://www.webopedia.com/TERM/S/system.htmlhttp://www.webopedia.com/TERM/O/operator.htmlhttp://www.webopedia.com/TERM/C/computer.htmlhttp://www.webopedia.com/TERM/C/computer.htmlhttp://www.webopedia.com/TERM/S/store.htmlhttp://www.webopedia.com/TERM/S/store.htmlhttp://www.webopedia.com/TERM/P/peripheral_device.htmlhttp://www.webopedia.com/TERM/J/job.htmlhttp://www.webopedia.com/TERM/U/user.htmlhttp://www.webopedia.com/TERM/P/program.htmlhttp://www.webopedia.com/TERM/S/system.htmlhttp://www.webopedia.com/TERM/O/operator.htmlhttp://www.webopedia.com/TERM/C/computer.htmlhttp://www.webopedia.com/TERM/S/store.htmlhttp://www.webopedia.com/TERM/P/peripheral_device.htmlhttp://www.webopedia.com/TERM/E/execute.html
  • 8/13/2019 unit I operating system

    3/25

    Operating System 3 (ECS-501)

    *. /ulti rogrammed System:

    In 2utiprogramming se!eraprograms are run at the same time on a uniprocessor

    in an interlea$ed manner. Since there is ony one processor there can %e no true

    simultaneous e&ecution of different programs. $o the user it appears that a programs

    are e/ecuting at the same time.

    If the machine has the capa%ility of causing an interruptafter a specified time

    inter$al then the operating system wi e&ecute each program for a gi$en length of

    time regain contro and then e/ecute another program #or a gi!en ength o# time and so

    on. In the a%sence of this mechanism the operating system has no choice %ut to

    %egin to e&ecute a program with the e&pectation "ut not the certainty that the

    program wi e!entuay return contro to the operating system.

    http://searchcio-midmarket.techtarget.com/definition/processorhttp://whatis.techtarget.com/definition/0,,sid9_gci212374,00.htmlhttp://searchcio-midmarket.techtarget.com/definition/processorhttp://whatis.techtarget.com/definition/0,,sid9_gci212374,00.html
  • 8/13/2019 unit I operating system

    4/25

    Operating System 4 (ECS-501)

    C. 0ime Sharing System:

    3e#ers to the concurrent use o# a computer"y more than one user-- userssharethe

    computer&s time. Time sharing is synonymous with multi-user. It is aso caed

    interacti!e system.

    A time-sharing systemis one that aows mutipe users to share time on a singe computer.

    Each user is gi!en a time sliceo# C,' time (e.g. each user is ser!ed e!ery 0.1 s "y the

    computer).

    $he computer wor4s so #ast that each user seems to "e the soe user o# the computer.

    One e/ampe o# a time-sharing system is the "an4&s "an4card system which aows

    hundreds o# peope to access the same program on the main#rameat the same time.

    A time-sharing system that aows di##erent users to independenty run di##erent

    programs at the same time is aso caed a muti-user system.

    . /ultitasing Operating System :

    2utitas4ing operating system is a time sharing system that aso supports mutipe

    process per user.

    In mutitas4ing ony one C,' is in!o!ed "ut it switches from one program to

    another so 2uicly that it gi$es the appearance of e&ecuting all of the programs at

    the same time.

    ,. /ulti rocessor System (arallel System or 0ightly Coupled Systems!:

    http://www.webopedia.com/TERM/C/computer.htmlhttp://www.webopedia.com/TERM/U/user.htmlhttp://www.webopedia.com/TERM/M/multi_user.htmlhttp://www.wong-sir.com/cit/information_processing/mainframe.htmhttp://www.wong-sir.com/cit/information_processing/multiuser_system.htmhttp://www.webopedia.com/TERM/C/computer.htmlhttp://www.webopedia.com/TERM/U/user.htmlhttp://www.webopedia.com/TERM/M/multi_user.htmlhttp://www.wong-sir.com/cit/information_processing/mainframe.htmhttp://www.wong-sir.com/cit/information_processing/multiuser_system.htm
  • 8/13/2019 unit I operating system

    5/25

    Operating System 5 (ECS-501)

    Such systems ha!e two or more processors in cose communication within the same

    computer system sharing the computer "us and sometimes the coc4 memory and

    periphera de!ices.

    'd$antages:

    i. Increased throughput: y increasing the num"er o# processors we e/pect

    to get more wor4 done in ess time.

    ii. ,conomy of scale: Sa!e more money than mutipe singe processor system.

    iii. Increased relia%ility: $he #aiure o# one processor wi not hat the system

    ony sow it down.

    $he mutipe-processor systems in use today are o# two types.

    i. symmetric multiprocessing (S/!: each processor runs an identica copy o#

    the O.S. and these copies communicate with one another as needed (no master

    sa!e reationship e/ists "etween processors).

    ii. 'symmetric multiprocessing ('S/!:each processor is assigned a speci#ic

    tas4. A master processor contros the system the other processors either oo4 to

    the master #or instruction or ha!e prede#ined tas4s.

    3. istri%uted System:

    In a distri"uted system so#tware and data may"e distri"uted around the systemprograms and #ies may"e stored on di##erent storage de!ices which are ocated indi##erent geographica ocations and may"e accessed #rom di##erent computer

    terminas. $hese systems ha!e their own oca memory. $hey do not ha!e shared

    memory.

    Client Ser$er System:

    i. Centrai6ed systems act as ser$er systems to satis#y reuestgenerated "y cient system.

    ii. Ser!er systems may "e computer ser$er systems(ony reuest) or

    file ser$er systems (#ie read write create etc.)

  • 8/13/2019 unit I operating system

    6/25

    Operating System 6 (ECS-501)

    Client Ser$er system

    eer to eer System:

    i. ,rocessor communicates with one another through !arious

    communication ines such as high speed "uses or teephone ines.

    ii. ,eer to peer system may "e tighty couped (do not share memory

    or coc4 ha!e oca memory to communicate) or oosey couped(shara"e).

    4. Clustered system:

    7i4e mutiprocessor systems custered systems gather together mutipe C,'s to

    accompish computationa wor4. Custered systems di##er #rom mutiprocessor

    systems in mutiprocessor system two or more C,'s are tied together within a

    singe system through "us sharing memory IO and coc4 whie in distri"uted

    system two or more indi!idua system are tied together sharing the memory spacethrough 7A+.

    Custered computers share storage and are cosey in4 !ia 7A+ networ4ing.

    Custering is usuay used to pro!ide high-a$aila%ility. A ayer o# custer so#tware

    runs on the custer nodes. Each node can monitor one or more o# the others (o!er the

    7A+). I# the monitored machine #ais the monitoring machine can ta4e ownership o#

    its storage and restart the appications that were running on the #aied machine. $he

    users and cients o# the appications see ony a "rie# interruption o# ser!ice. istri%uted 5oc manager (5/!pro!ides access contro and oc4ing to the #ies

    to ensure no con#icting operations occurs.

    Custering can "e structured asymmetricay or symmetricay.

    i. In asymmetric clustering" one machine is in hot-stand%y mode whie the

    other is running the appications. $he hot-stand"y host machine does nothing "ut

  • 8/13/2019 unit I operating system

    7/25

    Operating System 7 (ECS-501)

    monitor the acti!e ser!er. I# that ser!er #ais the hot-stand"y host "ecomes the

    acti!e ser!er.

    ii. In symmetric mode" two or more hosts are running appications and are

    monitoring each other.

    6. 7eal 0ime System:

    A system is said to "e rea-time i# the tota correctness o# an operation depends not

    ony upon its ogica correctness "ut aso upon the time in which it is per#ormed.

    O3

    A rea-time system is a so#tware system where the correct #unctioning o# the system

    depends on the resuts produced "y the system and the time at which these resuts are

    produced.

    A rea-time operating system (3$OS) is an operating system (OS) intended to ser!e rea-

    time appication reuests

    0ypes of 7eal 0ime Systems

    1. hard real-time system

    A hard rea-time system is a system whose operation is incorrect i# resuts are not

    produced according to the timing speci#ication.

    8ard rea-time systems are used when it is imperati!e that an e!ent is reacted to

    within a strict deadine. Such strong guarantees are reuired o# systems #or which

    not reacting in a certain inter!a o# time woud cause great oss in some manner

    especiay damaging the surroundings physicay or threatening human i!es

    (athough the strict de#inition is simpy that missing the deadine constitutes#aiure o# the system). 9or e/ampe a car engine contro system is a hard rea-

    time system "ecause a deayed signa may cause engine #aiure or damage. . 8ard

    rea-time systems are typicay #ound interacting at a ow e!e with physica

    hardware. In these systems secondary storage are either imited or a"sent.OS is

    stored on 3O2 (3ead Ony 2emory).

  • 8/13/2019 unit I operating system

    8/25

    Operating System 8 (ECS-501)

    soft real-time system

    A so#t rea time system is a system whose operation is degraded i#

    resuts are not produced according to the speci#ied timing reuirements

    7ate competion o# o"s is undesira"e "ut not #ata.

    System per#ormance degrades as more : more o"s miss deadines.

    7i!e audio-!ideo systems are usuay so#t rea-time !ioation o# constraints

    resuts in degraded uaity "ut the system can continue to operate

    ,&amples of 70OS;

  • 8/13/2019 unit I operating system

    9/25

  • 8/13/2019 unit I operating system

    10/25

    Operating System 10 (ECS-501)

    algorithm. $he type o# scheduer is totay dependent on the operating system according

    to the desired o"ecti!e.

    /anagement of the random access memory; the operating system is responsi"e #or

    managing the memory space aocated to each appication and where ree!ant to each

    user. I# there is insu##icient physica memory the operating system can create a memory

    6one on the hard dri!e 4nown as B$irtual memoryB. $he !irtua memory ets you run

    appications reuiring more memory than there is a!aia"e 3A2 on the system.

    8owe!er this memory is a great dea sower.

    /anagement of input#output; the operating system aows uni#ication and contro o#

    access o# programmes to materia resources !ia dri!ers (aso 4nown as periphera

    administrators or inputoutput administrators).

    /anagement of e&ecution of applications; the operating system is responsi"e #or

    smooth e/ecution o# appications "y aocating the resources reuired #or them to operate.

    $his means an appication that is not responding correcty can "e B4iedB.

    /anagement of authori)ations; the operating system is responsi"e #or security reating

    to e/ecution o# programmes "y guaranteeing that the resources are used ony "y

    programmes and users with the ree!ant authori6ations.

    3ile management; the operating system manages reading and writing in the #ie system

    and the user and appication #ie access authori6ations.

    Information management; the operating system pro!ides a certain num"er o# indicators

    that can "e used to diagnose the correct operation o# the machine.

    1.< Operating System Structure:

    '. Simple Structure :

    http://en.kioskea.net/contents/pc/ram.php3http://en.kioskea.net/contents/pc/disque.php3http://en.kioskea.net/contents/repar/filesys.php3http://en.kioskea.net/contents/pc/ram.php3http://en.kioskea.net/contents/pc/disque.php3http://en.kioskea.net/contents/repar/filesys.php3
  • 8/13/2019 unit I operating system

    11/25

    Operating System 11 (ECS-501)

    In this the most #unctionaities are pro!ided in east space so it was not di!ided into

    modues care#uy.

    ,&ample: /S-OS System Structure

    2S-*OS written to pro!ide the most #unctionaity in the east space

    +ot di!ided into modues

    Athough 2S-*OS has some structure its inter#aces and e!es o# #unctionaity

    are not we separate.

  • 8/13/2019 unit I operating system

    12/25

    Operating System 12 (ECS-501)

    *. 5ayered Structure:

    $he operating system is di!ided into a num"er o# ayers (e!es) each "uit on top o#

    ower ayers. $he %ottom layer (layer =!" is the hardware the highest (layer ! is the

    user interface.

    An OS ayer is an impementation o# an a"stract o"ect that is the encapsuation o# data

    and operations that can manipuate those data. $hese operations (routines) can "e in!o4ed

    "y higher-e!e ayers. $he ayer itse# can in!o4e operations on ower-e!e ayers.

    7ayered approach pro!ides moduarity. >ith moduarity ayers are seected such that

    each ayer uses #unctions (operations) and ser!ices o# ony ower-e!e ayers.

    Each ayer is impemented "y using ony those operations that are pro!ided ower e!e

    ayers.

    $he maor di##icuty is appropriate de#inition o# !arious ayers.

    Layered Operating System.

  • 8/13/2019 unit I operating system

    13/25

    Operating System 13 (ECS-501)

    ,&ample: UI> System Structure

    '+I= imited "y hardware #unctionaity the origina '+I= operating system hadimited structuring. $he '+I= OS consists o# two separa"e parts.

    o Systems programs use 4erne supported system cas to pro!ide use#u #unctions

    such as compiation and #ie manipuation.o $he 4erne

    Consists o# e!erything "eow the system-ca inter#ace and a"o!e the

    physica hardware

    ,ro!ides the #ie system C,' scheduing memory management and

    other operating-system #unctions a arge num"er o# #unctions #or one

    e!e.

    9ernel:

  • 8/13/2019 unit I operating system

    14/25

    Operating System 14 (ECS-501)

    Derne is the core part o# the operating system. $his 4erne is in the inner ayer o# OS ayers and

    directy interacts with the hardware. It is responsi"e #or per#orming !arious #unctions reated to

    the hardware such as main memory management process management IO management andsecondary storage management. >hen a computer "oots up it goes through some initiai6ation

    #unctions such as chec4ing memory. It then oads the 4erne and switches contro to it. $he

    4erne then starts up a the processes needed to communicate with the user and the rest o# theen!ironment (e.g. the 7A+)

    $he 4erne is aways oaded into memory and 4erne #unctions aways run handing processes

    memory and de!ices.

    $he traditiona structure o# a 4erne is a layeredsystem such as 'ni/. In this a ayers are parto# the 4erne and each ayer can ta4 to ony a #ew other ayers. Appication programs and

    utiities i!e a"o!e the 4erne.

    0ypes of 9ernel:

    1. /onolithic ernel: In a monoithic 4erne a OS ser!ices such as process management

    memory management #ie management storage management : IO management run

    aong with the main 4erne thread thus aso residing in the same memory area.

    'd$antage:

    1. Easier to design

    2. 2ore e##icient due to the use o# shared 4erne memory.

    Disadvantage:

  • 8/13/2019 unit I operating system

    15/25

  • 8/13/2019 unit I operating system

    16/25

    Operating System 16 (ECS-501)

    *ue to the compe/ nature o# the modern operating systems it is partitioned into smaer

    component. Each component per#orms a we-de#ined #unction w

    ith we-de#ined inputs and outputs.

    2any modern operating systems ha!e the #oowing components.

    ,rocess 2anagement

    2ain 2emory 2anagement

    9ie 2anagement

    IO System 2anagement

    Secondary 2anagement

    +etwor4ing

    ,rotection System

    Command-Interpreter System

    '. rocess /anagement

    A process is a program in e/ecution. 9or e/ampe

    A "atch o" is a process

    A time-shared user program is a process

    A system tas4 (e.g. spooing output to printer) is a process.

    3emem"er a program itse# is not a process rather it is a passi!e entity.

    A process needs certain resources incuding C,' time memory #ies and IO de!icesto accompish its tas4. $hese resources are either gi!en to the process when it is created

    or when it is running. >hen the process competes the OS recaims a the resources.

    $he operating system is responsi"e #or the #oowing acti!ities in connection with

    process management.

    ,rocess creation and deetion.

    ,rocess suspension and resumption.

    ,ro!ision o# mechanisms #or;o ,rocess synchroni6ation

    o ,rocess communication

    *. /ain

  • 8/13/2019 unit I operating system

    17/25

    Operating System 17 (ECS-501)

    /emory /anagement

    2emory is a arge array o# words or "ytes each with its own address. It is a repository o#

    uic4y accessi"e data shared "y the C,' and IO de!ices.

    2ain memory is a !oatie storage de!ice. It oses its contents in the case o# system

    #aiure.

    $he operating system is responsi"e #or the #oowing acti!ities in connections with

    memory management;

    Deep trac4 o# which parts o# memory are currenty "eing used and "y whom.

    *ecide which processes to oad when memory space "ecomes a!aia"e.

    Aocate and deaocate memory space as needed.

    C. 3ile /anagement:

    2ost !isi"e component o# OS. Computers can store in#ormation on se!era di##erent

    types o# physica media (e.g. magnetic tape

    magnetic dis4 C* etc).

    9or con!enient use o# the computer system the OS pro!ides a uni#orm ogica !iew o#

    in#ormation storage.

    A #ie a ogica storage unit which a"stract away the physica properties o# its storage

    de!ice.

    A #ie is a coection o# reated in#ormation de#ined "y its creator. Commony #ies

    represent programs ("oth source and o"ect #orms) and data.

    $he operating system is responsi"e #or the #oowing acti!ities in connections with #ie

    management;

    9ie creation and deetion.

    *irectory creation and deetion.

  • 8/13/2019 unit I operating system

    18/25

    Operating System 18 (ECS-501)

    Support o# primiti!es #or manipuating #ies and directories.

    2apping #ies onto secondary storage.

    9ie "ac4up on sta"e (non!oatie) storage media.

    . I#O System /anagement

    'sed to manage IO de!ices and IO operations.

    $he IO system consists o#;

    A "u##er-caching system

    A genera de!ice-dri!er inter#ace

    *ri!ers #or speci#ic hardware de!ices

    ,. Secondary Storage management

    Since main memory (primary storage) is !oatie and too sma to accommodate a data

    and programs permanenty the computer system must pro!idesecondary storageto "ac4

    up main memory.

    2ost modern computer systems use dis4s as the principe on-ine storage medium #or

    "oth programs and data.

    $he operating system is responsi"e #or the #oowing acti!ities in connection with dis4

    management;

    9ree space management

    Storage aocation

    *is4 scheduing

    3. etworing (istri%uted Systems!

    A distributedsystem is a coection processors that do not share memory or a coc4.

    Each processor has its own oca memory.

    $he processors in the system are connected through a communication networ4.

  • 8/13/2019 unit I operating system

    19/25

    Operating System 19 (ECS-501)

    Communication ta4es pace using aprotocol.

    A distri"uted system pro!ides user access to !arious system resources.

    Access to a shared resource aows;

    Computation speed-up Increased data a!aia"iity

    Enhanced reia"iity

    4. rotection System

    Protectionre#ers to a mechanism #or controing access "y programs processes or users

    to "oth system and user resources.

    $he protection mechanism must;

    *istinguish "etween authori6ed and unauthori6ed usage.

    Speci#y the contros to "e imposed.

    ,ro!ide a means o# en#orcement.

    6. Command-Interpreter System

    2any commands are gi!en to the operating system "y contro statements which deawith;

    ,rocess creation and management

    IO handing

    Secondary-storage management

    2ain-memory management

    9ie-system access

    ,rotection

    +etwor4ing

    $he program that reads and interprets contro statements is caed !ariousy;

    Command-ine interpreter

    She (in '+I=)

  • 8/13/2019 unit I operating system

    20/25

    Operating System 20 (ECS-501)

    Its #unction is to get and e/ecute the ne/t command statement.

    1.A Operating System Ser$ices:

    rogram e&ecution system capa"iity to oad a program into memory and to run it.

    I#O operations since user programs cannot e/ecute IO operations directy the

    operating system must pro!ide some means to per#orm IO.

    3ile-system manipulation program capa"iity to read write create and deete #ies.

    Communications e/change o# in#ormation "etween processes e/ecuting either on the

    same computer or on di##erent systems tied together "y a networ4. Impemented !ia

    shared memoryor message passing.

    ,rror detection ensure correct computing "y detecting errors in the C,' and memory

    hardware in IO de!ices or in user programs.

    'dditional functionse/ist not #or heping the user "ut rather #or ensuring e##icient

    system operations.

    7esource allocation aocating resources to mutipe users or mutipe o"s running

    at the same time.

    'ccounting 4eep trac4 o# and record which users use how much and what 4inds o#computer resources #or account "iing or #or accumuating usage statistics.

    rotection ensuring that a access to system resources is controed

    1.B System Calls

    System cas pro!ide the inter#ace "etween a process and the operating system. $hese

    cas are generay a!aia"e as assem"y anguage instructions

    . Some systems aso aow to ma4e system cas #rom a high e!e anguage such as

    C.$hey are used to aow user e!e processes to reuest ser!ices o# the OS.'ser

    programs communicate with an OS : reuests ser!ices #rom it "y ma4ing system

    cas.each system ca has a i"rary procedure that the user program cas.

  • 8/13/2019 unit I operating system

    21/25

    Operating System 21 (ECS-501)

    0ypes of System Calls:

    0he $arious types of system calls are as gi$en :

  • 8/13/2019 unit I operating system

    22/25

    Operating System 22 (ECS-501)

  • 8/13/2019 unit I operating system

    23/25

    Operating System 23 (ECS-501)

  • 8/13/2019 unit I operating system

    24/25

    Operating System 24 (ECS-501)

    1. System rograms:

    System programs pro!ide a con!enient en!ironment #or program de!eopment and

    e/ecution. Some o# them are simpy user inter#aces to system cas.

    Types of system programs :

  • 8/13/2019 unit I operating system

    25/25

    Operating System 25 (ECS-501)

    < 1;Dhat is the distinction %etween ernel mode and user mode in operating system.

    Answer:. Certain instructions coud "e e/ecuted ony when the C,' is in 4erne mode.

    Simiary hardware de!ices coud "e accessed ony when the program is e/ecuting in 4erne

    mode. Contro o!er when interrupts coud "e ena"ed or disa"ed is aso possi"e ony when theC,' is in 4erne mode. Conseuenty the C,' has !ery imited capa"iity when e/ecuting in

    user mode