Slide 1Lecture 14 – Tuesday, March 15, 2011Problem 1 NamingExample 1- abstract model of an interpreter – Figure 2.5Naming MODEL – (see Lecture 8)Example 2: Abstract model of naming: Figure 2.10The role of the context for modular sharingExample: context used for modular sharing, Figure 3.5Slide 9Problem 2 – UNIX file systemB. The software layer: the file abstractionAPI for the Unix File SystemAPI for the Unix File System (cont’d)Figure 2.20 and 2.22Generic OPEN and READ operations (Lecture 8)Logical and physical organizationSlide 17How to map logical to physical organizationSlide 19How to access the inode for a file in UNIXUnix OPEN and READSlide 22Problem 3 NFS (see Lecture 13)NFS clients and serversSlide 25ImplementationSlide 27Why file handles and not path namesRead/Write coherenceSlide 30NFS Close-to-Open semanticsCOT 4600 Operating Systems Spring 2011Dan C. MarinescuOffice: HEC 304Office hours: Tu-Th 5:00 – 6:00 PMLast time: MidtermTodaySolution of the midterm problems and midterm discussionNext timeVirtualizationLocksLecture 14 – Tuesday, March 15, 2011Lecture 14 2Problem 1 NamingConceptual/abstract model: a description which retains the most important characteristics of the process/object in a given context.The model of an airplane wingThe abstraction of an interpreterLecture 14 3Example 1- abstract model of an interpreter – Figure 2.5 Lecture 14 4Naming MODEL – (see Lecture 8) Naming allows objectsto refer to each otherto locate another objectsto determine the properties of other objectsNaming model a general scheme to resolve a name which can be applied for a spectrum of objects and implementations; examplesSearching for an address in phone bookCompiling a program which uses a libraryIdentifying the registers used during execution of a compiled programFour components:Name space (the universe of names)Mapping functionThe universe of valuesContextA function which has as input: a name and a context and produces a valueLecture 14 5Example 2: Abstract model of naming: Figure 2.10Lecture 14 6The role of the context for modular sharingModular sharing: allows one module to use another module developed independently, without the danger of name collision (page 117 of the text book)All names encountered during the name resolution for module A are resolved using the context of A; in other words trhe context of module A points to all modules used by A (including A); The context allows modular sharing; if both modules A and B use a function called W, but the two functions are different (call them WA and WB for convenience) then the context of A will point to the function WA and the context of B will point to WBLecture 14 7Example: context used for modular sharing, Figure 3.5 Lecture 14 8Lecture 14 9Problem 2 – UNIX file systemLecture 8 Basic concepts related to file handlingHow UNIX users access a file – APIInternal implementation of file operations for a generic systemHow to map logical to physical organizationUNIXLecture 14 10B. The software layer: the file abstractionFile: memory abstraction used by the application and OS layerslinear array of bits/bytesproperties:durable information will not be changed in timehas a name allows access to individual bits/bytes has a cursor which defines the current position in the file.The OS provides an API (Application Programming Interface) supporting a range of file manipulation operations.A user must first OPEN a file before accessing it and CLOSE it after it has finished with it. This strategy:allows different access rights (READ, WRITE, READ-WRITE) coordinate concurrent access to the fileSome file systems use OPEN and CLOSE to enforce before-or-after atomicity support all-or-nothing atomicity e.g., ensure that if the system crashes before a CLOSE either all or none of WRITEs are carried outLecture 8 11API for the Unix File SystemOPEN(name, flags, model) connect to a file Open an existing file called name, or Create a new file with permissions set to mode if flags is set. Set the file pointer (cursor) to 0. Return the file descriptor (fd).CLOSE(fd) disconnect from a file Delete file descriptor fd.READ(fd, buf,n) read from file Read n bytes from file fd into buf; start at the current cursor position and update the file cursor (cursor = cursor + n).WRITE(fd, buf,n) write to file Write n bytes to the file fd from buf; start at the current cursor position and update the file cursor (cursor = cursor + n). SEEK(fd, offset,whence) move cursor of file Set the cursor position of file fd to offset from the position specified by whence (beginning, end, current position) Lecture 8 12API for the Unix File System (cont’d)FSYNC(fd) make all changes to file fd durable.STAT(name) read metadata CHMOD, CHOWN change access mode/ownershipRENAME(from_name,to_name) change file nameLINK(name, link_name) create a hard linkUNLINK(name) remove name from directorySYMLINK(name, link_name) create a symbolic linkMKDIR(name) create directory nameRMDIR(name) delete directory nameCHDIR(name) change current directory to nameCHROOT Change the default root directory nameMOUNT(name,device) mount the file system name onto deviceUNMOUNT(name) unmount file system nameLecture 8 13Figure 2.20 and 2.22Lecture 8 14Generic OPEN and READ operations (Lecture 8)Lecture 8 15Logical and physical organizationLogical/physical records: a file consists of a set of logical recordsa persistent storage media (e.g., disk) is organized as a sequence of blocks/physical records.Hierarchical logical organization Records FileDirectoryFile systemLecture 14 16Lecture 14 17How to map logical to physical organizationDefine a control structure which holds information about a file a directory, or a file system. For a file this information includes:Creation dateOwnerSizeAccess rights (read, write, execute)The physical location of the fileStore this meta information on the persistent storage (disk).In UNIX call such a control structure – inodean inode describes a file, a directory, or a file system The inode table stores the block where the inodes for directories are locatedLecture 14 18Lecture 14 19How to access the inode for a file in UNIXGiven a path name the following
View Full Document