File-System Interface Summer 2013 Cornell University 1 Today Why - - PowerPoint PPT Presentation

file system interface
SMART_READER_LITE
LIVE PREVIEW

File-System Interface Summer 2013 Cornell University 1 Today Why - - PowerPoint PPT Presentation

CS 4410 Operating Systems File-System Interface Summer 2013 Cornell University 1 Today Why do we use files and how are they organized? File Attributes Operations Directories Logical structure of directory File


slide-1
SLIDE 1

1

CS 4410 Operating Systems

File-System Interface

Summer 2013 Cornell University

slide-2
SLIDE 2

2

Today

  • Why do we use files and how are they
  • rganized?
  • File
  • Attributes
  • Operations
  • Directories
  • Logical structure of directory
  • File protection
slide-3
SLIDE 3

3

Organizing Data

  • Every user has much useful data.
  • Text, images, music, code
  • Data is stored in storage devices.
  • Magnetic Disk, Tape, USB
  • How data is organized in storage devices?
slide-4
SLIDE 4

4

File

  • The OS defines the File.
  • Logical storage unit
  • Abstraction
  • The same abstraction for all storage devices.
  • Different implementation.
slide-5
SLIDE 5

5

File

  • A named collection of related information.
  • Recorded on secondary storage.
  • The smallest allotment of logical secondary

storage.

  • Each file has a structure.
  • Independent entity.
slide-6
SLIDE 6

6

File Attributes

  • How do we identify a file?
  • Name
  • Type
  • Location
  • Size
  • Protection
  • Time, date and user identification
  • Where are they saved?
  • Directory structure
slide-7
SLIDE 7

7

File Operations

  • What can we do with files?
  • Create
  • Write
  • Read
  • Reposition
  • Delete
  • Truncate
  • What about the constant searching of the file?
slide-8
SLIDE 8

8

Open File

  • An open() system call is made before a file is used.
  • It saves the file information into the open-file table of the OS.
  • The open() returns a pointer to the corresponding entry of the
  • pen-file table.
  • Subsequent accesses do not search the directory, but they get

the information needed from the pointer.

  • What happens when multiple processes open the same file?
slide-9
SLIDE 9

9

Open File

  • The OS uses two levels of internal tables:
  • Per-process table
  • System-wide table
  • Per-process table:
  • One entry for each open file (by the process).
  • Stores information concerning the specific use of the file by the specific

process.

  • Current file pointer, access rights
  • Every entry has a pointer to the corresponding entry in the System-wide table.
  • System-wide table:
  • One entry for each open file (by all the processes)
  • Contains process-independent information
  • Location, access dates, size
  • What happens when a process opens a file?
slide-10
SLIDE 10

10

Access Methods

  • After we open the file, how can we access it?
  • Sequentially
  • Directly
  • A file is made up of fixed-length logical records.
slide-11
SLIDE 11

11

File System

  • How the files are organized in the secondary storage device?
  • A file belongs to a File System.
  • A File System lives in a volume.
  • A volume is a subset of the device storage space.
  • A File System consists of files and directories.
slide-12
SLIDE 12

12

Logical Structure of a Directory

  • Single-Level
  • All the files in one directory.
  • Limitations?
slide-13
SLIDE 13

13

Logical Structure of a Directory

  • Two-Level
  • User file directory
  • Master file directory
  • Path name for every file.
  • Limitations?
slide-14
SLIDE 14

14

Logical Structure of a Directory

  • Tree-Structured
  • A directory is, simply, another file.
  • It is treated in a special way.
  • One bit distinguishes files from directories.
  • Limitations?
slide-15
SLIDE 15

15

Logical Structure of a Directory

  • Acyclic-Graph
  • Shared directories/files
  • Link

– Symbolic

  • The file contains the path of the shared file.
  • Can span different file systems.

– Hard

  • The file entry shows directly to the shared file.
  • More efficient.
slide-16
SLIDE 16

16

File Protection

  • Type of Access
  • Read
  • Write
  • Execute
  • Append
  • Delete
  • List
  • Access Control List
  • Who can access what and in what way.
slide-17
SLIDE 17

17

Today

  • Why do we use files and how are they
  • rganized?
  • File
  • Attributes
  • Operations
  • Directories
  • Logical structure of directory
  • File protection