파일시스템 (File System)
description
Transcript of 파일시스템 (File System)
파일시스템(File System)
제 14 강 : 파일시스템 (File System)
Access 방법 •Sequential Access [ 카셋 테잎과 유사 ]
read nextwrite next
•Direct Access [LP 레코드 판과 유사 ]read nwrite nposition to n
read nextwrite next
FCB(File Control Block)
FCB
• File Control Block, File Descriptor, inode • 파일과 관련된 모든 정보
– owner– device– content 의 위치– protection (rwx ---)– type– 기타
FCB
file content
File Content 를 위한 공간
Contiguous Allocation Linked AllocationIndexed Allocation
파일 데이터용 공간
indexarray of 주소들
FCB FCBFCB
Contiguous Allocation
파일 데이터용 공간
FCB insert / delete shift?
External Fragmentation
swap 등에는 효율적 (seek time)
Linked Allocation
파일 데이터용 공간
FCBinsert/delete 에는 효율적
Direct Access? - slow ( 디스크를 여러 번 )
링크를 위한 공간 필요
Indexed Allocation
파일 데이터용 공간
indexarray of 주소들
FCB
색인 (index) 블록 – array of sector addresses.
k 번째 항목 - 파일의 k 번째 데이터 블록 주소
Direct Access 에 효율적
인덱스 블록을 위한 공간이 필요
파일 데이터용 공간
FCB FCBFCB
FCB
content
File Open
Filecontent
Filecontent
Filecontent
Filecontent
FCB
Filecontent
Filecontent
Filecontent
Filecontent
Open()
디스크로부터 FCB 을 메모리로
FCB FCB
Filecontent
Filecontent
Filecontent
Filecontent
FCB 가 content 에 대한pointers 를 가지고 있음
FCB FCB
Directory File
directory
하부 file (or directory file)
이름 FCB file content
이름 FCB file content
이름 FCB file content
이름 FCB file content
Directorydirectory
하부 file (or directory file)
이름 FCB file content
이름 FCB file content
이름 FCB file content
이름 FCB file content
Directory
pointer
pointer
pointer
pointer
directory
하부 file (or directory file)
Directory 구조
단일 디렉토리 구조
• 모든 user 통틀어서 한단계 directory .
• 이름 충돌
directory
a temp ch1 ch2 ch3 sec1 sec2
lee park kim
a.hwp b.c c.jpg x.hwp y.java z.jpg m.hwp n.c
MFD:
UFD: UFD:UFD:
file file file file file file file file
2 단계 디렉토리 구조
중앙에 MFD(Master file directory) User -- UFD(User File Directory) pathname -- /kim/test 즉 /user/file user 밑에서 이름 충돌파일을 공유하려면 접근권한을 주어야
bin usr lib
a.hwp b.c c.jpg
x.hwp y.java z.jpg m.hwp n.c
Root:
file file file
file file file file file
tree 형태 디렉토리 구조
lee kim park
lee park lib
a.hwp my-project
c1
Root:
file
file file
Acyclic 그래프 디렉토리 구조
his-project x.hwp her-project
subdirectory 공유 허용 -- 그러나 cycle 은 금지
디스크 공간을 절약 .
공유 subdirectory 이름은 사용자마다 각자 이름으로 호칭
공유 중인 파일을 함부로 제거하면 dangling pointer 문제 발생
lee park lib
a.hwp my-project
c1.c c2.c park
Root:
file file
file file
일반 그래프 디렉토리 구조
his-project x.hwp her-project
공유 , Cycle 모두 허용Traverse, Remove 복잡
Free Space 의 관리
Bit map or bit vector
…
0 1 2 n-1
bit[i] =0 block[i] free
1 block[i] occupied
01 1 1
장점 : 관리가 간편하다 연속된 n 개의 블록을 찾기가 쉽다 .단점 : 공간 overhead
•Linked list – 단점 : 빈 블록이 n 개 필요할 경우 n 번 디스크를 읽어야 한다 .
•Grouping
– 가용 블록들은 n 개의 다른 가용 블록들 주소를 저장하고 있다 .
•Counting
– 연속된 블록 할당 /반환에 착안 – 연속된 블록 중 첫번째 블록의 주소
– 연속된 블록의 개수 (count) 만 기록 . 4
1
1
3
“File System”
• Disk Data Structure
FCB
content
FCBFCB
사용중인 공간
놀고 있는 공간
contiguouslinkedindexed
linkedgroupingcounting
directory구조