& ' prtn ytmCnet 11Slesht n Galvin and Silberschatz 21.1 Concepts System Operating • • • • • • • • • nepoesCommunication Interprocess System I/O System File Management Memory Management Process Interface User Interface Programmer Principles Design History oue2:TeUI System The 21: Module c 1998 $  & ' prtn ytmCnet 12Slesht n Galvin and Silberschatz 21.2 Concepts System Operating • • • •

h hr eso a rte nC hc a eeoe tBell at developed was support which to C, specifically in Labs written was version third The h otifleta ftennBl asadnon– and Labs non-Bell the of influential most The eea tnadzto rjcsse ocnoiaetevariant of the flavors consolidate to seek projects standardization Several eeomn rus—Uiest fClfri tBerkeley at ( California of University — groups development etrso te prtn ytm,especially systems, operating incorporated other Laboratories; of Bell features at Ritchie Group Dennis Research and the Thompson Ken of by 1969 in developed First – Distributions Software Berkeley – standard esos n a enpre omn te platforms. other many to ported been has and versions, eeoe o the for Developed BDUNIX 4BSD UNIX UNIX eutdfrom resulted edn ooepormigitraeto interface programming one to leading ytmfrgvrmn use. government for system VAX History , 4.3BSD UNIX DARPA ). . soeo h otinfluential most the of one is udn odvlpa develop to funding MULTICS T TUNIX AT&T UNIX . . c 1998 $  & ' prtn ytmCnet 13Slesht n Galvin and Silberschatz 21.3 Concepts System Operating 1993 1992 1991 1990 1989 1988 1987 1986 1985 1984 1983 1982 1981 1980 1979 1978 1977 1976 1973 1969 PDP-11 Chorus Chorus PWB 4.0.1 3.0.1

itr fUI Versions UNIX of History USG / USDL / ATTIS 5.2 5.0 3.0

V3 DSG / USO USL UNIX/RT ETCB UNIX MERT System III VAX Release 3 Release 2 System V Release 4 System V System V System V UNIX XENIX 5 XENIX 3 XENIX OSF/1 Seventh Edition Sixth Edition Fifth Edition First Edition Mach Solaris 2 Solaris SunOS SunOS SunOS

4 3

Research Bell Labs 32V Edition Edition Edition Plan 9 Eighth Tenth Ninth VAX 4.1aBSD 4.1cBSD 4.4BSD 4.3BSD 4.3BSD 4.3BSD 4.2BSD 4.0BSD 4.1BSD Tahoe

3BSD

Reno

Distributions

Software Berkley 2.10BSD PDP-11 2.9BSD 2.8BSD 1BSD 2BSD c 1998 $  & ' prtn ytmCnet 14Slesht n Galvin and Silberschatz 21.4 Concepts System Operating • • • • ml ie oua,cendesign. clean modular, size, Small platform. inexpensive an on primitives operating-system powerful Provided form. source in Distributed language. high-level a in Written al datgso UNIX of Advantages Early c 1998 $  & ' prtn ytmCnet 15Slesht n Galvin and Silberschatz 21.5 Concepts System Operating • • • • • • ihpirt ie omkn ytmitrcie n providing development. and program interactive, for system facilities making to given priority High new create easily can processes. process a processes; multiple Supports sequences unstructured as bytes. kernel of the by supported are Files directories. tree-structured multilevel with system File be can that (shell) interface replaced. user standard simple a Has system. time-sharing a be to Designed NXDsg Principles Design UNIX c 1998 $  & ' prtn ytmCnet 16Slesht n Galvin and Silberschatz 21.6 Concepts System Operating iems optrsystems, computer most Like • • rvd sflfntos uha oplto n file and compilation manipulation. as such to functions, calls useful system provide kernel-supported the use programs: Systems enl vrtigblwtesse-alitraeadabove hardware. and physical interface the system-call the below everything Kernel: – rvdsfiesystem, file Provides aaeet n other and management, rgamrInterface Programmer CPU UNIX OS ceuig memory scheduling, ossso w eaal parts: separable two of consists ucin hog ytmcalls. system through functions c 1998 $  & ' prtn ytmCnet 17Slesht n Galvin and Silberschatz 21.7 Concepts System Operating character I/O system terminal controllers signals terminal terminal drivers terminals handling

