1. introduction to os & unix

Upload: mwandida

Post on 05-Jul-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/16/2019 1. Introduction to OS & Unix

    1/72

    1. Introduction to OS andUnix

    With introduction to the

    module

    1

  • 8/16/2019 1. Introduction to OS & Unix

    2/72

    Module Overview Programmes: Diploma in elecommunications and

    !lectronics !ngineering Module itle: U"I# and $ Programming Module $ode: $I%U$P%&%1  'ear: & $redit: 1( )ecturer ) *amwendo+ (,,-/,(

    l0amwendopol2.ac.mw )ectures 34rs5W06: &

     utorials: 1 Prere7uisites: $I%I$%1%1 Module 8im

     he module provides the student with the necessar2 s0ills towrite structured programs using the $ programming languageand understand U"I# Operating s2stem &

  • 8/16/2019 1. Introduction to OS & Unix

    3/72

    Intended )earningOutcomes

    On completion o9 this module+ the student should eale to:

    a. 4ave a asic understanding o9 U"I# operating s2stem;

    . Use a wor0station 9or writing and deugging programsin $;

    c. Solving engineering prolems using $.

    /

  • 8/16/2019 1. Introduction to OS & Unix

    4/72

    Indicative $ontenta.Algorithm & Flow

    Charts

    b.Introduction to OS &Unix

    c.Basic commands of

    Unix

    d.Editing; undr Unix.!ariabls & "ata

    #$%s

    f. O%rators &

    Ex%rssions.Control Flow

    h.Arra$s

    i. ointr

     '. Function(.String O%rations

    l. Fils

    m.Shll rogramming

    n.S$stms Calls

    -

  • 8/16/2019 1. Introduction to OS & Unix

    5/72

    8ssessment and )earning

    Methods 8ssessment

    !xamination

  • 8/16/2019 1. Introduction to OS & Unix

    6/72

    Prescried text >oo0s 4orvath 4.*. 31,,-6. $ Program Design 9or

    !ngineers. &nd edition. 8ddison Wesle2; IS>"%1/: ,?(&(1. W. and Aitchie D. M. 31,??6. he $

    Programming )anguage. Prentice 4all; IS>"%1/:

    ,?(1/11(/@& Bott9ried >. Programming in $+ Schaum series.

    Second !dition. McBraw%4ill; IS>"%1/: ,?%(((&-(/

  • 8/16/2019 1. Introduction to OS & Unix

    7/72

    OS 8n OS is a program which acts as an

    interface etween computer s2stem usersand the computer hardware.

    It provides a user%9riendl2 environment in

    which a user ma2 easil2 develop andexecute programs.

    Otherwise+ hardware 0nowledge would e

    mandator2 9or computer programming. So+ it can e said that an OS hides the

    complexit2 o9 hardware 9rom uninterested

    users.

  • 8/16/2019 1. Introduction to OS & Unix

    8/72

    9unctions controls the ac0ing store and peripherals such

    as scanners and printers deals with the trans9er o9 programs in and out

    o9 memor2 organises the use o9 memor2 etween

    programs organises processing time etween programs

    and users

    maintains securit2 and access rights o9 users deals with errors and user instructions allows the user to save les to a ac0ing store provides the inter9ace etween the user and the

    computer issues simple error messages?

  • 8/16/2019 1. Introduction to OS & Unix

    9/72

    computer s2stem resources

    In general+ a computer s2stem hassome resources which ma2 e

    utiliCed to solve a prolem. he2 are Memor2 Processor3s6

    I5O File S2stem etc.

  • 8/16/2019 1. Introduction to OS & Unix

    10/72

    computer s2stem resources

    Mainboard

  • 8/16/2019 1. Introduction to OS & Unix

    11/72

    Motheroard

  • 8/16/2019 1. Introduction to OS & Unix

    12/72

    Motheroard

    mainboard

  • 8/16/2019 1. Introduction to OS & Unix

    13/72

    processor

  • 8/16/2019 1. Introduction to OS & Unix

    14/72

    A8M

  • 8/16/2019 1. Introduction to OS & Unix

    15/72

    OS services

     he OS manages these resources andallocates them to specic programs and users.

    With the management o9 the OS+ aprogrammer is rid o9 diGcult hardwareconsiderations.

     8n OS provides services 9or Processor Management Memor2 Management File Management Device Management $oncurrenc2 $ontrol

  • 8/16/2019 1. Introduction to OS & Unix

    16/72

    1@

    8 0ernel connects the applicationso9tware to the hardware o9 a

    computer

  • 8/16/2019 1. Introduction to OS & Unix

    17/72

    predened lirar2

    8nother aspect 9orthe usage o9 OS is

    that; it is used as a predened library  9orhardware%so9twareinteraction.

     his is wh2+ s2stemprograms appl2 tothe installed OS

    since the2 cannot

     Application Programs

    System Programs

    Operating System

    Machine Language

    HARDWARE

  • 8/16/2019 1. Introduction to OS & Unix

    18/72

    hides the complexit2

    Since we have an alread2 writtenlirar2+ namel2 the OS+ to add two

    numers we simpl2 write the9ollowing line to our program:

    c H a ;

  • 8/16/2019 1. Introduction to OS & Unix

    19/72

    hides the complexit2

    in a s2stem where there is no OS installed+ weshould consider some hardware wor0 as:

    38ssuming an M$ @?(( computer hardware6

    )D88 J?(  )oading the numer at memor2 location ?(

    )D8> J?1  )oading the numer at memor2 location ?1

    8DD>  8dding these two numers

    S88 J

  • 8/16/2019 1. Introduction to OS & Unix

    20/72

    Portailit2

    In an OS installed machine+ since wehave an intermediate la2er+ ourprograms otain some advantage of

    mobility  2 not dealing withhardware.

     For example+ the aove program

    segment would not wor0 9or an ?(?@machine+ where as the

     Kc H a ;L

    s2ntax will e suitale 9or oth.

  • 8/16/2019 1. Introduction to OS & Unix

    21/72

    hides the complexit2

     A simple program

    segment with no

    hardware

    consideration

     A more

    sophisticated

    program segment

    with hardware

    consideration

    Hardware

    responseOS Machine

    )anguag

    e

  • 8/16/2019 1. Introduction to OS & Unix

    22/72

    virtual 3extended6 machine

    With the advantage o9 easier programmingprovided 2 the OS+ the hardware+ its machinelanguage and the OS constitutes a newcomination called as a )irtual *xtndd+machin.

    Machine

    Language

    Hardware

    Machine

    Language

    Hardware

    Operating

    System

    Machine

    Virtual

    (Extended

    Machine

  • 8/16/2019 1. Introduction to OS & Unix

    23/72

    0ernel mode vs user mode

    In a more simplistic approach+ in 9act+ OS itsel9is a program.

    >ut it has a priorit2 which application programsdont have.

    OS uses the (rnl mod o9 themicroprocessor+ whereas other programs usethe usr mod.

     he diNerence etween two is that; all hardwareinstructions are valid in 0ernel mode+ where

    some o9 them cannot e used in the user mode.

  • 8/16/2019 1. Introduction to OS & Unix

    24/72

    4istor2 o9 Operating S2stems

    It all started with computer hardware inaout 1,-(s.

    E!"A# $%&'

  • 8/16/2019 1. Introduction to OS & Unix

    25/72

    4istor2 o9 Operating S2stems

    !"I8$ 3!lectronic "umerical Integratorand $omputer6+ at the U.S. 8rm2s

    8erdeen Proving Bround in Mar2land. uilt in the 1,-(s+ weighed /( tons+

    was eight 9eet high+ three 9eet deep+ and1(( 9eet long

    contained over 1?+((( vacuum tues thatwere cooled 2 ?( air lowers.

  • 8/16/2019 1. Introduction to OS & Unix

    26/72

    4istor2 o9 Operating S2stems

    $omputers were using vacuum tuetechnolog2.

    E!"A#s )acuum tubes

  • 8/16/2019 1. Introduction to OS & Unix

    27/72

    4istor2 o9 OperatingS2stems

    E!"A#s bac*side

  • 8/16/2019 1. Introduction to OS & Unix

    28/72

    1.& 4istor2 o9 Operating S2stems

    Programs were loaded into memory manually using switches+ punched

    cards+ or paper tapes,

    E!"A# - coding by cable connections

  • 8/16/2019 1. Introduction to OS & Unix

    29/72

    4istor2 o9 OperatingS2stems

    punch card

  • 8/16/2019 1. Introduction to OS & Unix

    30/72

    4istor2 o9 OperatingS2stems

    s or2 o pera ng

  • 8/16/2019 1. Introduction to OS & Unix

    31/72

    s or2 o pera ngS2stems

    Paper tape

    s or2 o pera ng

  • 8/16/2019 1. Introduction to OS & Unix

    32/72

    s or2 o pera ngS2stems

  • 8/16/2019 1. Introduction to OS & Unix

    33/72

    1.& 4istor2 o9 Operating S2stems

    Babbage’s analytical engine

    (designed in 1840’s by !arles Babbage" b#t c$#ld n$t be c$nstr#cted by !im%

    An earlier and simpler &ersi$n is c$nstr#cted in '00'" in $nd$n )

    http-..www,computerhistory,org.babbage.

    http://www.computerhistory.org/babbage/http://www.computerhistory.org/babbage/

  • 8/16/2019 1. Introduction to OS & Unix

    34/72

    4istor2 o9 Operating S2stems

    8da )ovalence 3at time o9 $harles>aage6 wrote code 9or anal2ticalengine to compute >ernulli "umers

    4i 9 O i

  • 8/16/2019 1. Introduction to OS & Unix

    35/72

    4istor2 o9 OperatingS2stems

    8s time went on+ card readers+ printers+and magnetic tape units were developed

    as additional hardware elements. 8ssemlers+ loaders and simple utilit2

    liraries were developed as so9tware

    tools. )ater+ oN%line spooling and channel

    program methods were developed

    se7uentiall2.

  • 8/16/2019 1. Introduction to OS & Unix

    36/72

    4istor2 o9 Operating S2stems

    #ommodore PE/+

    $%00

  • 8/16/2019 1. Introduction to OS & Unix

    37/72

    4istor2 o9 Operating S2stems

    Finall2+ the idea o9 multi%rogramming came.

    Multiprogramming means sharing o9resources etween more than oneprocesses.

    >2 multiprogramming the $PU+ time isnot wasted+ ecause+ while one processmoves on some I5O wor0+ the OS pic0s

    another process to execute till the current

  • 8/16/2019 1. Introduction to OS & Unix

    38/72

    4istor2 o9 Operating S2stems

    With the development o9 interactivecomputation in 1,(s+ tim,sharing

    s$stms emerged. In these s2stems+ multiple users have

    terminals 3not computers6 connected to a

    main computer  and execute her tas0 inthe main computer.

  • 8/16/2019 1. Introduction to OS & Unix

    39/72

    4istor2 o9 Operating S2stems

    /erminals are connected to

    the main computer and used

    1or input and output, !oprocessing is made, /hey do

    not ha)e #P2s,

    Main computer3 ha)ing a

    #P2 executing processes by

    utili4ation o1 the OS+ (e,g,

    2!"5,

  • 8/16/2019 1. Introduction to OS & Unix

    40/72

    4istor2 o9 Operating S2stems

    8nother computer s2stem is themulti%rocssor s$stm having

    multiple processors sharing memor2 andperipheral devices.

    With this conguration+ the2 have

    greater computing power and higherreliailit2.

  • 8/16/2019 1. Introduction to OS & Unix

    41/72

    4istor2 o9 Operating S2stems

    Multiprocessor s2stems are classied intotwo as tightl2%coupled and loosel2%

    coupled 3distriuted6.  In the tightl2%coupled one+ each

    processor is assigned a specic dut2 ut

    processors wor0 in close association+possil2 sharing the same memor2.

    In the loosel2 coupled one+ each

    processor has its own memor2 and cop2

  • 8/16/2019 1. Introduction to OS & Unix

    42/72

    4istor2 o9 Operating S2stems

    Use o9 the networ0s re7uired OSs appropriate 9orthem.

    In ntwor( s$stms+ each process runs in itsown machine ut the OS have access to othermachines.

    >2 this wa2+ le sharing+ messaging+ etc. ecame

    possile. In networ0s+ users are aware o9 the 9act that s5he

    is wor0ing in a networ0 and when in9ormation isexchanged. he user explicitl2 handles the

    trans9er o9 in9ormation.

  • 8/16/2019 1. Introduction to OS & Unix

    43/72

    4istor2 o9 Operating S2stems

    Each is a computer ha)ing its own#P2+ 6AM+ etc, An OS supporting

    networ*s is installed on them,

    i 9 i

  • 8/16/2019 1. Introduction to OS & Unix

    44/72

    4istor2 o9 Operating S2stems

    "istributd s$stms are similar to networ0s.4owever in such s2stems+ there is no need toexchange in9ormation explicitl2+ it is handled2 the OS itsel9 whenever necessar2.

    With continuing innovations+ new architecturesand compatile OSs are developed. >ut theirdetails are not in the scope o9 this course sincethe oective here is to give onl2 a generalview aout developments in OS concept.

    ommon s

  • 8/16/2019 1. Introduction to OS & Unix

    45/72

    ommon s Windows

    Windows is an operating s2stem owned and operated 2

    Microso9t. It diNers 9rom open source s2stems in that onl2 Microso9t has

    the ailit2 to ma0e changes to the code. 4owever+ it also diNers 9rom Mac OS # in that it can e installed

    on a variet2 o9 diNerent computers 9rom a host o9 competing

    manu9acturers+ oNering the user more 9reedom o9 choice whenit comes to hardware.

    8ccording to "et Mar0et Share+ Windows is the most widel2used operating s2stem

    Mac OS # While a version o9 Mac OS # comes pre%installed on all 8pple

    Macintosh computers+ users must pa2 i9 the2 wish to use newerversions when the2 ecome availale.

     he s2stem is not open source+ so onl2 8pple developers havethe ailit2 to legitimatel2 ma0e alterations or improvements toits code. -<

  • 8/16/2019 1. Introduction to OS & Unix

    46/72

    $ommon OSs

    8ndroid 8ndroid is a QmoileQ operating s2stem maintained

    2 the Open 4andset 8lliance+ a group o9companies and organiCations that contriute to thes2stems development under the management o9Boogle Inc

     he s2stem is an Qopen standard+Q meaning that an

    entire communit2 o9 developers can alter theso9tware+ not ust Boogle. 8ndroid comes pre%installed on smartphones and talet P$s 9or which itwas designed.

    -@

    $ommon OSs

  • 8/16/2019 1. Introduction to OS & Unix

    47/72

    $ommon OSs )inux

    )inux is a 9amil2 o9 open%source operating

    s2stems+ which means the2 can e modied anddistriuted 2 an2one around the world.

     his is diNerent 9rom proprietar2 so9tware li0eWindows+ which can onl2 e modied 2 the

    compan2 that owns it 3Microso9t6.  he advantages o9 )inux are that it is 9ree+ and

    there are man2 diNerent distriutionsRor versionsR2ou can choose 9rom.

    !ach distriution has a diNerent loo0 and 9eel+ andthe most popular ones include Ubuntu- int- andFdora.

    )inux is named a9ter )inus orvalds+ who created

    the )inux 0ernel in 1,,1. -

  • 8/16/2019 1. Introduction to OS & Unix

    48/72

    -?

  • 8/16/2019 1. Introduction to OS & Unix

    49/72

    Mar0et share

    -,

    &(1/ worldwide device shipments 2 operatings2stemWhitne2+ )ance 3 anuar2 &(1-6. Q8ndroid device shipments to top 1

    illion this 2ear %% BartnerQ.

    What is Unix T

  • 8/16/2019 1. Introduction to OS & Unix

    50/72

    What is Unix T  he U"I# operating s2stem is a set o9 programs

    that act as a lin0 etween the computer andthe user.

     he computer programs that allocate thes2stem resources and coordinate all the details

    o9 the computers internals is called theoperating s2stem or 0ernel.

    Users communicate with the 0ernel through a

    program 0nown as the shll. he shll is acommand line interpreter; it translatescommands entered 2 the user and convertsthem into a language that is understood 2 the

    0ernel.

  • 8/16/2019 1. Introduction to OS & Unix

    51/72

    8out Unix Unix was originall2 developed in 1,@, 2 a

    group o9 8 emplo2ees at >ell )as+including *en hompson+ Dennis Aitchie+Douglas McIlro2+ and oe Ossanna.

     here are various Unix variants availale inthe mar0et. Solaris Unix+ 8I#+ 4P Unix and>SD are 9ew examples. /inux is also a Vavoro9 Unix which is 9reel2 availale.

    Several people can use a U"I# computer atthe same time; hence U"I# is called amultiuser s2stem.

    8 user can also run multiple programs at thesame time; hence U"I# is called multitas0ing.

  • 8/16/2019 1. Introduction to OS & Unix

    52/72

    Unix 8rchitecture 4ere is a asic loc0 diagram o9  a U"I#

    s2stem

  • 8/16/2019 1. Introduction to OS & Unix

    53/72

    Main Parts o9 Unix  he main concept that unites all versions o9 U"I# is

    the 9ollowing 9our asics 0rnl1  he 0ernel is the heart o9 the operating

    s2stem. It interacts with hardware and most o9 thetas0s li0e memor2 management+ tas0 schedulingand le management.

    Shll1 he shell is the utilit2 that processes 2our

    re7uests. When 2ou t2pe in a command at 2ourterminal+ the shell interprets the command andcalls the program that 2ou want. he shell usesstandard s2ntax 9or all commands. $ Shell+ >ourne

    Shell and *orn Shell are most 9amous shells which

  • 8/16/2019 1. Introduction to OS & Unix

    54/72

    Main Parts o9 Unix

    Commands and Utilitis1 here are variouscommand and utilities which 2ou would use in2our da2 to da2 activities. cp+ mv+ cat and grepetc. are 9ew examples o9 commands and utilities.

     here are over &

  • 8/16/2019 1. Introduction to OS & Unix

    55/72

    0ernel is the !ngine o9 an2 Operating S2stem+ so allthe vital 9unctions should e controlled and

    managed 2 0ernel itsel9. here are various tas0sand 9unctions o9 a 0ernel ut some o9 the importantare given elow:

    2. 3sourc allocation, he 0ernels primar2 9unction is

    to manage the computers resources and allow otherprograms to run and use these resources. heseresources are% $PU+ Memor2 and I5O devices.

    4. rocss anagmnt, 8 process deneswhich memor2 portions the application canaccess. he main tas0 o9 a 0ernel is to allow theexecution o9 applications and support them with9eatures such as hardware astraction.

     o run an application+ a 0ernel rst set up an address space 9or the

    application+ then loads the le containing the applications code

  • 8/16/2019 1. Introduction to OS & Unix

    56/72

    *!A"!)5. mor$ anagmnt, he 0ernel has 9ull access to

    the s2stems memor2. It allows processes to sa9el2

    access this memor2 as the2 re7uire it.6. I7O ")ic anagmnt, o per9orm use9ul

    9unctions+ processes need access to the peripheralsconnected to the computer+ which are controlled 2

    the 0ernel through Device Drivers. 8 d)ic dri)r isa computer program that enales the operatings2stem to interact with a hardware device. It providesthe operating s2stem with in9ormation o9 how tocontrol and communicate with a certain piece o9

    hardware.A (rnl maintains a list of a)ailabl d)ics. 8 devicemanager rst per9orms a scan on diNerent hardware uses+such as Peripheral $omponent Interconnect 3P$I6 or UniversalSerial >us 3US>6+ to detect installed devices+ then searches 9orthe appropriate drivers. he 0ernel provides the I5O to allow

  • 8/16/2019 1. Introduction to OS & Unix

    57/72

    *!A"!)8. Intr, rocss Communication, *ernel

    provides methods 9or S2nchroniCation and$ommunication etween processes+ called Inter%Process $ommunication 3IP$6. here are variousapproaches o9 IP$ sa2+ semaphore+ sharedmemor2+ message 7ueue+ pipe 3or named 9o6+

    etc.

    9. Schduling, In a Multitas0ing s2stem+ the 0ernelwill give ever2 program a slice o9 time and switch9rom process to process so 7uic0l2 that it willappear to the user as i9 these processes wereeing executed simultaneousl2. he 0ernel usesScheduling 8lgorithms to determine whichprocess is running next and how much time it wille given. he algorithm sets priorit2 among the

  • 8/16/2019 1. Introduction to OS & Unix

    58/72

    :. S$stm Calls and Intrru%t andling, 8s2stem call is a mechanism that is used 2 the

    application program to re7uest a service 9rom theoperating s2stem. S2stem calls include close+open+ read+ wait and write. o access the servicesprovided 2 the 0ernel we need to invo0e the

    related 0ernel 9unctions. Most 0ernels provide a $)irar2 or an 8PI+ which in turn invo0es the related0ernel 9unctions.

  • 8/16/2019 1. Introduction to OS & Unix

    59/72

     he U"I# Files2stem  he tas0 o9 the les2stem is to provide a wa2 to

    store data+ in an organised structure+ and

    retrieve it when re7uested On one s2stem+ there ma2 e a large

    accounting application+ which will store details

    o9 nancial transactions.  8t the other end o9 the scale+ an individual ma2

    use a s2stem to store private letters+ or collegenotes.

    Someone else ma2 store an address oo0+phone numers+ and their diar2 on the s2stem.O9 course+ one s2stem could e used 9or an2 orall o9 these applications+ and endless others.  he all have one thin in common: the need to

  • 8/16/2019 1. Introduction to OS & Unix

    60/72

    the le concept  he asic unit o9 the les2stem is+ as 2ou ma2

    guess+ the le.  o understand the concept o9 a le+ thin0 o9 a lan0

    piece o9 paper.  8t rst+ it contains nothing. 4owever+ 2ou can write on it+

    and 2ou can write an2thing. Similarl2+ a le ma2 e

    empt2+ or it ma2 contain an2 amount o9 data. he data itcontains can e an2thing+ 9or example a list o9 phonenumers+ a letter to a customer+ or 2our compan2saccounts. In eNect+ a le is ust li0e a piece o9 paper % themain diNerence is that it ma2 store an2 amount o9 data.

     he onl2 other thing to note aout les is that eachone has a name

    !ver2thing in Unix is considered to e a le+

    including ph2sical devices such as DXD%AOMs+ US>@(

  • 8/16/2019 1. Introduction to OS & Unix

    61/72

    the le concept

    8 le is a named collection o9 relatedin9ormation+ usuall2 as a se7uence o9

    2tes+ with two views: )ogical 3programmers 6 view+ as the

    users see it.

    Ph2sical 3operating s2stem6 view+ as itactuall2 resides on secondar2 storage.

    @1!xplain the le concept o9 Unix.

    File attriutes

  • 8/16/2019 1. Introduction to OS & Unix

    62/72

    File attriutes !ach le is associated with a collection

    o9 in9ormation+ 0nown as attriutes:  "8M!+ owner+ creator t2pe 3e.g.+ source+ data+ inar26 location 3e.g.+ I%node or dis0 address6 organiCation 3e.g.+ se7uential+ indexed+

    random6 access permissions

    time and date 3creation+ modication+ andlastcaccessed6

    siCe variet2 o9 other 3e.g.+ maintenance6

    in9ormation @&

    File operations

  • 8/16/2019 1. Introduction to OS & Unix

    63/72

    File operations  here are six asic operations 9or le

    manipulation: create+ write+ read+ delete+ reposition r5w

    pointer 3a.0.a. see06+ and truncate 3not ver2common.6

    @/

    File t2pes

  • 8/16/2019 1. Introduction to OS & Unix

    64/72

    2p 8 common implementation techni7ue 3as

    organiCational help with consistent usage6 is to

    include the t2pe as an extension to the lename:

    Music+ video le t2pes Files are structured internall2 to meet the

    expectations o9 the program3s6 that manipulate@-

  • 8/16/2019 1. Introduction to OS & Unix

    65/72

    File access methods

     he in9ormation stored in a le can e accessedin a variet2 o9 methods: Se7uential: in order+ one record a9ter another.  Direct 3random6: in an2 order+ s0ipping the

    previous records. *e2ed: in an2 order+ ut with particular

    value3s6; e.g.+ hash tale or dictionar2. )>

    loo0up is one example o9 a 0e2ed search. Other access methods+ such as indexed+ can e

    uilt on top o9 the aove asic techni7ues.I>Ms indexed se7uential access method 3IS8M6

    is uilt on random and se7uential access.@<

    !ver2thing is a le

  • 8/16/2019 1. Introduction to OS & Unix

    66/72

    !ver2thing is a le !ver2thing is a leQ descries one o9 the dening

    9eatures o9 Unix+ and its derivatives R that a widerange o9 input5output resources such asdocuments+ directories+ hard%drives+ modems+0e2oards+ printers and even some inter%process

    and networ0 communications are simple streams o92tes exposed through the les2stem name space Unix does not distinguish etween diNerent t2pes

    o9 le.

     he advantage o9 this approach is that the sameset o9 tools+ utilities and 8PIs can e used on a widerange o9 resources.

    @@

    Understand that Unix does notdistinguish etween diNerent t2pes o9

    le.

    Directories

  • 8/16/2019 1. Introduction to OS & Unix

    67/72

    ec o es 8 director2 is a s2mol tale+ which can e

    searched 9or in9ormation aout the les. 8lso+

    it is the 9undamental wa2 o9 organiCing les. Usuall2+ a director2 is itsel9 a le. 8 t2pical director2 entr2 contains in9ormation

    3attriutes6 aout a le. Director2 entries areadded as les are created+ and are removedwhen les are deleted.

    $ommon director2 structures are:  Single%level 3Vat6: shared 2 all users.  wo%level: one level 9or each user.  ree: aritrar2 3su6%tree 9or each user.

    @

    U"I# director2 structure

  • 8/16/2019 1. Introduction to OS & Unix

    68/72

    U"I# uses an advanced 9orm o9 tree structure+0nown as directed ac2clic%graph 3D8B6 director2

    @?

    he Files2stem 3eg6

  • 8/16/2019 1. Introduction to OS & Unix

    69/72

     he Files2stem 3eg6

    /

     bin etc home/ tmp usr

    hollid2 scully bin etc

    netprog unix X ls who

  • 8/16/2019 1. Introduction to OS & Unix

    70/72

    File sharing 8llowing users to share les raises a maor issue:

    %rotction. 8 general approach is to provide controlled access to

    les through a set o9 operations such as rad- writ-dlt- list+ and a%%nd. hen permit users toper9orm one or more operations.

    One popular protection mechanism is a condensed

    version o9 access list+ where the s2stem recogniCesthr classi=cations of usrs with each le anddirector2: user group

    (

    File s2stem services

  • 8/16/2019 1. Introduction to OS & Unix

    71/72

    2 8 le s2stem provides a mapping etween the

    logical and ph2sical views o9 a le+ through a

    set o9 services and an inter9ace. Simpl2 put+ thele s2stem hids all th d)ic,s%ci=cas%cts o9 le manipulation 9rom users.

     he asic services o9 a le s2stem include: 0eeping trac0 o9 les 30nowing location6+ I5O support+ especiall2 the transmission

    mechanism to and 9rom main memor2+ management o9 secondar2 storage+ sharing o9 I5O devices+ providing protection mechanisms 9or

    in9ormation held on the s2stem. 1

    File s2stem astraction

  • 8/16/2019 1. Introduction to OS & Unix

    72/72

    File s2stem astraction