file management chapter #12. 파일 관리 n in most applications, the file is the central element u...

98
File Management File Management Chapter #12 Chapter #12

Upload: felix-wilson

Post on 21-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

File ManagementFile Management

Chapter #12Chapter #12

Page 2: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

파일 관리파일 관리

In most applications, the file is the central element Input to applications is by means of a file Output is saved in a file for long-term storage

파일시스템 (File management system) A part of the operating system consists of system utility programs that run as privileged

applications

2Operating System

Page 3: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

파일시스템 기능 파일시스템 기능 (1)(1)

파일시스템은 데이터 집합인 ‘ 파일’ 이라는 추상화 객체를 생성하여 관리하는 기능을 제공

‘ 파일’ 객체의 특성 장기 보존 (Long-term existence) 프로세스들 간의 공유 (Sharable between processes) 구조 (Structure)

3Operating System

Page 4: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

파일시스템 기능 파일시스템 기능 (2)(2)

파일시스템은 일반적으로 ‘ 파일’ 객체에 대해 다음의 접근 연산을 지원한다 생성 (Create) 삭제 (Delete) 열기 (Open) 닫기 (Close) 읽기 (Read) 쓰기 (Write)

4Operating System

Page 5: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

파일시스템 기능 파일시스템 기능 (3)(3)

파일시스템은 ‘ 파일’ 객체에 대한 일련의 속성을 유지 , 관리한다 소유자 생성시간 최근 변경 시간 접근 권한 등

5Operating System

Page 6: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Terms Used with Files (1)Terms Used with Files (1)

Field Basic element of data Contains a single value Characterized by its length and data type

Record Collection of related fields Treated as a unit

Example: employee record

6Operating System

Page 7: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Terms Used with Files (2)Terms Used with Files (2)

File Collection of similar records Treated as a single entity by users Have unique file names Access control applies at this level

In some systems, such controls are enforced at the record level

Database Collection of related data Consists of one or more types of files Relationships exist among elements

7Operating System

Page 8: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Typical Operations onTypical Operations on FilesFiles

파일 사용과 관련하여 지원되는 전형적인 연산 Retrieve_All Retrieve_One Retrieve_Next Retrieve_Previous Insert_One Delete_One Update_One Retrieve_Few

8Operating System

Page 9: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

File Management SystemsFile Management Systems

사용자와 응용프로그램에게 파일을 사용하기 위해 서비스를 제공하는 일련의 시스템 프로그램 집합

응용 프로그램 사용자가 파일을 접근할 수 있는 유일한 방법

운영체제에서 데이터 저장 관리 기능을 제공함으로써 응용 프로그래머는 별도의 관리 소프트웨어를 개발할 필요가 없음

9Operating System

Page 10: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Objectives for aObjectives for aFile Management SystemFile Management System

사용자의 데이터 관리 요구와 요건을 만족시키는 것 파일 데이터의 유효성을 최대한 보장해 주는 것 성능 최대화

시스템 관점에서의 작업 처리량 , 사용자 관점에서의 응답 시간

다양한 유형의 저장 장치들에 대한 입출력 지원 데이터의 손실 및 파괴 가능성을 최소화하거나 제거 사용자 프로세스에게 일련의 표준화된 입출력

인터페이스를 제공 다수의 사용자에 대한 입출력 지원

10Operating System

Page 11: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Minimal Set of Requirements (1)Minimal Set of Requirements (1)

1. 각 사용자는 파일들을 생성 , 삭제하고 , 읽고 쓰고 수정할 수 있어야 한다

2. 각 사용자는 다른 사용자들의 파일을 접근할 대에 제어를 받아야 한다

3. 각 사용자는 자신의 파일들에 대해 어떤 유형의 접근을 허용할지 제어할 수 있어야 한다

4. 각 사용자는 발생한 문제점에 대해 적절한 형태로 자신의 파일들을 재구성할 수 있어야 한다

11Operating System

