-
Notifications
You must be signed in to change notification settings - Fork 0
5주차 스터디 🔜 #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kimdev0206
wants to merge
24
commits into
main
Choose a base branch
from
yongki/05
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
5주차 스터디 🔜 #18
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
502608f
:sparkles: Pending first draft of 5주차 스터디
kimdev0206 ea46a8a
:white_check_mark: Finish GC content
kimdev0206 3eea2ee
:sparkles: Pending first draft of 주언어 빌트인 자료형 조사
kimdev0206 71d48a5
:white_check_mark: Finish LinkedList vs Array content
kimdev0206 d289ff1
:poop: Pending second one of 주언어 빌트인 자료형 조사
kimdev0206 8d29a99
:poop: Pending third one of 주언어 빌트인 자료형 조사
kimdev0206 3f15e4b
:children_crossing: Improve readability
kimdev0206 01da16c
:white_check_mark: Finish 주언어 빌트인 자료형 조사: Map
kimdev0206 a39923b
:children_crossing: Improve readability
kimdev0206 8469226
:pencil2: Fix typo
kimdev0206 754a13c
:speech_balloon: Add Disk.md
kimdev0206 a0097c5
:white_check_mark: Finish 주언어 빌트인 자료형 조사: Array
kimdev0206 b1b5191
:children_crossing: Improve readability
kimdev0206 691ab5d
:truck: Rename Disk to FileSystem
kimdev0206 9de333d
:white_check_mark: Finish FileSystem
kimdev0206 51608fe
:memo: Add presentation
kimdev0206 305798c
:bento: Add file descriptor asset
kimdev0206 b171ace
:adhesive_bandage: Fix file descriptor asset
kimdev0206 b936839
:bento: Add block type asset
kimdev0206 5a82a31
:adhesive_bandage: Fix file descriptor asset
kimdev0206 d938394
:memo: Finish presentation
kimdev0206 1e3f5f3
:adhesive_bandage: Fix needless content
kimdev0206 a4c2bdd
:pencil2: Fix typo
kimdev0206 f618b06
:bento: 별도의 슬라이드 링크 변경
kimdev0206 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,330 @@ | ||
| # 파일 시스템 | ||
|
|
||
| - [파일 시스템](#파일-시스템) | ||
| - [Block](#block) | ||
| - [Inode struct](#inode-struct) | ||
| - [Directory](#directory) | ||
| - [File descriptor](#file-descriptor) | ||
| - [Reading a file from Disk](#reading-a-file-from-disk) | ||
| - [Creating & Writing a File from Disk](#creating--writing-a-file-from-disk) | ||
| - [참고문헌](#참고문헌) | ||
|
|
||
| ## Block | ||
|
|
||
| <table> | ||
| <tr> | ||
| <td width="50%"> | ||
| <img src="https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb2MSQM%2FbtqFjc2CP8t%2F5Jv2MbqFws4bkKdk0EZpa1%2Fimg.png"> | ||
| </td> | ||
| <td> | ||
| <p> | ||
| <code>C</code>의 조각난 모양을 sector라고 한다. | ||
| <br/> | ||
| 파일 시스템은 이 섹터를 여러 개 모아서 block이라는 단위를 사용한다. | ||
| </p> | ||
| <p> | ||
| OS는 disk를 일정한 크기의 block으로 나누어 저장한다. | ||
| </p> | ||
| </td> | ||
| </tr> | ||
| </table> | ||
|
|
||
| 각 block은 그 목적에 따라 아래의 4가지로 구분지을 수 있다. | ||
|
|
||
| - `Super block` | ||
|
|
||
| file system의 global한 정보들을 담는 block으로 하나의 file system에 1개만 존재한다. | ||
| <br/> | ||
|
|
||
| - `Allocation structure block` | ||
| <table> | ||
| <tr> | ||
| <td width="50%"> | ||
| <img src="assets/bitmap-consistent.png"> | ||
| </td> | ||
| <td> | ||
| bitmap의 방법으로 inode struct와 data block의 data에 대해 used/unused 정보가 저장된다. | ||
| </td> | ||
| </tr> | ||
| </table> | ||
| <br/> | ||
|
|
||
| - `Key meta data block` | ||
|
|
||
| inode struct의 table이 저장된다. | ||
| <br/> | ||
|
|
||
| - `User data block` | ||
|
|
||
| 실제 data들이 저장된다. | ||
| <br/> | ||
|
|
||
| 즉, 다음과 같다. | ||
|
|
||
|  | ||
|
|
||
| ## Inode struct | ||
|
|
||
| Inode struct에는 file에 대한 meta data가 저장된다. | ||
|
|
||
| file의 size, mode, permission, 소유자, 각종 시각 등이 저장된다. | ||
|
|
||
| 각 file마다 하나의 Inode struct가 부여된다. | ||
|
|
||
| Inode struct에서 가장 중요한 정보는 실제 data가 저장된 `user data block`의 pointer이다. | ||
|
|
||
| file의 크기가 block의 size보다 클 경우에는 여러 block을 사용해야 하기 때문에 data block을 가리키는 여러 pointer 변수들이 Inode struct에 존재하게 된다. | ||
|
|
||
| ### Directory | ||
|
|
||
| Directory는 file의 한 종류이다. | ||
|
|
||
| 그렇다면 Directory의 Inode struct는 어떻게 구성되어 있을까? Inode struct의 일반적인 구성과 동일하다. | ||
|
|
||
| Directory의 `user data block`에서의 data가 다른데, Directory 하위 항목들에 대한 linked list를 저장된다. | ||
|
|
||
| linked list의 각 node는 Inode number와 name을 구성 요소로 갖는다. | ||
| 이때 Inode struct pointer를 직접 저장하지 않고 단순 index 번호만 저장함으로써 공간을 절약한다. | ||
|
|
||
| Directory마다 단순 선형 linked list를 운용하게 될 경우 깊은 계층 구조를 갖는 Directory에서 성능이 많이 하락하기 때문에 B-tree와 같은 자료구조를 사용해 성능을 향상시키기도 한다. | ||
|
|
||
| ### File descriptor | ||
|
|
||
| 각 process는 고유한 `File descriptor table`을 운용한다. | ||
|
|
||
| File descriptor란 해당 process가 어떤 file을 open했을 때 return되는 값인데, 한 process가 한 file을 여러 번 open할 수도 있다. | ||
|
|
||
| 이 때마다 File descriptor는 새로 할당되게 된다. | ||
| 즉, 같은 file에 대해 다른 File descriptor를 동시에 가질 수도 있는 것이다. | ||
|
|
||
| 각 File descriptor는 `open file table`을 가리킨다. | ||
|
|
||
| 각 항목이 가리키는 방향을 정리하자면 다음과 같다. | ||
|
|
||
|  | ||
|
|
||
| ## Reading a file from Disk | ||
|
|
||
| 토글 안의 설명 한줄이 예시 사진 테이블의 한 행에 대한 설명이다. | ||
|
|
||
| <table> | ||
| <tr> | ||
| <th colspan="2"> | ||
| /foo/bar 파일을 찾아보자. | ||
| </th> | ||
| </tr> | ||
| <tr> | ||
| <td width="50%"> | ||
| <img src="https://cpm0722.github.io/assets/images/2020-12-01-File-System/03.png"> | ||
| </td> | ||
| <td> | ||
| <details> | ||
| <summary>1. root directory (“ / “) read</summary> | ||
| <blockquote> | ||
| a. root의 inode struct read | ||
| <br/> | ||
| root의 block pointer 획득 | ||
| <br/> | ||
| b. root의 data block read | ||
| <br/> | ||
| root의 하위 항목들에 대한 linked list 획득 | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| <details> | ||
| <summary>2. foo directory (“ /foo “) read</summary> | ||
| <blockquote> | ||
| a. root의 하위 항목들에 대한 linked list에서 | ||
| <br/> | ||
| 이름이 “foo”인 항목의 inode number 획득 | ||
| <br/> | ||
| b. inode number를 통해 inode table에서의 주소 계산 | ||
| <br/> | ||
| c. foo의 inode sturct read | ||
| <br/> | ||
| foo의 block pointer 획득 | ||
| <br/> | ||
| d. foo의 data block read | ||
| <br/> | ||
| foo의 하위 항목들에 대한 linked list 획득 | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| <details> | ||
| <summary>3. bar file (“ /foo/bar “) read</summary> | ||
| <blockquote> | ||
| a. bar의 하위 항목들에 대한 linked list에서 | ||
| <br/> | ||
| 이름이 “bar”인 항목의 inode number 획득 | ||
| <br/> | ||
| b. inode number를 통해 inode table에서의 주소 계산 | ||
| <br/> | ||
| c. bar의 inode struct read | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| <details> | ||
| <summary>4. bar[0] read</summary> | ||
| <blockquote> | ||
| a. bar의 inode struct에서 | ||
| <br/> | ||
| 첫번째 data block pointer 획득 | ||
| <br/> | ||
| b. data block read | ||
| <br/> | ||
| c. bar inode struct write | ||
| <br/> | ||
| (access time 등 갱신 위함) | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| <details> | ||
| <summary>5. bar[1] read</summary> | ||
| <blockquote> | ||
| a. bar의 inode struct에서 | ||
| <br/> | ||
| 두번째 data block pointer 획득 | ||
| <br/> | ||
| b. data block read | ||
| <br/> | ||
| c. bar inode struct write | ||
| <br/> | ||
| (access time 등 갱신 위함) | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| <details> | ||
| <summary>6. bar[2] read</summary> | ||
| <blockquote> | ||
| a. bar의 inode struct에서 | ||
| <br/> | ||
| 세번째 data block pointer 획득 | ||
| <br/> | ||
| b. data block read | ||
| <br/> | ||
| c. bar inode struct write | ||
| <br/> | ||
| (access time 등 갱신 위함) | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| </td> | ||
| </tr> | ||
| </table> | ||
|
|
||
| ## Creating & Writing a File from Disk | ||
|
|
||
| <table> | ||
|
|
||
| <tr> | ||
| <th colspan="2"> | ||
| /foo/bar 파일을 생성하고 사용하자. | ||
| </th> | ||
| </tr> | ||
| <tr> | ||
| <td width="50%"> | ||
| <img src="https://cpm0722.github.io/assets/images/2020-12-01-File-System/04.png"> | ||
| </td> | ||
| <td> | ||
| <details> | ||
| <summary>1. root directory (“ / “) read</summary> | ||
| <blockquote> | ||
| a. root의 inode struct read | ||
| <br/> | ||
| root의 block pointer 획득 | ||
| <br/> | ||
| b. root의 data block read | ||
| <br/> | ||
| root의 하위 항목들에 대한 linked list 획득 | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| <details> | ||
| <summary>2. foo directory (“ /foo “) read</summary> | ||
| <blockquote> | ||
| a. root의 하위 항목들에 대한 linked list에서 | ||
| <br/> | ||
| 이름이 “foo”인 항목의 inode number 획득 | ||
| <br/> | ||
| b. inode number를 통해 inode table에서의 주소 계산 | ||
| <br/> | ||
| c. foo의 inode sturct read | ||
| <br/> | ||
| foo의 block pointer 획득 | ||
| <br/> | ||
| d. foo의 data block read | ||
| <br/> | ||
| foo의 하위 항목들에 대한 linked list 획득 | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| <details> | ||
| <summary>3. bar file (“ /foo/bar “) create</summary> | ||
| <blockquote> | ||
| a. 현재 사용 중인 inode number을 확인하기 위해 | ||
| <br/> | ||
| inode bitmap read | ||
| <br/> | ||
| b. 미사용 중인 inode number 선택 후 사용 중으로 변경하기 위해 | ||
| <br/> | ||
| inode bitmap write | ||
| <br/> | ||
| c. foo의 하위 항목들에 대한 linked list에 | ||
| <br/> | ||
| 획득한 inode number와 “bar” 명칭으로 항목 추가하기 위해 | ||
| <br/> | ||
| bar data block write | ||
| <br/> | ||
| d. bar inode struct read | ||
| <br/> | ||
| (inode struct 초기화 위함) | ||
| <br/> | ||
| e. bar inode struct write | ||
| <br/> | ||
| (inode struct 초기화 위함) | ||
| <br/> | ||
| f. foo inode struct write | ||
| <br/> | ||
| (inode struct 초기화 위함) | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| <details> | ||
| <summary>4. bar file (“ /foo/bar “) write</summary> | ||
| <blockquote> | ||
| a. write 가능한 여유 있는 data block 존재 여부 확인하기 위해 | ||
| <br/> | ||
| bar inode struct read | ||
| <br/> | ||
| b. 현재 사용 중인 data block number 확인하기 위해 | ||
| <br/> | ||
| data bitmap read | ||
| <br/> | ||
| c. 미사용 중인 data block number 선택 후 | ||
| <br/> | ||
| 사용 중으로 변경하기 위해 | ||
| <br/> | ||
| data bitmap write | ||
| <br/> | ||
| d. bar data block write | ||
| <br/> | ||
| e. bar inode write | ||
| <br/> | ||
| (access time 등 갱신 위함) | ||
| </blockquote> | ||
| </div> | ||
| </details> | ||
| </td> | ||
| </tr> | ||
|
|
||
| </table> | ||
|
|
||
| <hr/> | ||
|
|
||
| ## 참고문헌 | ||
|
|
||
| [파일시스템](https://hini7.tistory.com/88) -- 희은w | ||
|
|
||
| [파일시스템](https://cpm0722.github.io/operating-system/file-system) -- Hansu Kim | ||
|
|
||
| [File descriptor](https://www.computerhope.com/jargon/f/file-descriptor.htm) -- Computer Hope | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.