Docsity

File System Interface: CS 481 Operating System Principles at The University of New Mexico , Study notes of Operating Systems

Toggle sidebar
bg1
1
THE UNIVERSITY of
NEW MEXICO
File-System
Interface
Prof. Dorian Arnold
CS 481: Operating System Principles
Spring ‘09
2
Motivation
• The 2 general tasks of a process
1. Processing
2. Input/Output
• So far, we’ve studied processing
concepts!
• Now we focus on (file) I/O.
Are there useful programs with no I/O?
3
Role of OS for I/O
• Standard library
– Abstractions
• File/directory
– Interface
• mkdir, create, read, write
– Access to hardware devices (privileged)
• Resource coordination
– Protection, fairness and efficiency
4
What is a File?
• User view
– A named sequence of bytes
• Typed/untyped
• Structured/unstructured
– Persistent storage
• OS view
– Collection of blocks on non-volatile storage
• Magnetic disks, tapes, NVRAM, …
pf3
pf4
pf5

Partial preview of the text

Download File System Interface: CS 481 Operating System Principles at The University of New Mexico and more Study notes Operating Systems in PDF only on Docsity!

THE UNIVERSITY^ of NEW MEXICO File-SystemInterface^ Prof. Dorian ArnoldCS 481: Operating System PrinciplesSpring ‘

2

Motivation • The 2 general tasks of a process 1. Processing2. Input/Output • So far, we’ve studied processingconcepts!• Now we focus on (file) I/O. Are there useful programs with no I/O?

3

Role of OS for I/O • Standard library – Abstractions • File/directory – Interface • mkdir, create, read, write – Access to hardware devices (privileged) • Resource coordination – Protection, fairness and efficiency

4

What is a File? • User view – A named sequence of bytes • Typed/untyped• Structured/unstructured – Persistent storage • OS view – Collection of blocks on non-volatile storage • Magnetic disks, tapes, NVRAM, …

5

File Attributes • Name: human-readable identifier • Identifier: unique tag within file system • Type – Special files: directory, symbolic link, … • Location• Size• Protection: who can read, write, execute • Times: creation, modification, accessFile meta-data also stored on disk in directory structure.

6

File Operations • Create• Read/Write• Reposition (seek) within file• Delete• Truncate – Free disk space allocated to file • Rename• Copy• Change access permissions

7

Open Files Metadata Open: – 1 time lookup of file meta-data.– Metadata cached in per-process (open) file table • File (seek) pointer: current position for next read/write• Cached information for efficiency – Disk location of file– Access rights– … Close: deletes entry from process file table – Flushes dirty, cached information to persistent storage

8

Directories • Map file names to directory entries – Directory entry for file contains its attributes • Directory operations – Search for file– Create file– Delete file– List contents– Rename file– Traverse file system • Directory implementations – Single-level– Two-level– Tree-structured– Acyclic-Graphs – General Graphs

13

Acyclic Graphs • Create links from one file (or directory) to another – Shared sub-directories and files • Idea: Different names resolve to same file data• Hard link: “ln file1^ file2” – Multiple directory entries point to same meta-data– No hard links to directories in UNIX. • Symbolic (soft) link: “ln^ –s file1 file

  • Contents of^ file2^ contain name of

file1^14

Acyclic-Graph Directories^ What happens if^ dict

deletes^ count?

15

General Graph Directories^ How can we prevent cycles?

16

File Protection • Which users, which type of access: – Read– Write– Execute– Append– Delete– List

17

Access Control • Mode: read, write, execute• User class: owner, group, other (public) drwx------ 17 darnold^ faculty^4096 2009-03-

drwxr-xr-x^44 darnold^ faculty

4096 2009-03-24^ 11: ..

-rw-------^1 darnold^ faculty

213 2009-03-^13 00:25 ACKNOWLEDGMENTS

-rw-------^1 darnold^ faculty

1639 2009-03-13^ 00:25 aclocal.m drwxr-x---^3 darnold^ faculty

4096 2009-03-13^ 00:28 bin drwx------^5 darnold^ faculty

4096 2009-03-13^ 00:27 boost -rw-------^1 darnold^ faculty

79 2009-03-13^ 00:27 bugs.txt -rw-------^1 darnold^ faculty

301 2009-03-13^ 00:27 classes.txt drwx------^3 darnold^ faculty

4096 2009-03-13^ 00:25 conf -rw-r-----^1 darnold^ faculty

41468 2009-03-13^ 00:27 config.log -rwxr-x---^1 darnold^ faculty

32379 2009-03-13^ 00:

config.status user^ group^ other

18

Windows Access Control