1. Trang chủ
  2. » Công Nghệ Thông Tin

Lecture Operating systems: Internals and design principles (6/E): Chapter 12 - William Stallings

104 89 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 104
Dung lượng 550,23 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Chapter 12 - File management. After studying this chapter, you should be able to: Describe the basic concepts of files and file systems, understand the principal techniques for file organization and access, define B-trees, explain file directories, understand the requirements for file sharing,...

Trang 1

Chapter 12 File Management

Dave Bremer Otago Polytechnic, N.Z.

Trang 2

• Secondary Storage Management

• File System Security

• Unix File Management

• Linux Virtual File System

• Windows File System

Trang 3

applications

important part of the OS to a user

– Long-term existence

– Sharable between processes

– Structure

Trang 4

File Management

system utility programs that run as privileged applications

Trang 5

Typical Operations

can be performed on files, typically:

Trang 7

Fields and Records

– Basic element of data

– Contains a single value

– Characterized by its length and data type

– Collection of related fields

– Treated as a unit

Trang 8

File and Database

• File

– Have file names

– Is a collection of similar records

– Treated as a single entity

– May implement access control mechanisms

– Collection of related data

– Relationships exist among elements

– Consists of one or more files

Trang 9

File Management Systems

applications in the use of files

– The way a user or application accesses files

management software

Trang 10

Objectives for a File Management System

• Meet the data management needs of the user

• Guarantee that the data in the file are valid

• Optimize performance

• Provide I/O support for a variety of storage

device types

• Minimize lost or destroyed data

• Provide a standardized set of I/O interface

routines to user processes

• Provide I/O support for multiple users (if needed)

Trang 11

Requirements for a general purpose system

delete, read, write and modify files

other users’ files

accesses are allowed to the users’ files

the user’s files in a form appropriate to

the problem

Trang 12

Requirements cont.

between files

recover the user’s files in case of damage

user’s files by using symbolic names

Trang 13

Typical software

organization

Trang 15

Basic File System

outside the computer system

memory

Trang 16

Basic I/O Supervisor

Trang 18

Access Method

applications and the file systems and

devices that hold the data

ways to access and process data for the device

Trang 19

Elements of

File Management

Trang 20

• Secondary Storage Management

• File System Security

• Unix File Management

• Linux Virtual File System

• Windows File System

Trang 21

File Organization

structure of records

– Physical organization discussed later

accessed

Trang 22

Criteria for File Organization

– Short access time

– Ease of update

– Economy of storage

– Simple maintenance

– Reliability

(e.g read-only CD vs Hard Drive)

– Some may even conflict

Trang 24

mass of data and save it

fields

search

Trang 25

The Sequential File

• Fixed format used for records

• Records are the same length

• All fields the same (order and

length)

• Field names and lengths are

attributes of the file

• Key field

– Uniquely identifies the record

– Records are stored in key

sequence

Trang 26

Indexed Sequential File

• Maintains the key

characteristic of the

sequential file:

• records are organized in

sequence based on a key

field.

Two features are added:

• an index to the file to support

random access,

• and an overflow file

Trang 27

Indexed File

different key fields

– May contain an exhaustive index that contains one entry for every record in the main file

– May contain a partial index

to the main file, all of the index files must be updated

Trang 28

File Organization

address

– Directly access a block at a known address

– Key field required for each record

Trang 29

Performance

Trang 30

• Secondary Storage Management

• File System Security

• Unix File Management

• Linux Virtual File System

• Windows File System

Trang 31

the files themselves

Trang 32

Directory Elements: Basic Information

Trang 34

Directory Elements:

Access Control Information

– The owner may be able to grant/deny access

to other users and to change these privileges.

– May include the user’s name and password for each authorized user.

– Controls reading, writing, executing,

transmitting over a network

Trang 35

Directory Elements: Usage Information

• Date Created

• Identity of Creator

• Date Last Read Access

• Identity of Last Reader

• Date Last Modified

• Identity of Last Modifier

• Date of Last Backup

• Current Usage

– Current activity, locks, etc

Trang 36

Simple Structure for a

Directory

information varies widely between

systems

file

– Sequential file with the name of the file

serving as the key

– Provides no help in organizing the files

– Forces user to be careful not to use the same name for two different files

Trang 37

Operations Performed

on a Directory

number of operations including:

Trang 38

Two-Level Scheme

for a Directory

directory

– Master directory contains entry for each user

– Provides address and access control

information

for that user

– Does not provide structure for collections of files

Trang 39

Hierarchical, or Tree-Structured Directory

Trang 40

file by following the directory path

– Duplicate filenames are possible if they have different pathnames

Trang 41

Example of Tree-Structured Directory

Trang 42

Working Directory

awkward and tedious

associated with a current or working

directory

– All file names are referenced as being relative

to the working directory unless an explicit full pathname is used

Trang 43

• Secondary Storage Management

• File System Security

• Unix File Management

• Linux Virtual File System

• Windows File System

Trang 44

File Sharing

shared among users

– Access rights

– Management of simultaneous access

Trang 45

Access Rights

used by various systems

– often as a hierarchy where one right implies previous

– User may not even know of the files existence

– User can only determine that the file exists

