File Systems - Operating Systems, Distributed Computation - Lecture Slides, Slides of Operating Systems

During the course of work of the Operating Systems, Distributed Computation, we learn the core of the programming. The main points disucss in these lecture slides are:File Systems, File System Interface, File System Implementation, Sequence of Words, Complex Structures, Attributes of File, User Identification, File Concept, Blocking, Sequential Access, Access Methods

Typology: Slides

2012/2013

Uploaded on 04/24/2013

banamala
banamala 🇮🇳

4.4

(19)

114 documents

1 / 39

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
10: File Systems 1
OPERATING SYSTEMS
FILE SYSTEMS
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27

Partial preview of the text

Download File Systems - Operating Systems, Distributed Computation - Lecture Slides and more Slides Operating Systems in PDF only on Docsity!

10: File Systems 1

OPERATING SYSTEMS

FILE SYSTEMS

10: File Systems 2

FILE SYSTEMS

This material covers Silberschatz Chapters 10 and 11.

File System Interface

The user level (more visible) portion of the file system.

  • Access methods
  • Directory Structure
  • Protection

File System Implementation

The OS level (less visible) portion of the file system.

  • Allocation and Free Space Management
  • Directory Implementation

10: File Systems 4

FILE SYSTEMS INTERFACE

A file can have various kinds of structure

 None - sequence of words, bytes

  • Simple record structure
    • Lines
    • Fixed length
    • Variable length
  • Complex Structures
    • Formatted document
    • Relocatable load file
  • Who interprets this structure?
    • Operating system
    • Program

File

Concept

10: File Systems 5

FILE SYSTEMS INTERFACE

Attributes of a File

Name – only information kept in human-readable form

  • Identifier – unique tag (number) identifies file within file system
  • Type – needed for systems that support different types
  • Location – pointer to file location on device
  • Size – current file size
  • Protection – controls who can do reading, writing, executing
  • Time, date, and user identification – data for protection, security,

and usage monitoring

  • Information about files is kept in the directory structure, which is

maintained on the disk.

File

Concept

10: File Systems 7

If files had only one "chunk" of data, life would be simple. But for large files,

the files themselves may contain structure, making access faster.

SEQUENTIAL ACCESS

  • Implemented by the filesystem.
  • Data is accessed one record right after the last.
  • Reads cause a pointer to be moved ahead by one.
  • Writes allocate space for the record and move the pointer to the new

End Of File.

  • Such a method is reasonable for tape

FILE SYSTEMS INTERFACE

Access

Methods

10: File Systems 8

DIRECT ACCESS

  • Method useful for disks.
  • The file is viewed as a numbered sequence of blocks or records.
  • There are no restrictions on which blocks are read/written in any order.
  • User now says "read n" rather than "read next".
  • "n" is a number relative to the beginning of file, not relative to an absolute

physical disk location.

FILE SYSTEMS INTERFACE Access Methods

10: File Systems 10

Example 1: Index contains the name appearing as the first record in each block. There are as many index entries as there are blocks.

Example 2: Index contains the block number where "A" begins, where "B" begins, etc. Here there are only 26 index entries.

FILE SYSTEMS INTERFACE

Access

Methods

Smith

Smith, John | data

Adams Arthur Asher

Saarnin

Smith, John | data

Adams Baker Charles

Adams | Data Arthur | Data Asher | Data Baker | Data

Saarnin | data

10: File Systems 11

Directories maintain information about files:

For a large number of files, may want a directory structure - directories under directories.

Information maintained in a directory:

Name The user visible name. Type The file is a directory, a program image, a user file, a link, etc. Location Device and location on the device where the file header is located. Size Number of bytes/words/blocks in the file. Position Current next-read/next-write pointers. Protection Access control on read/write/ execute/delete. Usage Open count Usage time of creation/access, etc. Mounting a filesystem occurs when the root of one filesystem is "grafted" into the existing tree of another filesystem.

There is a need to PROTECT files and directories.

Actions that might be protected include: read, write, execute, append, delete, list

FILE SYSTEMS INTERFACE Directory Structure

In Memory only!

10: File Systems 13

Mounting:

Attaching portions of the file system into a directory structure.

Sharing:

  • Sharing must be done through a protection scheme
  • May use networking to allow file system access between systems
    • Manually via programs like FTP or SSH
    • Automatically, seamlessly using distributed file systems
    • Semi automatically via the world wide web
  • Client-server model allows clients to mount remote file systems from servers
    • Server can serve multiple clients
    • Client and user-on-client identification is insecure or complicated
    • NFS is standard UNIX client-server file sharing protocol
    • CIFS is standard Windows protocol
    • Standard operating system file calls are translated into remote calls

FILE SYSTEMS INTERFACE Other Issues

10: File Systems 14

FILE SYSTEMS INTERFACE Protection

 File owner/creator should

be able to control:

 what can be done  by whom

 Types of access

 Read  Write  Execute  Append  Delete  List

  • Mode of access: read, write, execute
  • Three classes of users RWX a) owner access 7  1 1 1 RWX b) group access 6  1 1 0 RWX c) public access 1  0 0 1
  • Ask manager to create a group (unique name), say G, and add some users to the group.
  • For a particular file (say game ) or subdirectory, define an appropriate access.

owner group public

chmod 761 game

Attach a group to a file “chgrp G game”

10: File Systems 16

FILE SYSTEM IMPLEMENTATION

FILE SYSTEM STRUCTURE:

When talking about “the file system”, you are making a statement about both the rules used for file access, and about the algorithms used to implement those rules. Here’s a breakdown of those algorithmic pieces. Application Programs The code that's making a file request.

Logical File System This is the highest level in the OS; it does protection, and security. Uses the directory structure to do name resolution.

File-organization Module Here we read the file control block maintained in the directory so we know about files and the logical blocks where information about that file is located.

Basic File System Knowing specific blocks to access, we can now make generic requests to the appropriate device driver.

IO Control These are device drivers and interrupt handlers. They cause the device to transfer information between that device and CPU memory.

Devices The disks / tapes / etc.

10: File Systems 17

FILE SYSTEM

IMPLEMENTATION

Layered File

System

Handles the CONTENT of the file. Knows the file’s internal structure.

Handles the OPEN, etc. system calls. Understands paths, directory structure, etc.

Uses directory information to figure out blocks, etc. Implements the READ. POSITION calls.

Determines where on the disk blocks are located.

Interfaces with the devices – handles interrupts.

10: File Systems 19

FILE SYSTEM

IMPLEMENTATION

Virtual File Systems

  • Virtual File Systems (VFS)

provide an object-oriented way of implementing file systems.

  • VFS allows the same system

call interface (the API) to be used for different types of file systems.

  • The API is to the VFS interface,

rather than any specific type of file system.

10: File Systems 20

FILE SYSTEM

IMPLEMENTATION

a) Accessing the file requires a minimum of head movement. b) Easy to calculate block location: block i of a file, starting at disk address b , is b + i. c) Difficulty is in finding the contiguous space, especially for a large file. Problem is one of dynamic allocation (first fit, best fit, etc.) which has external fragmentation. If many files are created/deleted, compaction will be necessary.

  • It's hard to estimate at create time what the size of the file will ultimately be. What happens when we want to extend the file --- we must either terminate the owner of the file, or try to find a bigger hole.

Allocation Methods

CONTIGUOUS ALLOCATION

  • Method: Lay down the entire file on contiguous sectors of the disk. Define by a dyad <first block location, length >.