DOC PREVIEW
UCSD CSE 120 - File Systems

This preview shows page 1-2-3-4 out of 12 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1&6(3ULQFLSOHVRI2SHUDWLQJ6\VWHPV)DOOLecture 13: File SystemsGeoffrey M. VoelkerNovember 15, 2000 CSE 120 -- Lecture 13 – File Systems 2)LOH6\VWHPV● Last time we talked about the physical characteristics of disks and their performance● Today we’ll talk about file systems◆ Files◆ Directories◆ Sharing◆ Protection◆ File System Layouts◆ File Buffer Cache◆ Read Ahead2November 15, 2000 CSE 120 -- Lecture 13 – File Systems 3)LOH6\VWHPV● File systems ◆ Implement an abstraction (files) for secondary storage◆ Organize files logically (directories)◆ Permit sharing of data between processes, people, and machines◆ Protect data from unwanted access (security)November 15, 2000 CSE 120 -- Lecture 13 – File Systems 4)LOHV● A file is data with some properties◆ Contents, size, owner, last read/write time, protection, etc.● A file can also have a type◆ Understood by the file system» Block, character, device, portal, link, etc.◆ Understood by other parts of the OS or runtime libraries» Executable, dll, souce, object, text, etc.● A file’s type can be encoded in its name or contents◆ Windows encodes type in name» .com, .exe, .bat, .dll, .jpg, etc.◆ Unix encodes type in contents» Magic numbers, initial characters (e.g., #! for shell scripts)3November 15, 2000 CSE 120 -- Lecture 13 – File Systems 5%DVLF)LOH2SHUDWLRQVUnix● creat(name)● open(name, how)● read(fd, buf, len)● write(fd, buf, len)● sync(fd)● seek(fd, pos)● close(fd)● unlink(name)NT● CreateFile(name, CREATE)● CreateFile(name, OPEN)● ReadFile(handle, …)● WriteFile(handle, …)● FlushFileBuffers(handle, …)● SetFilePointer(handle, …)● CloseHandle(handle, …)● DeleteFile(name)● CopyFile(name)● MoveFile(name)November 15, 2000 CSE 120 -- Lecture 13 – File Systems 6)LOH$FFHVV0HWKRGV● Some file systems provide different access methods that specify different ways for accessing data in a file◆ Sequential access – read bytes one at a time, in order◆ Direct access – random access given block/byte number◆ Record access – file is array of fixed- or variable-length records, read/written sequentially or randomly by record #◆ Indexed access – file system contains an index to a particular field of each record in a file, reads specify a value for that field and the system finds the record via the index (DBs)● What file access method does Unix, NT provide?● Older systems provide more complicated methods4November 15, 2000 CSE 120 -- Lecture 13 – File Systems 7'LUHFWRULHV● Directories serve two purposes◆ For users, they provide a structured way to organize files◆ For the file system, they provide a convenient naming interface that allows the implementation to separate logical file organization from physical file placement on the disk● Most file systems support multi-level directories◆ Naming hierarchies (/, /usr, /usr/local/, …)● Most file systems support the notion of a current directory◆ Relative names specified with respect to current directory◆ Absolute names start from the root of directory treeNovember 15, 2000 CSE 120 -- Lecture 13 – File Systems 8'LUHFWRU\,QWHUQDOV● A directory is a list of entries -- names and associated metadata◆ Metadata is not the data itself, but information that describes properties of the data (size, protection, location, etc.)● List is usually unordered (effectively random)◆ Entries usually sorted by program that reads directory● Directories typically stored in files◆ Only need to manage one kind of secondary storage unit5November 15, 2000 CSE 120 -- Lecture 13 – File Systems 9%DVLF'LUHFWRU\2SHUDWLRQVUnix● Directories implemented in files◆ Use file ops to create dirs● C runtime library provides a higher-level abstraction for reading directories◆ opendir(name)◆ readdir(DIR)◆ seekdir(DIR)◆ closedir(DIR)NT● Explicit dir operations◆ CreateDirectory(name)◆ RemoveDirectory(name)● Very different method for reading directory entries◆ FindFirstFile(pattern)◆ FindNextFile()November 15, 2000 CSE 120 -- Lecture 13 – File Systems 103DWK1DPH7UDQVODWLRQ● Let’s say you want to open “/one/two/three”● What does the file system do?◆ Open directory “/” (well known, can always find)◆ Search for the entry “one”, get location of “one” (in dir entry)◆ Open directory “one”, search for “two”, get location of “two”◆ Open directory “two”, search for “three”, get location of “three”◆ Open file “three”● Systems spend a lot of time walking directory paths◆ This is why open is separate from read/write◆ OS will cache prefix lookups for performance» /a/b, /a/bb, /a/bbb, etc., all share “/a” prefix6November 15, 2000 CSE 120 -- Lecture 13 – File Systems 11)LOH6KDULQJ● File sharing has been around since timesharing◆ Easy to do on a single machine◆ PCs, workstations, and networks get us there (mostly)● File sharing is incredibly important for getting work done◆ Basis for communication and synchronization● Two key issues when sharing files◆ Semantics of concurrent access» What happens when one process reads while another writes?» What happens when two processes open a file for writing?◆ ProtectionNovember 15, 2000 CSE 120 -- Lecture 13 – File Systems 123URWHFWLRQ● File systems implement some kind of protection system◆ Who can access a file◆ How they can access it● More generally…◆ Objects are “what”, subjects are “who”, actions are “how”● A protection system dictates whether a given action performed by a given subject on a given object should be allowed◆ You can read and/or write your files, but others cannot◆ You can read “/etc/motd”, but you cannot write it7November 15, 2000 CSE 120 -- Lecture 13 – File Systems 135HSUHVHQWLQJ3URWHFWLRQAccess Control Lists (ACL)● For each object, maintain a list of subjects and their permitted actionsCapabilities● For each subject, maintain a list of objects and their permitted actionsrwrwCharlier-wBobrw-rwAlice/three/two/oneSubjectsObjectsACLCapabilityNovember 15, 2000 CSE 120 -- Lecture 13 – File Systems 14$&/VDQG&DSDELOLWLHV● The approaches differ only in how the table is represented◆ What approach does Unix use?● Capabilities are easier to transfer◆ They are like keys, can handoff, does not depend on subject● In practice,


View Full Document

UCSD CSE 120 - File Systems

Documents in this Course
Threads

Threads

14 pages

Deadlocks

Deadlocks

19 pages

Processes

Processes

14 pages

Paging

Paging

13 pages

Processes

Processes

18 pages

Threads

Threads

29 pages

Security

Security

16 pages

Paging

Paging

13 pages

Processes

Processes

32 pages

Lecture 2

Lecture 2

13 pages

Paging

Paging

8 pages

Threads

Threads

14 pages

Paging

Paging

13 pages

Paging

Paging

26 pages

Paging

Paging

13 pages

Lecture

Lecture

13 pages

Processes

Processes

14 pages

Paging

Paging

13 pages

Security

Security

17 pages

Threads

Threads

15 pages

Processes

Processes

34 pages

Structure

Structure

10 pages

Lecture 3

Lecture 3

13 pages

Lecture 1

Lecture 1

28 pages

Threads

Threads

15 pages

Paging

Paging

30 pages

Load more
Download File Systems
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view File Systems and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view File Systems 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?