.BDLyrStructure Layer 4.3BSD

system-call interface to the kernel system-call kernal interface to the hardware compilers and interpreters shells and commands disk and tape drivers swapping block I/O device controllers disks and tapes system libraries (the users) system memory controllers page replacement physical memory CPU scheduling demand paging virtual memory c 1998 $  & ' prtn ytmCnet 18Slesht n Galvin and Silberschatz 21.8 Concepts System Operating

• • • • ogl he aeoiso ytmclsin calls system of categories three Roughly the that context support. must the define kernel interface user and programmer The interface user h e fssesporm omnyaalbedfie the defines available commonly programs systems of set The the define calls System – – – nomto manipulation Information control Process device support also manipulation) calls system (same manipulation File .

ytmCalls System rgamrinterface programmer UNIX to . UNIX c 1998 $  & ' prtn ytmCnet 19Slesht n Galvin and Silberschatz 21.9 Concepts System Operating

• • • • • ahname Path find to how on files. information other contain that files are Directories rt,coe nik trunc unlink, close, manipulation: write, file basic for calls System ie r raie ntree-structured in organized are Files files. on structure ietr tutr otefile. the to structure directory A

– – file eaiept ae tr ttecretdirectory current the at start system names file path of Relative root at start names path Absolute sasqec fbts h enlde o moea impose not does kernel the bytes; of sequence a is dnie l yseiyn ahtruhthe through path a specifying by file a identifies : ieManipulation File

. directories ra,oe,read, open, creat, . c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.10 Concepts System Operating • • • • A calls system control Process rcs xt eoetetriae child. terminated the before exits process rcse r dnie ytheir by identified are Processes A

–wait3 – –exit execve – –fork

zombie process rvdstepoesi fatriae hl ota the terminated that child so which child tell terminated can a parent of id process the provides may parent A program new a with space memory virtual processes’s bu h child the about emntsaprocess a terminates rae e process new a creates losteprn ocletpromnestatistics performance collect to parent the allows rcs eut hnteprn fa of parent the when results process sapormi execution. in program a is sue fe okt elc n ftetwo the of one replace to fork a after used is wait rcs Control Process

o hl rcs oterminate; to process child a for

rcs identifier, process defunct ninteger. an wait child c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.11 Concepts System Operating hl rcs aetpoesshell process parent process shell process child process lutaino rcs oto Calls Control Process of Illustration fork program execve program executes exit wait zombie process c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.12 Concepts System Operating

• • •

init l srpoessaedsednso n rgnlprocess, original one of init descendants are processes user descriptor. All file a by accessed are that processes two n assteuser’s the passes and rcse omnct via communicate Processes – –

. xctsa executes user the of login commands. ok a forks

estenumeric the sets getty

rcs oto Cont’d Control Process shell rcs;iiilzstria ieparameters line terminal initializes process;

hc ok upoessfruser for subprocesses forks which

oi name login

sridentifier user pipes

uuso ye between bytes of queues ; to login ftepoest that to process the of . c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.13 Concepts System Operating

• • riaypiiee hl tl en xctbeb ordinary by executable users. being still while privileges ordinary identifier srietfiro h we ftefie n evsthe leaves and file, the of owner the of identifier user setuid ceealw eti rcse ohv oethan more have to processes certain allows scheme i esteefcieue dnie ftepoest the to process the of identifier user effective the sets bit si was. it as

rcs oto Cont’d Control Process eluser real c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.14 Concepts System Operating • • • inluehsepne eoddaigwt exceptional with events. dealing beyond expanded has use Signal ˆC). by produced (usually completes command that The software to interrupts. similar conditions exceptional handling for Facility – – –

tr n tpsbrcse ndemand on subprocesses stop and Start eie retdt rmntokconnections. network from data urgent Deliver size. changed has displayed being is output SIGWINCH interrupt signal, nom rcs httewno nwhich in window the that process a informs SIGINT Signals sue oso omn before command a stop to used is , c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.15 Concepts System Operating • • • n time. any cest h emnli otoldb rcs ru signals. group process by controlled is terminal the to Access nyoepoesgopmyueatria eiefor device terminal a use may group process one Only a accomplish to task. cooperate common that processes related of Set

– –

Background The terminal. ucinwtotue interaction. user without function foreground os–nntahdjb htpromtheir perform that jobs nonattached – jobs rcs Groups Process o a h teto fteue nthe on user the of attention the has job I/O at c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.16 Concepts System Operating • ahjbihrt a inherits job Each – – – ru fapoes htpoesi nteforeground. the in is process the that matches process, terminal a controlling of the group of group process the If perform process, tepst perform to attempts SIGSTOP SIGTTIN I/O or SIGCONT ree oerudprocess. foreground a freezes rcs rus(Cont’d) Groups Process

.

SIGTTOU otoln terminal controlling niae httepoescnnow can process the that indicates I/O ree akrudpoesthat process background a freezes fteue oerud that foregrounds user the if ; rmisparent. its from c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.17 Concepts System Operating • • • rcse a s for ask can Processes time: current the gettimeofday return and set to Calls ytmclst e n euna nevltimer: interval an return getitimer and set to calls System – – – h aeo h ahn nwihte r executing: are they which on gethostname machine the of name the identifier: group their hi rcs identifier: process their / setitimer nomto Manipulation Information / settimeofday . getgid getpid . c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.18 Concepts System Operating • • • ucin,ntokacs,dt ovrin etc. conversion, data access, mathematical network for functions, provided is support library Additional structures calls. data system complex in of used definition the provide files Header routines library of collection large a by h ytmcl nefc to interface system-call The irr Routines Library UNIX sspotdadaugmented and supported is c 1998 $  & ' prtn ytmCnet 11 ibrcazadGalvin and Silberschatz 21.19 Concepts System Operating • • • omtes(.. troff, (e.g., formatters te rgasrlt oeios(e.g., editors to relate programs Other directory or file are oriented. user. programs the systems to common obvious most be The to need not do and embedded program are the calls within system needed existing the already programs; with systems deal mainly users and Programmers – –

Directory: File:

, cp

, mkdir mv

, rm ,

srInterface User rmdir TEX

,adohractivities. other and ), , cd

