. '분류 전체보기' 카테고리의 글 목록 (4 Page)
본문 바로가기

분류 전체보기111

[PintOS, Project 4] Indexed and Extensible Files Indexed and Extensible Files The basic file system allocates files as a single extent, making it vulnerable to external fragmentation, that is, it is possible that an n-block file cannot be allocated even though n blocks are free (i.e. external fragmentation). Eliminate this problem by modifying the on-disk inode structure. 현재의 file system은 single extent로 파일을 할당하기 때문에 (즉, 데이터가 이어진 형태의 연속 할당을 채택하.. 2021. 3. 2.
[PintOS, Project 4] File System Implementation File System Implementation ㆍAllocation methods : File 저장을 위한 디스크 공간 할당 방법 ㆍFree space management : 디스크의 빈 공간 관리 Allocation Methods Continuous Allocation - 한 File을 디스크의 연속된 block에 저장 - 장점 : ㆍ효율적인 file 접근 (순차, 직접 접근) - 문제점 : ㆍ새로운 file을 위한 공간 확보가 어려움 ㆍ외부 단편화 ㆍFile 공간 크기 결정이 어려움 : 파일이 커져야 하는 경우를 고려해야한다. Linked Allocation - File이 저장된 block들을 linked list로 연결 : 비연속 할당 가능 - Directory는 각 file에 대한 첫번째 blo.. 2021. 3. 2.
[PintOS, Project 4] File Protection File Protection File에 대한 부적절한 접근 방지 - 다중 사용자 시스템에서 더욱 필요 접근 제어가 필요한 연산들 - Read (R) - Write (W) - Execute (X) - Append (A) File Protection Mechanism 파일 보호 기법은 system size 및 응용 분야에 따라 다를 수 있음 1. Password 기법 ㆍ각 file들에 PW 부여 ㆍ비현실적 → 사용자들이 파일 각각에 대한 PW를 기억해야 함 → 접근 권한 별로 서로 다른 PW를 부여해야 함 2. Access Matrix 기법 ㆍ범위(domain)와 개체(object)사이의 접근 권한을 명시 (domain : 사용자, 개체 : 파일 이라고 생각할 수 있다.) ㆍObject : 접근 대상 (fi.. 2021. 3. 2.
[PintOS, Project 4] Directory Structure Directory란? 우리가 흔히 부르는 '폴더'이다. File Direcotry Structure Logical directory structure Flat (single-level) directory structure ㆍ전체 파일 시스템에 하나의 디렉토리만 존재하는 형태 ㆍ적은 수의 파일이 있을 때 사용된다. 2-level directory structure ㆍ사용자 마다 하나의 directory 배정 ㆍ구조 : MFD (Master File Directory), UFD (User File Directory) ㆍ문제점 : Sub-directory 생성 불가능 (File naming Issue 발생) 사용자간 파일 공유 불가 Hierarchical (tree-structure) direcotry str.. 2021. 3. 2.
[PintOS, Project4] File System Overview File System 사용자들이 사용하는 파일들을 관리하는 운영체제의 한 부분 File System의 구성 - Files ㆍ연관된 정보의 집합 - Directory structure ㆍ시스템 내 파일들의 정보를 구성 및 제공 - Partitions ㆍDirectory들의 집합을 논리적/물리적으로 구분 File Concept - 보조 기억 장치에 저장된 연관된 정보들의 집합 ㆍ보조 기억 장치 할당의 최소 단위 ㆍSequence of bytes (물리적 정의) - 내용에 따른 분류 ㆍProgram file : Source program, object program, executable files 등.. ㆍData file - 형태에 따른 분류 ㆍText (ascii) file ㆍBinary file File.. 2021. 3. 2.
[PintOS, Project3] Memory Mapped Files MMP (Memory Mapped Files) - mmp는 file_backed mapping이다. - 만약 page fault가 일어나면, phy frame은 즉시 할당되고, content는 file에서 memory로 간다. mmp가 unmap되거나 swap out되면 content 변경 사항은 file에 반영되어야한다. mmap / munmap system call mmap - fd로 연 파일을 offset부터 length만큼 mapping한다. - addr부터 전체 파일이 연속적으로 va에 mapping된다. - 파일 크기가 PGSIZE의 배수가 아니면 몇 바이트들이 파일 너머로 튀어나오게 된다. - page fault가 났을 때, 이 바이트들을 zero로 하고, disk로 write-back할 때.. 2021. 2. 25.
[PintOS, Project 3] Anonymous Page spt spt copy - src에서 dst로 spt 복사 - fork()할 때 사용한다. - Iteration 사용 - uninit page를 만들고 즉시 claim까지 해야한다. -> 기존의 (lazy안하고 남아있던) uninit을 복사하는 것인가? 아니면 새 프로세스가 가져야할 전체 page를 하는 것인가? spt kill - spt가 들고있는 모든 자원을 free한다. - process_exit()할 때, 이 함수가 호출된다. - pag entry를 itration으로 destroy한다. - pml4랑 물리 메모리는 고려안해도 된다. Page Cleanup uninit_destory랑 anon_destroy를 시행한다. uninit 페이지가 다른 page obj로 변했더라도, type은 unini.. 2021. 2. 23.
[PintOS, Project 3] Stack Growth Stack Growth - 스택에 접근하려고 할 때, 추가 페이지를 할당한다. - 스택포인터를 조정하기 전에 접근 허가를 체크할 것이고, 이는 현 스택 포인터 8byte 아래에 페이지 폴트를 야기할 것이다. - 현 유저 프로그램의 스택 포인터의 현재 값을 획득해야한다. - 유저 프로그램이 페이지 폴트를 발생시키거나, 시스템콜을 호출할 때, if에서 rsp를 획득해서 시스콜이나 페이지폴트에 전달할 수 있다. - 페이지 폴트시에 invalid memory access 를 탐지하고 싶다면, page fault가 kernel에서 일어나고 있는지도 체크해야한다. - 프로세서는 exception이 user mode에서 kernenl mode로 바꿀 때만 스택 포인터를 저장하고 있기 때문에, if밖에서 rsp를 읽어.. 2021. 2. 23.
[PintOS, Project 3] Hash Table Data Types Hash Table은 struct hash로 나타내어진다. struct hash; hash table을 의미한다. struct hash에는 직접 접근할 수 없기 때문에 필요시에는 hash table function과 macro를 사용한다. hash table은 struct hash_elem을 리스트의 인자로 가진다. struct hash_elem; hash table에 관련된 함수들은 hash elem을 인자로 가지거나 반환한다. hash table의 real elemnt가 주어졌을 때, hash elem을 가리키는 포인터를 획득하기 위해서는 & (비트연산자)를 사용해야한다. 다른 방향으로 가고 싶으면 hash_entry()를 사용하라. #define hash_entry (elem, .. 2021. 2. 19.
[PintOS, Project 3] Virtual Memory Management - Variable Allocation and Consideration Working Set (WS) Algorithm Working Set - Process가 특정 시점에 자주 참조하는 page들의 집합 - 최근 일정시간 동안(Δ) 참조된 page들의 집합 - 시간에 따라 변함 - W(t, Δ) ㆍThe working set of a process at time t ㆍTime interval [t-Δ, t] 동안 참조된 pages들의 집합 (t-Δ, t]는 포함되지 않음) ㆍΔ : window size, system parameter Working set memory management - Locality에 기반을 둠 - Working set을 메모리에 항상 유지 ㆍPage fault rate (thrashing) 감소 ㆍ시스템 성능 향상 - Window size (Δ) .. 2021. 2. 19.
[PintOS, Project 3] Virtual Memory Management - Replacement Strategies for Fixed Allocation Locality;지역성 프로세스가 프로그램/데이터의 특정 영역을 집중적으로 참조하는 현상 - 원인 : ㆍLoop structure in program (for문, while문) ㆍArray, structure 등의 데이터 구조 (한 구조체에서 값을 불러왔을 때, 짧은 시일 내에 그 구조체에서 다른 값을 호출할 가능성이 높다) - 공간적 지역성 (Spatial locality) ㆍ참조한 영역과 인접한 영역을 참조하는 특성 - 시간적 지역성 (Temporal locality) ㆍ한 번 참조한 영역을 곧 다시 참조하는 특성 Replacement Strategies - Fixed allocation : 한 프로세스에게 정해진 수의 page frame을 할당한다. ㆍMIN(OPT, B0) algorithm ㆍRa.. 2021. 2. 18.
[PintOS, Project 3] Virtual Memory Management - SW Components Software Components 가상 메모리 성능 향상을 위한 관리 기법들 - Allocation strategies (할당 기법) - Fetch strategies - Placement strategies (배치 기법) - Replacement strategies (교체 기법) - Cleaning strategies (정리 기법) - Load control strategies (부하 조절 기법) 1. Allocation Strategies 각 프로세스에게 메모리를 얼마 만큼 줄 것인가? - Fixed allocation (고정 할당) ㆍ프로세스의 실행 동안 고정된 크기의 메모리 할당 - Variable allocation (가변 할당) ㆍ프로세스의 실행 동안 할당하는 메모리의 크기가 유동적 고려사항.. 2021. 2. 18.
[PintOS, Project 3] Virtual Memory Management - Cost Model / HW Components Virtual Memory (기억장치) - Non-continuous allocation ㆍ사용자 프로그램을 block으로 분할하여 적재/실행 - Paging / Segmentation system 가상 메모리 관리의 목적 - 가상 메모리 시스템 성능 최적화 ㆍPage fault frequency (발생 빈도) ㆍPage fault rate (발생률) : Page fault rate를 최소화 할 수 있도록 전략들을 설계해야 함 -> Context switch 및 Kernel 개입을 최소화 -> 시스템 성능 향상 Cost Model - Page reference string (d) ㆍ프로세스의 수행 중, 참조한 페이지 번호 순서 ㆍω = r1r2 ... rk ... rT (프로세스가 실행되면서 참조한 페이.. 2021. 2. 18.
[PintOS, Project3] Virtual Memory - Segmentation System Segmentation System - 프로그램을 논리적 block으로 분할 (segment) ㆍBlock의 크기가 서로 다를 수 있음 - 특징 : ㆍ메모리를 미리 분할하지 않음. (VPM과 유사) ㆍSegment sharing / protection이 용이함 ㆍ메모리를 동적으로 분할하기 떄문에, Address mapping 및 메모리 관리의 overhead 가 큼 -> 대신 메모리를 효율적으로 활용할 수 있다. ㆍNo internal fragmentation -> External fragmentation 발생 가능 Address Mapping - Virtual address : v = (s, d) ㆍs : segment number ㆍd : displacement in a segment - Segmen.. 2021. 2. 18.