Page 12: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Minimal Set of Requirements (2)Minimal Set of Requirements (2)

5. 각 사용자는 파일들 간에 데이터를 이동시킬 수 있어야 한다

6. 각 사용자는 자신의 파일을 백업시킬 수 있어야 하고 , 그 파일이 손상을 입은 경우 회복시킬 수 있어야 한다

7. 각 사용자는 이름을 사용하여 자신의 파일들에 접근할 수 있어야 한다

12Operating System

Page 13: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

File System ArchitectureFile System Architecture

13Operating System

Page 14: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Device DriversDevice Drivers

Lowest level Communicates directly with peripheral devices Responsible for starting I/O operations on a

device Processes the completion of an I/O request

14Operating System

Page 15: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Basic File SystemBasic File System

Physical I/O Deals with exchanging blocks of data Concerned with the placement of blocks Concerned with buffering blocks in main memory

15Operating System

Page 16: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Basic I/O SupervisorBasic I/O Supervisor

Responsible for file I/O initiation and termination Control structures are maintained Concerned with selection of the device on which

file I/O is to be performed Concerned with scheduling access to optimize

performance Part of the operating system

16Operating System

Page 17: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Logical I/OLogical I/O

Enables users and applications to access records Provides general-purpose record I/O capability Maintains basic data about file

17Operating System

Page 18: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Access MethodAccess Method

Reflect different file structures Provides different ways to access and process

data

18Operating System

Page 19: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

File Management FunctionsFile Management Functions

Identify and locate a selected file Use a directory to describe the location of all files

plus their attributes On a shared system describe user access control Blocking for access to files Allocate files to free blocks Manage free storage for available blocks

19Operating System

Page 20: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

20Operating System

Page 21: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

File OrganizationFile Organization

파일 구성 (File Organization) 레코드에 접근하는 방식에 의해 결정되는 레코드의 논리적인

구조 파일의 물리적인 구조는 저장장치의 블록킹 전략과 파일 할당

전략에 의해 결정 종류 :

Pile Sequential file Indexed sequential file Indexed file Direct, or hashed, file

21Operating System

Page 22: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Criteria for File OrganizationCriteria for File Organization

Short access time Needed when accessing a single record Not needed for batch mode

Ease of update File on CD-ROM will not be updated, so this is not a

concern Economy of storage

Should be minimum redundancy in the data Redundancy can be used to speed access such as an

index Simple maintenance Reliability

22Operating System

Page 23: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Pipe (1)Pipe (1)

Data are collected in the order they arrive Purpose is to accumulate a mass of data and save

it Records may have different fields

Length of a record must be specified either implicitly or explicitly

No structure Record access is by exhaustive search

23Operating System

Page 24: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Pile (2)Pile (2)

24Operating System

Page 25: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Sequential File (1)Sequential File (1)

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 One field is the key filed

Uniquely identifies the record Records are stored in key sequence

Typically used in batch applications Involve the processing of all the records

25Operating System

Page 26: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Sequential File (2)Sequential File (2)

Poor performance for interactive applications Queries and/or updates of individual records

Additions to the sequential file New records are placed in a log file or transaction file Batch update is performed to merge the log file with the

master file An alternative is to organize the sequential file as

a linked list

26Operating System

Page 27: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Sequential File (3)Sequential File (3)

27Operating System

Page 28: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Indexed Sequential File (1)Indexed Sequential File (1)

An approach to overcome the disadvantages of the sequential file Records are organized in sequence based on a key field An index to the file to support random access overflow table - similar to the log file

28Operating System

Page 29: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Indexed Sequential File (2)Indexed Sequential File (2)

Index provides a lookup capability to quickly reach the vicinity of the desired record Contains key field and a pointer to the main file Indexed is searched to find highest key value that is

equal to or precedes the desired key value Search continues in the main file at the location indicated

by the pointer

29Operating System

Page 30: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Indexed Sequential File (3)Indexed Sequential File (3)

