. 'Pintos Project' 카테고리의 글 목록
본문 바로가기

Pintos Project38

[PintOS, Project 4] Buffer Cache 구현 히히히 이걸 언제 다해 ++++ 벌레잡기 ++++ page를 만들지 못한다. 왜일까 이걸 initializer에서 해줄려고 해서 문제일까? (hash가 만들어지기도 전에) hash는 supplemental_page_table에서 해주는데 흠.... cache_init은 스레드만 만들고 페이지를 만드는 것은 여기서 하면 안되는걸까 이걸 함수로 따로 만들고, setupstack할 때, 같이 만들어 봐야겠따. void create_cache_page(void) { list_init(&cache_list); for (int i = 0 ; i < 8 ; i++) { void *tmp = UNDER_STACK - PGSIZE*(i+1); struct cache_entry *entry = malloc(sizeof(s.. 2021. 3. 8.
[PintOS, Project 4] Buffer Cache Modify the file system to keep a cache of file blocks. When a request is made to read or write a block, check to see if it is in the cache, and if so, use the cached data without going to disk. Otherwise, fetch the block from disk into the cache, evicting an older entry if necessary. You are limited to a cache no greater than 64 sectors in size. file block을 cache로 보존하기 위해 file system을 수정하라. bloc.. 2021. 3. 6.
[PintOS, Project 4] File Growth 구현 [PintOS, Project 4] Indexed and Extensible Files (tistory.com) [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 alloc.. firecatlibrary.tistory.com 할 일을 정리해보자. 원래는 inode_create()에서 인자로 length (파일의 크기) 를 받았다. 그.. 2021. 3. 5.
[PintOS, Project 4] Directory.c 공부 디렉토리 날새게 날려가요 햄토리 챗바퀴를 돌려봐요 햄토리 제일 좋아하는건~ 닭도리 아싸라비야 고도리 맨손으로 때려잡은 북경오리 이건 너와 나의 연결고리 .... 디렉토리 공부를 시작하자 /* A directory. */ struct dir { struct inode *inode; /* Backing store. */ off_t pos; /* Current position. */ }; directory 구조체이다. 이것만 봐서는 뭘 말하는건지 모르겟다. 단지 inode를 가지고 있을 뿐이다. inode_sector가 아니라 inode를 가리키는 거 보니 이것도 memory에 올리는 놈인가? /* A single directory entry. */ struct dir_entry { disk_sector_t .. 2021. 3. 5.
[PintOS, Project 4] Filesys.c 구현 이번에는 좀 나대보도록 하겠다. 공부와 동시에 바로 구현에 들어간다. /* Initializes the file system module. * If FORMAT is true, reformats the file system. */ void filesys_init (bool format) { filesys_disk = disk_get (0, 1); if (filesys_disk == NULL) PANIC ("hd0:1 (hdb) not present, file system initialization failed"); inode_init (); #ifdef EFILESYS fat_init (); if (format) do_format (); fat_open (); #else /* Original FS */ .. 2021. 3. 4.
[PintOS, Project 4] inode.c 구현 ※ 이 글은 Project 4를 구현중인 불확실과 추론의 영역입니다. 특히 이부분은 다른 곳을 구현하면서 수정할 여지가 높은 곳입니다. 착한 어린이들은 따라하지 마세요. 우선 inode_create부터 만들어보자. 이 함수는 인자로 받은 sector에 찾아가 inode_disk를 sector에 넣고 연속적으로 실제 데이터를 넣을 sector를 확보해놓는 것이다. 여기서 바꿀 곳은 free-map (bitmap)으로 빈 sector를 찾던 것을 FAT free block list로 바꾸고, 실제 data도 비연속할당으로 넣는 것이다. /* Initializes an inode with LENGTH bytes of data and * writes the new inode to sector SECTOR on .. 2021. 3. 4.
[PintOS, Project 4] fat.c 구현 ※ 이 글은 Project 4를 구현중인 불확실과 추론의 영역입니다. 특히 이부분은 다른 곳을 구현하면서 수정할 여지가 높은 곳입니다. 착한 어린이들은 따라하지 마세요. ※ fat.c 공부때랑 좀 달라진 곳이 많다. 혹시나 참고하셨던분들은 죄송합니다. ㅎㅎ;; void fat_fs_init (void) { /* TODO: Your code goes here. */ /* ---------------------------- >> Project.4 FAT >> ---------------------------- */ fat_fs->fat = NULL; fat_fs->fat_length = fat_fs->bs.fat_sectors; fat_fs->data_start = fat_fs->bs.fat_start+fa.. 2021. 3. 4.
[PintOS, Project 4] inode.c 공부 ※ 이 글은 Project 4를 본격적으로 시작하기 전, 추론의 영역입니다. 기존시스템은 bitmap으로 디스크를 관리하고 있다. 그리고 inode.c는 bitmap 기반으로 짜여져있다. 그런데 이제 FAT를 도입했으니 bitmap을 다 지워고 FAT 기반으로 다 깔아야된다. 그 말은 filesys나 file에 관련된 것들을 전부 갈아엎어야한다는 것이다. 심지어 bitmap은 연속할당이었으나, FAT은 연속할당도 아니다. 마치 1x1 레고 블록을 드렸으니 이걸로 도시를 만들어보세요라는 느낌이다. 시발 일단 inode.c부터 공부해보자. /* On-disk inode. * Must be exactly DISK_SECTOR_SIZE bytes long. */ struct inode_disk { disk_se.. 2021. 3. 4.
[PintOS, Project 4] fat.c 공부 ※ 이 글은 Project 4를 본격적으로 시작하기 전, 추론의 영역입니다. /* FAT FS */ struct fat_fs { struct fat_boot bs; unsigned int *fat; unsigned int fat_length; disk_sector_t data_start; cluster_t last_clst; struct lock write_lock; }; FAT FS라고 함은 한 파일 내에서 사용하는 FAT인 것 같다. fat_boot : 전체 파일 시스템의 정보가 담겨있는 것이라고 생각된다. fat_length : FS 안에 들어가있는 sector의 갯수 data_start : 비어있는 첫 sector last_clst : file이 할당받은 cluster 중, 마지막 cluster?.. 2021. 3. 3.
[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, 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.