File Management in Operating Systems: An Overview, Slides of Operating Systems

A part of a lecture series on Operating Systems at the University of Bedfordshire. It focuses on file management, covering topics such as interaction with the file manager, files, physical storage allocation, directories, file system, access, and data compression.

Typology: Slides

2021/2022

Uploaded on 09/27/2022

alenapool
alenapool 🇬🇧

4.6

(13)

223 documents

1 / 46

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Operating Systems
Lecture #5:File Management
Written by David Goodwin
based on the lecture series of Dr. Dayou Li
and the book Understanding Operating Systems 4th ed.
by I.M.Flynn and A.McIver McHoes (2006)
Department of Computer Science and Technology,
University of Bedfordshire.
Operating Systems, 2013
25th February 2013
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
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e

Partial preview of the text

Download File Management in Operating Systems: An Overview and more Slides Operating Systems in PDF only on Docsity!

Operating Systems

Lecture #5: File Management

Written by David Goodwin

based on the lecture series of Dr. Dayou Li

and the book Understanding Operating Systems 4 thed.

by I.M.Flynn and A.McIver McHoes (2006)

Department of Computer Science and Technology,

University of Bedfordshire.

Operating Systems, 2013

25 th^ February 2013

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the file manager Files Physical storage allocation Directories File system Access Data compression summary

Operating Systems

Outline

1 Introduction

2 Interaction with the file manager

3 Files

4 Physical storage allocation

5 Directories

6 File system

7 Access

8 Data compression

9 summary

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction 4 Interaction with the file manager Files Physical storage allocation Directories File system Access Data compression summary

Operating Systems

Introduction

ˆ Responsibilities of the file manager

1 Keep track of where each file is stored 2 Use a policy that will determine where and how the files will be stored, making sure to efficiently use the available storage space and provide efficient access to the files. 3 Allocate each file when a user has been cleared for access to it, and then record its use. 4 Deallocate the file when the file is to be returned to storage, and communicate its availability to others who may be waiting for it.

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction 5 Interaction with the file manager Files Physical storage allocation Directories File system Access Data compression summary

Operating Systems

Definitions

field is a group of related bytes that can be identified by

the user with a name, type, and size.

record is a group of related fields.

file is a group of related records that contains

information to be used by specific application

programs to generate reports. This type of file

contains data and is sometimes called a “flat file”

because it has no connections to other file; unlike

databases it has no dimensionality.

database appear to be a type of file, but databases are more

complex. They are groups of related files that are

interconnected at various levels to give flexibility of

access to the data stored.

program files contain instructions.

data files contain data.

directories are listings of filenames and their attributes.

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the 7 file manager Files Physical storage allocation Directories File system Access Data compression summary

Operating Systems

Interacting with the File Manager

ˆ User communicates via commands, either embedded in user’s

program or submitted interactively by user.

ˆ embedded commands are: ˆ OPEN / CLOSE - pertain to the availability of a file for the program invoking it. ˆ READ / WRITE - are I/O commands. ˆ (^) MODIFY - specialised WRITE command for existing data files, allows for appending records or for rewriting selected records in their origional place in the file. ˆ interactive commands are: ˆ (^) CREATE / DELETE - deal with the system’s knowledge of the file (some systems have the first instance of SAVE command, others OPEN NEW, OPEN... FOR OUTPUT. ˆ RENAME - allows users to change the name of an existing file. ˆ COPY - lets users make duplicate copies of existing files.

ˆ These commands (and many more) are designed to be simple

to make them device independent.

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the 8 file manager Files Physical storage allocation Directories File system Access Data compression summary

Operating Systems

Interaction with the File Manager

ˆ Example - READ instruction:

1 Move the read/write heads of the cylinder where the record is to be found. 2 Wait for the rotational delay until the sector containing the desired record passes under the read/write head. 3 Activate the appropriate read/write head and read the record. 4 Transfer the record to main memory. 5 Send a flag to indicate that the device is free to satisfy another request.

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the file manager Files 10 Physical storage allocation Directories File system Access Data compression summary

Operating Systems

Files

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the file manager Files 11 Physical storage allocation Directories File system Access Data compression summary

Operating Systems

File attributes

ˆ Information about files is kept in the directory structure,

which is also maintained on the disk.

ˆ Name – only information kept in human-readable form. ˆ Identifier – non-human readable unique tag (usually a number). ˆ 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.

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the file manager Files 13 Physical storage allocation Directories File system Access Data compression summary

Operating Systems

File types

ˆ OS recognises and supports file types

ˆ helps prevent user mistakes ˆ convenient by automatically doing various jobs after a command ˆ must define every file type allowed and difficult to create new file types

ˆ Commonly implemented by using an extension name

ˆ Creator attribute used to identify the file type and invoke the

creator application program

ˆ Internal file structure can be indicated by file types

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the file manager Files 14 Physical storage allocation Directories File system Access Data compression summary

Operating Systems

File Types

ˆ Two components are common to most filenames:

1 relative filename 2 extension (called a suffix in UNIX/Linux)

ˆ A complete filename identifies a file’s absolute filename;

being the long name that includes path information.

ˆ there are restrictions on filename with each operating system:

ˆ MS-DOS - allows names from one to eight alphanumeric characters, but without spaces ˆ most modern operating systems do not have restrictions on filenames.

ˆ An extension usually 2 or 3 characters long and is separated

by a period (.). The purpose is to identify the file type or its

contents.

ˆ NOTE: some extensions are associated with more than one

application

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the file manager Files 16 Physical storage allocation Directories File system Access Data compression summary

Operating Systems

Access methods

ˆ Sequential access

ˆ Easiest ˆ File searched from its beginning until record is found

ˆ Direct (relative/random) access

ˆ (^) Only on direct access storage devices ˆ (^) Records identified by their relative address to the beginning of the file

ˆ Indexed access

ˆ (^) Combines the best of sequential and direct access

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the file manager Files 17 Physical storage allocation Directories File system Access Data compression summary

Operating Systems

Access methods - direct access example

ˆ Records identified by logical address, them relative to the

beginning of the file.

ˆ User identifies a field in the record format and designates it as

the key field because it uniquely identifies each record.

ˆ the program used to store the data follows a set of

instructions called a hashing algorithm, that transforms

each key into a number, the record’s logical address.

ˆ This is given to the File Manager, which takes the necessary

steps to translate the logical address into a physical address

(cylinder, surface, and record numbers), preserving the file

organisation.

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the file manager Files Physical storage 19 allocation Directories File system Access Data compression summary

Operating Systems

Physical storage allocation

ˆ Contigious storage

ˆ records stored one after another ˆ any record can be found and read by knowing its starting address and size ˆ ease of direct access, every part of the file is stored in the same compact area ˆ file cant be expanded unless there is empty space immediately following it - also causing fragmentation

Lecture #5 File Management David Goodwin University of Bedfordshire

Introduction Interaction with the file manager Files Physical storage 20 allocation Directories File system Access Data compression summary

Operating Systems

Physical storage allocation

ˆ Noncontigious storage

ˆ (^) files use any space available on disk ˆ (^) records stored in a contigious manner only if there’s enough empty space ˆ (^) any remaining records, and all other additions to the file, are stored in other sections of the disk ˆ sometimes called extents of the file - linked together with pointers in one of two ways ˆ (^) at storage level - each extent points to the next one in sequence ˆ (^) at directory level - each extent is listed with its physical address, size, and a pointer to the next extent. A null pointer indicates it’s the last one. ˆ (^) doesnt support direct access