,

pwd mc,vi emacs, ,text ), c 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.20 Concepts System Operating

• • • • • • h directories The executed. and loaded then is which file, Shell erhpath. search h hl rvltruhthe through travel shell file. The object binary executable an is command typical single A a on command a types user the line. and command prompt, another a accept typing to by readiness its indicates shell The kernel. the surrounds it because shell, a Called interpreter). command h srpoeswiheeue rgas(localled (also programs executes which process user the –

hlsadCommands and Shells /bin

and

/usr/bin erhpath search arealmostalwaysinthe ofidtecommand the find to c 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.21 Concepts System Operating • •

h hl sal upnsisoneeuinutlthe until execution completes. own command its suspends usually shell The a on path search Typical hm/rfaibn/s/oa/i urub/i urbn) /usr/bin /bin /usr/ucb /usr/local/bin /home/prof/avi/bin . ( hlsadCmad (Cont’d) Commands and Shells BSD system: c 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.22 Concepts System Operating

• • • lsaeoe o h standard redirection what the for changing for open syntax are simple files a have shells common The terminal) output. a standard than and (rather input file standard a for accept also can programs Most otpoessepc he l ecitr ob pnwhen open be to start: descriptors they file three expect processes Most

– – –

tnaderror standard output standard input standard . ro output error – rga a edwa h srtypes user the what read can program – rga a edotu oue’ screen user’s to output send can program – tnadI/O Standard I/O tem fapoes— process a of streams I/O c 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.23 Concepts System Operating aeprogram make % % %lpr %pr %ls Command > < < filea filea fileb > fileb tnadIORedirection I/O Standard > errs &

tnaderri file a in error standard nu from input of output direct command of Meaning nu from input aebt tnadotu and output standard both save

fileb filea

n uptto output and ls

ofile to

filea fileb c 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.24 Concepts System Operating

• • • • idwSse sawdl cetdioi nefc for interface iconic accepted widely a is System Window X or kernel the interface. change programmer would not semantics but view, and user syntax different the a change with shell new a Writing it. on processing some performing output, standard its Filter UNIX h hl ops h rvoscmadsotu siptt the to input as output command’s command. previous following tells the that pass bar to vertical shell a the via commands individual coalesce Can . omn uhas such command a – ieie,Fles n hl Scripts Shell and Filters, Pipelines,

%

ls pr

| htpse t tnadiptto input standard its passes that pr

| lpr c 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.25 Concepts System Operating • • • blocks. hs rcse r ersne in represented are processes These ease. with manipulated and created be can UNIX ersnaino rcse samjrdsg rbe for problem design systems. major operating a is processes of Representation – – nomto nteecnrlbok sue ytekre for kernel the by and used control is process blocks control these in Information the in stored are process kernel. a with associated blocks Control sdsic rmohrssesi htmlil processes multiple that in systems other from distinct is rcs Management Process CPU scheduling. UNIX yvroscontrol various by c 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.26 Concepts System Operating

• • • vr rcs ihsaal ethsapitrfo t process its from pointer a a to has structure text sharable with process Every segments. stack and data, code), (program structure process The h otbscdt tutr soitdwt rcse sthe is processes with associated structure data basic most The – – – – – –

on nds hni sswapped be is can it segment when text disk the on for found table page the segment text where the records using are processes many how records memory main in resident always onest te oto blocks control other to pointers priority) (e.g., information scheduling identifier process unique ita drs space address virtual

rcs oto Blocks Control Process etstructure text . faue rcs sdvddit text into divided is process user a of . c 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.27 Concepts System Operating • • rcs srsdn skp nthe in the kept when is only resident needed is is process that process the about Information memory. physical to memory virtual process’ The – – –

anan h urn ietr n h al foe files open of table the and directory current the maintains kernel the by space writable address virtual user into read-only mapped aetables page rcs oto lcs(Cont’d) Blocks Control Process

eodifraino h apn rmthe from mapping the on information record srstructure user

(or structure u c ). 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.28 Concepts System Operating

• • • •

ytmdt segment data system in performed A execute never process a of simultaneously. phases user and system The h enlsakadteue tutr oehrcmoethe compose together structure user the and stack kernel The mode. system in executing process otodnr oki oein done is work ordinary Most

enlstack kernel ytmmode system ytmDt Segment Data System rte hnteue tc)i sdfra for used is stack) user the than (rather o h process. the for

. srmode user ytmclsare calls system ; c 1998 $  & ' prtn ytmCnet 12 ibrcazadGalvin and Silberschatz 21.29 Concepts System Operating idn at fapoesuigpoesstructure process using process a of parts Finding resident tables structure structure process text structure swappable process image stack data user text system data structure user space kernel stack c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.30 Concepts System Operating • n oisteue structure. user the copies and fork – – – sradgopietfir,sga adig etc. handling, signal identifiers, descriptors, group file and open user preserves structure user the copying stack process and child data the the of for segments allocated is memory main new constructed is table page new loae e rcs tutr o h hl process, child the for structure process new a allocates loaigaNwPoesStructure Process New a Allocating c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.31 Concepts System Operating • • • • etaddt ftepoesaereplaced. are process the of data and text execve both in occurs change until memory processes any since dangerous be can sn edfracp fteparent. Using the of copy a for need no is hl uses child uses process parent A e rcs ipysae h aetbeo h l one. old the of table page the shares simply process new vfork loaigaNwPoesSrcue(Cont’d) Structure Process New a Allocating – – omnyue yaselt xct omn n to and command completion a its execute for to wait shell a by used commonly still are structure process new created a and structure user new does vfork rae onwpoeso srsrcue ahr the rather, structure; user or process new no creates

execve not ihalreprn rcs saves process parent large a with oytedt n tc otenwpoes the process; new the to stack and data the copy execve ocag t ita drs pc,s there so space, address virtual its change to vfork occurs. opoueacidpoes the process; child a produce to CPU ie but time, c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.32 Concepts System Operating

• • • • •

r u nterayqeet erun. be to queue ready the in put are sleep eaiefebc in feedback Negative priority. lower indicate numbers larger hnapoescosst eiqihthe relinquish to chooses process a When starvation. prevent to employed is aging Process igepoest aealthe all take to process single hnta vn cus h ytmpoesta nw about knows that calls process it system the occurs, event that When and vr rcs a a has process Every all

nan on wakeup

rcse hthddn a done had that processes event ihteadescrepnigt h event, the to corresponding address the with .

P Scheduling CPU ceuigpriority scheduling CPU ceuigmksi ifiutfra for difficult it makes scheduling CPU

time. sleep soitdwt it; with associated ntesm address same the on CPU tge to goes it , c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.33 Concepts System Operating • • • Pre- loaino ohmi eoyadsa pc sdone is space swap and first-fit. memory main both of available. Allocation is memory enough until contention, out much swapped too are is processes there If processes: among contention ahnso which on machines ieb h eaieysalmmr eore fthe of resources memory small relatively in the constrained by were size schemes management memory initial The 3BSD ytm s wpigecuieyt adememory handle to exclusively swapping use systems eoyManagement Memory UNIX a developed. was PDP c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.34 Concepts System Operating • • • In in time etc. idle, size, memory, time main as factors of such out considering or out, or in swap to eemndb h ieo h wpsaepriino h disk. the size on maximum partition a swap-space to the up of size, size minimum the a by and determined 2 of power a of eurdfrmlil rcse sn h aetx segment. The text same the memory using main processes of multiple for amount required in the results reduces swapped; and be traffic swap to less need not do segments text Sharable

4.3BSD ceue process scheduler wpsaei loae npee htaemultiples are that pieces in allocated is space swap , eoyMngmn (Cont’d) Management Memory

(or swapper eie hc processes which decides ) c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.35 Concepts System Operating

• • • •

fthe If processes. to executing frames the free support enough keep to algorithm page-replacement paging Demand A the into read is main page of frame disk proper a frame. occurs, the kernel and the allocated, is to fault memory page a there, not is eodrl nswapping. on secondarily only depend and management, memory-contention rcse ilb wpe u hl ni h vrodis overload the until whole relieved. out swapped be will processes Berkeley

pagedaemon scheduler UNIX ytm eedpiaiyo aigfor paging on primarily depend systems rcs ssamdfidsecond-chance modified a uses process eie httepgn ytmi overloaded, is system paging the that decides hnapoesnesapg n h page the and page a needs process a When – Paging c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.36 Concepts System Operating • • ersnaino l stebasic the the is so file format, a special of a representation with files just are Directories directories. The UNIX l ytmspot w anojcs lsand files objects: main two supports system file ieSystem File UNIX concept. c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.37 Concepts System Operating • • blocks: 4.2BSD oto h l ytmi ae pby up taken is system file the of Most

– – – h atboki naporaemlil fasmaller a of multiple appropriate fragment an is block last The last. the except l h lcso l r falarge a of are file a of blocks the All n n Kfamn wihwudntb le completely). filled be not blocks would 8K (which two have fragment would 2K bytes one 18,000 and size of file a Thus, uses

ie(.. 04 ofilottefile. the out fill to 1024) (i.e., size two lcsadFragments and Blocks

lc ie o lswihhv oindirect no have which files for sizes block

aablocks data block ie(uha 8K), as (such size . c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.38 Concepts System Operating • • lc iei K(yia hie r 06:52and 512 : 1024). 4096 : are minimum choices 8192 the (typical 1; 4K is : size block 8 is ratio block-to-fragment maximum The system: file the of use intended the to according creation The – –

frpae rnfr flrefie r xetd h basic large. the be expected, should are size files block large of transfers repeated If should size fragment the small. expected, be are files small many If block lcsadFamns(Cont’d) Fragments and Blocks

and fragment ie r e uigfile-system during set are sizes c 1998 $  & ' prtn ytmCnet 13 ibrcazadGalvin and Silberschatz 21.39 Concepts System Operating • • h nd locnan 5pitr oteds blocks contents. disk data the file’s to the pointers containing 15 contains also The disk. the on file specific a about information l srpeetdb an by represented is file A – –

∗ ∗ is 2pitto point 12 First ettrepitto point three Next ∗

s22btswl s nydul indirection. double many only as use with will files bytes needed; 232 not as is pointer indirect triple blocks. A data contain actual that blocks the of to addresses pointers the contains that block a block indirect is nietbokpitri h drs fa of address the is pointer block indirect First eodi a is data. Second contain do that blocks of obeidrc-lc pointer, double-indirect-block

nidxbokcnann h addresses the containing block index an — ietblocks direct nietblocks indirect

Inodes inode . eodta stores that record a — .

h drs of address the single c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.40 Concepts System Operating • • • ytmue h nd sisdfiiino file. a of file definition the whereas its name, as path inode a the by uses file system a to refers user The inode the and name file the then entry, number. the contains of entry length each the length; first variable of are entries Directory and files plain between directories. distinguishes field type inode The – – ietre r sdfrti mapping. this for used are an Directories to name path user supplied the inode. map to has kernel The Directories c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.41 Concepts System Operating

• • • • aecache name inode. the 4.3BSD neteioei on,a found, is inode the Once is returned. name is path inode the desired of the end and the reached until continues process search The is eemn h trigdirectory: starting the determine First – – o n te trigcaatr h trigdrcoyi the is directory directory. starting current the character, starting other any root For the is directory starting the “/”, directory. is character first the If mrvdfiesse efrac yadn a adding by performance system file improved ohl eetdrcoyt-nd translations. directory-to-inode recent hold to

ietre (Cont’d) Directories l structure file

salctdt on to point to allocated is directory c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.42 Concepts System Operating • • • • • eal tbo ie hr safie ii ntenme of number system. the on a in limit fixed files only a open is is concurrently which there length time, fixed boot a at has setable table file open inode. the the Since to points turn structure. in file structure a file to This pointer a contains table the of entry Each of table a process. index current to the kernel for the files by open used is descriptor file The passing by argument. file an as the indicate descriptor files file open a to refer that calls System apn faFl ecitrt nInode an to Descriptor File a of Mapping c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.43 Concepts System Operating user space read (4, ...) ieSse oto Blocks Control File-System (per process) open files tables of ytmsaedisk space system space file-structure table in-core inode list sync . . . blocks inode data list c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.44 Concepts System Operating • • attoigapyia eieit utpefiesseshas systems file benefits. multiple several into device physical a Partitioning device. h n l ytmta srodnrl esmyactually may sees ordinarily several user of a consist that system file one The – – – – –

attosfo tape. restoring and from tapes partitions backup on searches up Speeds a for space file. available large all using from program one Prevents parameters. file-system varying by efficiency improve Can improved. is uses.Reliability different support can systems file Different physical ikStructures Disk l ytm,ec nadifferent a on each systems, file c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.45 Concepts System Operating • • •

eie,wihaepriin fpyia devices. physical of logical partitions onto are mapped which are devices, which is systems, file structure into directory partitioned a how illustrates figure following The system. file root the of hierarchy directory te l ytm a be may systems file Other The otfiesystem file root ikSrcue (Cont’d) Structures Disk

sawy vial nadrive. a on available always is mounted .. nertdit the into integrated i.e., — c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.46 Concepts System Operating apn ieSse oPyia Devices Physical to System File Mapping oia iesse iesseslgcldvcsphysical devices logical devices file systems logical file system swap root c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.47 Concepts System Operating • • • • pe,adicue e features. new included and speed, nrae rm52btst 04bts—icesdinternal increased throughput. — doubled bytes but 1024 fragmentation, to bytes 512 from increased 4.2BSD In changed. free-list information of superblock details and the file handling and maximum increased, the sizes doubled, file-system and of size the 7, Version For user. the be on to effect itself significant defined, system without well file changed and the simple of is implementation system the file allowing the to interface user The – truncate – – 4.0BSD atFl ytmfudi otipeettosof implementations most in found System File Fast calls. system directory New de h eklyFs ieSse,wihincreased which System, File Fast Berkeley the added h ieo lcsue ntefiesse was system file the in used blocks of size the , calls. Implementations UNIX . c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.48 Concepts System Operating • • art dniyafile. a identify to pair h lcsi file. a in blocks the . BSD 4.3 h enlue a uses kernel The – – – – h ndsi h l ytmaenmee nsequence. in numbered are system file the in involved. inodes system The file the defines number device logical The ra fioe,adsm aablocks. data an some block, and cylinder inodes, a of superblock, array a has group cylinder movement.Every head the disk within minimal accesses require disk group that cylinder so disk, consecutive the more of or cylinders one occupies group cylinder Each nrdcdthe introduced aotadAlcto Policies Allocation and Layout

<

oia eienme,ioenumber inode number, device logical yidrgroup cylinder loslclzto of localization allows — > c 1998 $  & ' prtn ytmCnet 14 ibrcazadGalvin and Silberschatz 21.49 Concepts System Operating . S yidrGroup Cylinder BSD 4.3 cylinder block data blocks data blocks superblock inodes c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.50 Concepts System Operating • • • nytedvc rvrkostepclaiiso specific a of peculiarities the device. knows driver device the Only devices. hardware specific for driver device drivers general and system, code, caching buffer a of Consists kernel. the of bulk The

I/O system ie h euirte of peculiarities the hides / System I/O I/O eie rmthe from devices c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.51 Concepts System Operating interface network protocols socket system file plain file . S enlIOStructure I/O Kernel BSD 4.3

block-device driver system-call interface to the kernel

interface block cooked the hardware interface block raw character-device driver interface raw tty discipline line cooked TTY c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.52 Concepts System Operating • • • • • fi sntfud ufri hsnfo the from chosen is buffer a found, not is it If fteboki on,i sue,adno and used, is it found, searched. is is block cache the the If device, a from wanted is block a When itif list h ufrhaesfrbok o urnl nueaekp in kept are use in lists: currently linked several not blocks for headers buffer The block a and number device. device the a piece on to a number as to well point as can memory, which physical of of each headers, buffer of Consists – – – ufr o eetyue,o ihu ai otns( contents valid without or used, recently not Buffers list). ufr eetyue,lne in linked used, recently Buffers EMPTY AGE sempty. is ufr ihn soitdpyia memory. physical associated no with buffers lc ufrCache Buffer Block LRU I/O re ( order rnfri necessary. is transfer AGE LRU it rthe or list, list). AGE LRU c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.53 Concepts System Operating • • n owiedt ttmsotmzdfrds rotation. disk for optimized times seeks head at disk data minimize write to to — driver and address disk disk the the to allow and according actions cache, queue these the output in its buffered sorts are driver file disk disk a to written Data nuh h ecnaeo ah iscnb ihadthe and high be actual can of hits number large cache of is percentage it the if enough, performance; system effects size cache Buffer lc ufrCce(Cont’d) Cache Buffer Block I/O rnfr low. transfers c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.54 Concepts System Operating

• • • • ti ipet a h nomto rmabokbfe owa is what to buffer block a queue. from this information for the required map to simple is It interface device ahrcr nteqeespecifies: queue the in record transfers. Each pending of queue a maintains driver disk Each cache. buffer block loteeybokdvc a hrce nefc,or interface, character a has device block every Almost – – – – rnfrsize transfer a transfer the for address device transfera the for address memory write main a a or read a is it whether a eieInterfaces Device Raw

nietebokitrae tbpse the bypasses it interface, block the unlike — raw c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.55 Concepts System Operating • • • • rgasta edt ec oeeykeystroke). every to react to need that programs novskeigsalbok fcaatr nlne lists. A linked in characters of blocks small which keeping system involves buffering character a use drivers Terminal aoia uu n euncaatr ietyfo h raw the from — directly the queue characters bypass return driver device and the queue have canonical to possible also is It driven. interrupt similarly is Input transfers. further interrupts and and characters started, of is dequeuing transfer cause initial An device. the for write

ytmcl oatria nuuscaatr nalist a on characters enqueues terminal a to call system a mode raw ue yfl-ceneiosadother and editors full-screen by (used C-Lists c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.56 Concepts System Operating

• • • • socket In The h oktmcaimcnb sdb neae processes. unrelated by used be can mechanism socket The but machine, one to facilities. local networking are to which also pipes, as such facilities to eas the because Most – – 4.3BSD

rte ods;te sal r eti eoyb the by memory cache. in buffer seldom kept block are are normal data usually pipe they that disk; is to size written small pipes of benefit A two between stream processes. byte unidirectional reliable a Permits pipe UNIX ehns hc rvdsagnrlitraentonly not interface general a provides which mechanism sthe is ie r mlmne saseilcs fthe of case special a as implemented are pipes , nepoesCommunication Interprocess ytm aentpermitted not have systems PDP-11 IPC ehns otcaatrsi of characteristic most mechanism

adaeddntecuaeit. encourage not did hardware hrdmemory shared UNIX . c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.57 Concepts System Operating

• • • • omnctn ntesm oanuetesame the use format domain processes same that the is in domain communicating a of property characteristic A socket. fteadesdpnso the on depends address the of igesce a omnct nol n oan—the — in domain implemented one currently only domains in three communicate can socket single A ni-s okti sal on ihan with bound usually it socket in-use An communication. of endpoint an is socket A – – – the the h nentdmi ( domain Internet the . XEROX UNIX oan( domain ewr evcs( Services Network AF Sockets AF UNIX INET

) omncto domain communication ) NS oan( domain )

. BSD 4.3 address AF are: h nature the ;

NS address ) fthe of c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.58 Concepts System Operating • • • • • oan ti osbet reach Internet to the possible in is e.g., it types; domain, socket other the support that sockets Raw unsupported. Currently arrive. to guaranteed are sockets message delivered Reliably eprEhre rtcl sflfrdvlpn e protocols. new developing for Useful protocol. Ethernet deeper xetta eodbudre r rvdd sdin Used provided. are boundaries record that except sockets packet Sequenced sockets. stream communicating ieto.Spotdi nentdmi by domain Internet in Supported direction. sockets Datagram UNIX tem.Spotdi nentdmi ythe by domain Internet in Supported streams. sockets Stream AF NS oan ie r mlmne sapi of pair a as implemented are pipes domain, protocol. lo ietacs ypoesst h protocols the to processes by access direct allow rvd eibe ulx eune data sequenced duplex, reliable, provide rnfrmsae fvral iei either in size variable of messages transfer oktTypes Socket rvd iia aastreams, data similar provide TCP , IP eet ht ra or that, beneath rnfrmsae that messages transfer UDP TCP protocol. rtcl In protocol. XEROX c 1998 $  & ' prtn ytmCnet 15 ibrcazadGalvin and Silberschatz 21.59 Concepts System Operating

• • • • idtewl-nw drs fissriet htsocket. that to service its of address well-known the bind uses process server A descriptor The aei on oasce ythe by socket a to bound is name A rtclt eue n eun ml nee alda called integer small a returns and used and be type, to socket protocol domain, communication the of specifications The – – – Uses otne olse o oeconnections. more for process listen server to original continues the while client the service Uses clients. from connections Uses connect socket fork accept listen . alcetsasce;tksa arguments as takes socket; a creates call opoueanwpoesatrthe after process new a produce to ytmcl sue oiiit connection. a initiate to used is call system otl h enlta ti ed oaccept to ready is it that kernel the tell to oktSse Calls System Socket oacp niiulconnections. individual accept to socket ocet oktand socket a create to bind ytmcall. system accept

bind socket to to c 1998 $  & ' prtn ytmCnet 16 ibrcazadGalvin and Silberschatz 21.60 Concepts System Operating • • nsvrlfiedsrposado oktdescriptors. socket and/or descriptors file several on The descriptor. h ipetwyt emnt oncinadt eto the the destroy use to to and is connection socket a associated terminate to way simplest The select oktSse al (Cont’d) Calls System Socket ytmcl a eue omlilxdt transfers data multiplex to used be can call system close ytmcl nissocket its on call system c 1998 $  & ' prtn ytmCnet 16 ibrcazadGalvin and Silberschatz 21.61 Concepts System Operating • • • • • • and The xetthe extent lotalcurrent all protocols. Almost of sets several to interface an provide Sockets network. a across even processes, to other mechanism programming access the provides concept socket The eeec oe ( Model Reference ARPANET BSD 4.3 ewrigspoti n ftems motn etrsin features important most the of one is support Networking BSD . ICMP . BSD 4.3 uprsthe supports

interfaces. nawd ag fEhre,tknrn,and token-ring, Ethernet, of range wide a on socket ewrigipeetto,adt certain a to and implementation, networking aiiy smr retdtwr the toward oriented more is facility, ewr Support Network UNIX ARM DARPA ). ytm support systems nentprotocols Internet UUCP . UDP , TCP ARPANET , IP , 4.3 c 1998 $  & ' prtn ytmCnet 16 ibrcazadGalvin and Silberschatz 21.62 Concepts System Operating model reference ISO transport session presentation application hardware data link network ewr eeec oesadLayering and Models Reference Network hardware network interface network hostÐhost applications process model reference ARPANET hardware network interfaces network protocol sockets and libraries user programs layers 4.2BSD layering example controller interlan driver Ethernet IP TCP sock_stream telnet c 1998 $