Comparison of sequential and indexed sequential Example: a file contains 1 million records On average 500,00 accesses are required to find a record

in a sequential file If an index contains 1000 entries, it will take on average

500 accesses to find the key, followed by 500 accesses in the main file. Now on average it is 1000 accesses

30Operating System

Page 31: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Indexed Sequential File (4)Indexed Sequential File (4)

New records are added to an overflow file Record in main file that precedes it is updated to

contain a pointer to the new record The overflow is merged with the main file during a

batch update Multiple indexes for the same key field can be set

up to increase efficiency

31Operating System

Page 32: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Indexed Sequential File (5)Indexed Sequential File (5)

32Operating System

Page 33: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Indexed File (1)Indexed File (1)

Limitation of indexed sequential file Effective processing is limited to that which is based on

a single field of the file Uses multiple indexes for different key fields May contain an exhaustive index that contains one

entry for every record in the main file May contain a partial index Used in applications where timeliness of

information is critical airline reservation systems

33Operating System

Page 34: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Indexed File (2)Indexed File (2)

34Operating System

Page 35: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Direct(or Hashed) File (1)Direct(or Hashed) File (1)

Directly access a block at a known address Key field required for each record Hashing on the key value to get the location of the

record Used where rapid access is required or fixed

length records are used

35Operating System

Page 36: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Direct(or Hashed) File (2)Direct(or Hashed) File (2)

36Operating System

Page 37: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

37Operating System

Page 38: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

File DirectoriesFile Directories

Contains information about files Attributes Location Ownership

Directory itself is a file owned by the operating system

Provides mapping between file names and the files themselves

38Operating System

Page 39: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Simple Structure for a DirectorySimple Structure for a Directory

List of entries, one for each 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 The problem is much worse in shared system

39Operating System

Page 40: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

40Operating System

Page 41: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

41Operating System

Page 42: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Two-level Scheme for a DirectoryTwo-level Scheme for a Directory

One directory for each user and a master directory

Master directory contains entry for each user Provides address and access control

information Each user directory is a simple list of files

for that user Still provides no help in structuring

collections of files

42Operating System

Page 43: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Hierarchical, or Tree-Structured Hierarchical, or Tree-Structured Directory (1)Directory (1)

Master directory with user directories underneath it

Each user directory may have subdirectories and files as entries

Files can be located by following a path from the root, or master, directory down various branches This is the pathname for the file

43Operating System

Page 44: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

44Operating System

Page 45: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Hierarchical, or Tree-Structured Hierarchical, or Tree-Structured Directory (2)Directory (2)

Files can be located by following a path from the root, or master, directory down various branches This is the pathname for the file

Can have several files with the same file name as long as they have unique path names

Current directory is the working directory Files can be referenced relative to the working

directory

45Operating System

Page 46: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

46Operating System

Page 47: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

File SharingFile Sharing

In multiuser system, allow files to be shared among users

Two issues Access rights Management of simultaneous access

47Operating System

Page 48: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Access Rights (1)Access Rights (1)

None User may not know of the existence of the file User is not allowed to read the user directory that

includes the file Knowledge

User can only determine that the file exists and who its owner is

48Operating System

Page 49: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Access Rights (2)Access Rights (2)

Execution The user can load and execute a program but cannot

copy it Reading

The user can read the file for any purpose, including copying and execution

Appending The user can add data to the file but cannot modify or

delete any of the file’s contents useful in collecting data from different users

49Operating System

Page 50: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Access Rights (3)Access Rights (3)

Updating The user can modify, deleted, and add to the file’s data.

This includes creating the file, rewriting it, and removing all or part of the data

Changing protection User can change access rights granted to other users

Deletion User can delete the file

50Operating System

Page 51: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Access Rights (4)Access Rights (4)

Owners Has all rights previously listed May grant rights to others using the following classes of

users Specific user User groups All for public files

51Operating System

Page 52: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Simultaneous AccessSimultaneous Access