and who its owner is

Trang 46

Access Rights cont…

– The user can load and execute a program but cannot copy it

– The user can read the file for any purpose,

including copying and execution

– The user can add data to the file but cannot modify or delete any of the file’s contents

Trang 47

Access Rights cont…

Trang 49

Simultaneous Access

updated

during the update

for shared access

Trang 50

• Secondary Storage Management

• File System Security

• Unix File Management

• Linux Virtual File System

• Windows File System

Trang 51

Blocks and records

structured file

– But blocks are the unit for I/O with secondary storage

– Fixed length blocking

– Variable length spanned blocking

– Variable-length unspanned blocking

Trang 52

Fixed Blocking

integral number of records are stored in a block

internal fragmentation

Trang 53

Fixed Blocking

Trang 54

Variable Length Spanned Blocking

packed into blocks with no unused space

– Continuation is indicated by a pointer to the successor block

Trang 55

Variable Blocking:

Spanned

Trang 56

Variable-length unspanned blocking

spanning

the inability to use the remainder of a

block if the next record is larger than the remaining unused space

Trang 57

Variable Blocking:

Unspanned

Trang 58

• File System Security

• Unix File Management

• Linux Virtual File System

• Windows File System

Trang 59

Secondary Storage

Management

allocating blocks to files

– Space must be allocated to files

– Must keep track of the space available for allocation

Trang 60

File allocation issues

space allocated at once?

‘portions’

– What size should be the ‘portion’?

keep track of the file portions?

Trang 61

Preallocation vs Dynamic Allocation

time of creation

potential size of the file

run out of space

Trang 62

Portion size

– Portion large enough to hold entire file is

allocated

– Allocate space one block at a time

of view of a single file, or the overall

system efficiency

Trang 63

File Allocation Method

– contiguous,

– chained, and

– indexed.

Trang 64

Contiguous Allocation

the time of creation

table

– Starting block and length of the file

– Need to perform compaction

Trang 65

Contiguous File Allocation

Trang 66

External fragmentation

Trang 67

Chained Allocation

block in the chain

– Starting block and length of file

Trang 68

Chained Allocation

Trang 69

Chained Allocation

Consolidation

Trang 70

Indexed Allocation

one-level index for each file

allocated to the file

number for the index

Trang 71

Indexed Allocation

Method

– Fixed size blocks or

– Variable sized blocks

fragmentation

consolidation

Trang 72

Indexed allocation with Block Portions

Trang 73

Indexed Allocation with Variable Length Portions

Trang 74

Free Space Management

so must the unallocated space

which blocks are available

to a file allocation table

Trang 75

Bit Tables

bit for each block on the disk

Trang 76

Chained Free Portions

by using a pointer and length value in

each free portion

Trang 77

index table as it would for file allocation

basis of variable-size portions rather than blocks

– Thus, there is one entry in the table for every free portion on the disk.

for all of the file allocation methods

Trang 78

Free Block List

sequentially

– the list of the numbers of all free blocks is maintained in a reserved portion of the disk

Trang 79

• A collection of addressable sectors in secondary memory that an OS or application can use for

data storage.

• The sectors in a volume need not be

consecutive on a physical storage device;

– instead they need only appear that way to the OS or application

• A volume may be the result of assembling and merging smaller volumes.

Trang 80

• Secondary Storage Management

• Unix File Management

• Linux Virtual File System

• Windows File System

Trang 81

Access Control

the user is identified

– Granting access to files and applications (or denying)

Trang 82

Access Matrix

Trang 83

Access Control Lists

Trang 85

• Secondary Storage Management

• File System Security

• Linux Virtual File System

• Windows File System

Trang 86

UNIX File Management

Trang 87

information for a particular file

a single inode

– But an active inode is associated with only

one file, and

– Each file is controlled by only one inode

Trang 88

Free BSD Inodes include:

Trang 89

FreeBSD Inode and

File Structure

Trang 90

File Allocation

– Blocks may not be contiguous

– Part of index stored in the file inode.

– And three indirect pointers

Trang 92

UNIX File Access Control

Trang 93

UNIX File

Access Control

Trang 94

• Secondary Storage Management

• File System Security

• Unix File Management

• Windows File System

Trang 95

Linux Virtual File System

processes

general feature and behavior

properties regardless of the target file

system

Trang 96

Key ingredients of

VFS Strategy

• A user process issues

a file system call (e.g.,

read) using the VFS

file scheme.

– The VFS converts this

into an internal file

Trang 97

The role of VFS within the Kernel

Trang 99

• Secondary Storage Management

• File System Security

• Unix File Management

• Linux Virtual File System

Trang 100

Windows File System

– Recoverability

– Security

– Large disks and large files

– Multiple data streams

– Journaling

– Compression and Encryption

Trang 101

NTFS Volume and File Structure

– The smallest physical storage unit on the disk

– Almost always 512 bytes

Trang 102

Efficient with Large Files

Trang 103

NTFS Volume Layout

every file consists of a collection of

attributes

– Even the data contents of a file is treated as

an attribute.

Trang 104

Windows NTFS Components

Ngày đăng: 30/01/2020, 02:40

TỪ KHÓA LIÊN QUAN