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

Pintos Project/Project 410

[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.