diff --git a/W10D1/io-ltc.md b/W10D1/io-ltc.md new file mode 100644 index 0000000..67ba6b0 --- /dev/null +++ b/W10D1/io-ltc.md @@ -0,0 +1,9 @@ +# I/O + +1. Polling, Busy waiting +2. Interrupt driven I/O +3. DMA +4. Memory-mapped I/O +5. I/O software layers +6. Disk scheduling +7. X-window system diff --git a/W14D1/review-ltc.md b/W14D1/review-ltc.md new file mode 100644 index 0000000..072d6c2 --- /dev/null +++ b/W14D1/review-ltc.md @@ -0,0 +1,31 @@ +# Review OS + +## History + +- 1950s: batch processing +- 1960s: multiprogramming +- 1970s: time-sharing +- 1980s: personal computing +- 1990s: distributed computing + +## Process + +1. User/kernel process/thread +2. Interfaces: fork, exec, wait, exit +3. Scheduling +4. States: running, ready, blocked, zombie + +## Memory + +1. Physical memory + Interfaces: kmalloc, alloc_pages, vmalloc +2. Virtual memory + - Page table + - Interfaces: mmap, munmap, mprotect, mremap, msync + - malloc: dynamic memory allocation + +## File system + +1. File: sequence of bytes + Interfaces: open, read, write, close +2. VFS diff --git a/W6D1/filesystem-ltc.md b/W6D1/filesystem-ltc.md new file mode 100644 index 0000000..00da327 --- /dev/null +++ b/W6D1/filesystem-ltc.md @@ -0,0 +1,55 @@ +# File System + +Lin Tianchuan + +Examples + +- EXT2 (in Linux) + by Rémy Card, 1994 + (FFS at BSD by McKusick) +- FAT + by Tim Paterson, 1980 + +Filesystem = {set of files} + +Q: Where is file A? + Where is file A's block (data) ? + +The following notes use the ext2 filesystem as an example. + +## Disk layout + +![](http://www.science.smith.edu/~nhowe/262/oldlabs/img/ext2.png) + +Data Block Bitmap & Inode Bitmap: A bit value of 0 indicates that the block/inode is free, while a value of 1 indicates that the block/inode is being used. + +![](http://www.science.smith.edu/~nhowe/262/oldlabs/img/ext2_bitmap.png) + +## Inode + +![](https://www.science.unitn.it/~fiorella/guidelinux/tlk/img84.gif) + +struct ext2.inode (128 B) + +- 12 direct blocks: pointers to the physical data blocks +- indirect blocks: points at a block of pointers to data blocks +- double indirect: points at a block of pointers to blocks of pointers to data blocks +- triple indirect: ... + +K = blk_size / index_size + +Max block num of a inode: 12 + K + K^2 + K^3 + +## Directory inode + +![](http://www.science.smith.edu/~nhowe/262/oldlabs/img/dir_entry.png) + +## Locating a file + +![](http://www.science.smith.edu/~nhowe/262/oldlabs/img/ext2_locate.png) + +## Hard link / Symbolic link + +- Hard link: multiple entries in (same or different) directory inode point to the same inode. + - Every non-root directory inode contains a hard link `.` to itself and a hard link `..` to its parent directory inode. +- Symbolic link: different inodes. The "content" of the symlink is the name it points to.