User may lock entire file when it is to be updated User may lock the individual records during the

update Mutual exclusion and deadlock are issues for

shared access

52Operating System

Page 53: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Record BlockingRecord Blocking

Records and Blocks Records are the logical unit of access of a file Blocks are the unit of I/O with secondary storage

Issues to consider Fixed or variable block Size of a block

If a file is processed sequentially, larger blocks can reduce number of I/O operations

If records are accessed randomly, larger blocks result in the unnecessary transfer of unused records

53Operating System

Page 54: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Fixed Blocking (1)Fixed Blocking (1)

Fixed-length records are used Integral number of records are stored in a block There may be unused space at the end of each

block Internal fragmentation

Commonly used for sequential files

54Operating System

Page 55: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Fixed Blocking (2)Fixed Blocking (2)

55Operating System

Page 56: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Variable Blocking : Spanned (1)Variable Blocking : Spanned (1)

Variable-length records are used Records are packed into blocks with no unused

space Some records may span two blocks It is indicated by a pointer to the successor block

Efficient use of storage and no limit on the size of records

But difficult to implement

56Operating System

Page 57: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Variable Blocking: Spanned (2)Variable Blocking: Spanned (2)

57Operating System

Page 58: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Variable Blocking : Unspanned (1)Variable Blocking : Unspanned (1)

Variable-length records are used Spanning is not employed

There is a wasted space in most blocks Results in wasted space and limits record size

58Operating System

Page 59: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Variable Blocking Unspanned (2)Variable Blocking Unspanned (2)

59Operating System

Page 60: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Secondary Storage ManagementSecondary Storage Management

A file consists of a collection of blocks Management issues

File allocation space on secondary storage must be allocated to files

Free space management Must keep track of the space available for allocation

60Operating System

Page 61: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

File AllocationFile Allocation

Issues to consider Preallocation VS dynamic allocation Unit of allocation File allocation table(FAT) A data structure that is used to keep track of the space

assigned to a file

61Operating System

Page 62: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

PreallocationPreallocation

Need the maximum size for the file at the time of creation

Difficult to reliably estimate the maximum potential size of the file Tend to overestimated file size so as not to run out of

space So there are advantages to the use of dynamic

allocation

62Operating System

Page 63: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Portion Size (1)Portion Size (1)

Tradeoff between user’s view efficiency vs overall system efficiency Contiguity of space increases performance Large number of small portions increases the size of

management tables Fixed-size simplifies the reallocation of space Variable-size minimizes waste of unused storage

63Operating System

Page 64: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Portion Size (2)Portion Size (2)

Two major alternatives Variable, large contiguous portions

avoids wasted space file allocation tables are small space is hard to reuse

Blocks provides greater flexibility requires large allocation tables contiguity is abandoned

64Operating System

Page 65: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Methods of File Allocation (1)Methods of File Allocation (1)

File allocation methods Contiguous allocation Chained allocation Indexed allocation

65Operating System

Page 66: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Methods of File Allocation (2)Methods of File Allocation (2)

Contiguous allocation A single contiguous set of blocks is allocated to a file at

the time of creation Preallocation using variable-size portions

Only a single entry in the file allocation table Starting block and length of the file

External fragmentation will occur Difficult to find contiguous blocks of sufficient length Compaction is needed from time to time

66Operating System

Page 67: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

67Operating System

Page 68: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

68Operating System

Page 69: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Methods of File Allocation (3)Methods of File Allocation (3)

Chained allocation Allocation on basis of individual block Each block contains a pointer to the next block in the

chain Only single entry in the file allocation table

Starting block and length of file No external fragmentation Best for sequential files No accommodation of the principle of locality

69Operating System

Page 70: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

70Operating System

Page 71: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

71Operating System

Page 72: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Methods of File Allocation (4)Methods of File Allocation (4)

Indexed allocation : Unix file system File allocation table contains a separate one-level index

for each file The file allocation table contains block number for the

