Chapter 13. File-System Interface

송승윤·4일 전

운영체제 정리

목록 보기
9/10

File-System Interface

Basic Concept

File은 논리적 저장 장치임
저장 장치의 물리적 성질을 추상화한거
non-volatile하고 프로그램 및 데이터를 나타냄

File Attributes


대충 메타데이터는 이러함

File Operations

기본적인 파일 동작은 아래와 같음
Create a file
Open a file
Write a file – write pointer location (다음 쓰기가 수행될 위치)
Read a file – read pointer location (다음 읽기가 수행될 위치)
Reposition within a file – seek(검색)
Delete a file
Truncate a file – 파일의 속성을 유지하면서 내용을 삭제

생성 및 삭제를 제외한 모든 작업에는 먼저 파일 open()이 필요함
OS는 열린 파일을 추적하기 위해 open-file table을 유지함
open count : 파일이 열린 횟수 카운터

Unix랑 Linux에서는 일케 씀

File Locking

한 프로세스가 파일을 잠그도록 허용하고 다른 파일이 접근 못하게 막음

reader lock과 유사한 Shared lock : 몇몇 프로세스가 동시에 획득 가능
wirterlock과 유사한 Exclusive lock

Mandatory OS가 locking integrity를 보장
Advisory 개발자가 잠금 장치를 유동성있게 함

File Types

File system : device, directory, symbolik link
OS 또는 runtime library : dll, code, obj
application prgoram : jpg, mpg, avi

Access Methods

Sequential Access : read next, write next, reset
Direct Access : read n, write n, position to n
Index Access : 책뒤에 있는 목차마냥 씀

Directory Structure

파일 정보에 대한 노드들의 모음이고 디스크에 위치함

Efficiency - 파일을 신속하게 찾기
Name – 사용자에게 편리함
두 사용자가 서로 다른 파일에 대해 같은 이름을 가질 수 있고 같은 파일에 여러 가지 다른 이름이 있을 수 있음
Grouping - 속성별로 파일에 대한 논리적인 그룹화

Single-Level Directory

모든 유저에 대해 single directory
Naming Problem(이름이 겹치면 안됨), Grouping Problem이 있음

Two-Level Directory

각 유저마다 디렉토리를 나눔으로써 유저별로 같은 이름의 파일 가능
Path name : user name + file name

검색이 효율적이지만 유저마다 그룹화가 안됨

Tree-Structured Directories

가장 대중적인 트리 구조

Acyclic-Graph Directories

디렉토리가 서브디렉토리랑 파일들을 공유하도록 허용하는 구조(사이클 X)
동일 파일에 다른 경로 가능

General Graph Directory

사이클을 허용하는 구조
Reference count랑 garbage collection을 사용함

일케 되면 접근이 불가능해짐

Access Lists and Groups in Unix

access mode 종류 : read(R), write(W), execute(X)

일케 십진수로 권한을 표현함

chgrp G game : 사용자가 매니저에게 그룹에 참여 요청

Memory-Mapped Files

virtual address space의 일부를 파일과 논리적으로 연결하도록 허용함
disk block을 메모리의 page에 매핑
page fault시 파일 시스템에서 physical page로 읽기

0개의 댓글