index The index has one entry for each portion allocated to the

file Allocation may be either fixed-size or variable-size

72Operating System

Page 73: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

73Operating System

Page 74: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

74Operating System

Page 75: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Methods of File Allocation (5)Methods of File Allocation (5)

75Operating System

Page 76: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Free Space ManagementFree Space Management

The space that is not currently allocated to any file must be managed

Disk allocation table Manages what blocks on the disk are free

Methods for free space management Bit tables Chained free portions Indexing Free block list

76Operating System

Page 77: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Bit Tables Bit Tables

A vector containing one bit for each block on the disk is used Entry of 0 corresponds to a free block An example

00111000011111000011111111111011000 Easy to find free blocks It is as small as possible

77Operating System

Page 78: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Chained Free PortionsChained Free Portions

Free portions are chained by using a pointer No need for a disk allocation table

Every time a block is allocated, pointer needs to be adjusted If many individual blocks need to be allocated at one

time, this greatly slows down the process

78Operating System

Page 79: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

IndexingIndexing

Index table is used One entry in the table for every free portion on the disk

Provides efficient support for all of the file allocation methods

79Operating System

Page 80: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Free Block ListFree Block List

Each block is assigned a number Numbers of all free blocks are maintained

Assuming 32 bits for a block number, size ofthe free block list is 32 times the size of the bit table

Only a small part of the list may reside in main memory Stack or FIFO queue can be used for this purpose

80Operating System

Page 81: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

ReliabilityReliability

Consistency problem of disk allocation and file allocation table between main memory and disk Due to the fact that the system maintained a copy of the

disk allocation table and file allocation table in main memory for efficiency

81Operating System

Page 82: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

UNIX File ManagementUNIX File Management

Files are streams of bytes Types of files

Ordinary - contents entered by user or program Directory - contains list of file names and pointers to

inodes (index nodes) Special - used to access peripheral devices Named - named pipes

82Operating System

Page 83: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

UNIX File SystemUNIX File System

83Operating System

Page 84: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Inodes(Index Nodes)Inodes(Index Nodes)

Control structure that contains key information for a particular file File owner, group owner identifier File type File access permission Access, modified time Number of links to the file File size Table of contents for the disk addresses of data

84Operating System

Page 85: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Inodes(Index Nodes)Inodes(Index Nodes)

Control structure that contains key information for a particular file File owner, group owner identifier File type File access permission Access, modified time Number of links to the file File size Table of contents for the disk addresses of data

85Operating System

Page 86: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

86Operating System

Page 87: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

UNIX File System in More DetailUNIX File System in More Detail

87Operating System

Page 88: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

88Operating System

Page 89: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

89Operating System

Page 90: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Linux Virtual File SystemLinux Virtual File System

Uniform file system interface to user processes Represents any conceivable file system’s general

feature and behavior Assumes files are objects that share basic

properties regardless of the target file system

90Operating System

Page 91: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

91Operating System

Page 92: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

92Operating System

Page 93: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Primary Objects in VFSPrimary Objects in VFS

Superblock object Represents a specific mounted file system

Inode object Represents a specific file

Dentry object Represents a specific directory entry

File object Represents an open file associated with a process

93Operating System

Page 94: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

Windows File SystemWindows File System

Key features of NTFS Recoverability Security Large disks and large files Multiple data streams General indexing facility

94Operating System

Page 95: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

NTFS Volume and File Structure (1)NTFS Volume and File Structure (1)

Sector The smallest physical storage unit on the disk

Cluster One or more contiguous sectors

Volume Logical partition on a disk

95Operating System

Page 96: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

NTFS Volume and File Structure (2)NTFS Volume and File Structure (2)

96Operating System

Page 97: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

NTFS Volume and File Structure (3)NTFS Volume and File Structure (3)

97Operating System

Page 98: File Management Chapter #12. 파일 관리 n In most applications, the file is the central element u Input to applications is by means of a file u Output is saved

98Operating System