class: title # Filesystem Implementation ## CSC 213 – October 2, 2026 --- # Agenda for Today 1. Department Events 1. Upcoming Work 1. Filesystem Implementation 1. Wrap Up --- # Department Events ## Flu and COVID Shot Clinic .indent[ October 1st and 2nd from 9am–4pm in the Harris Center ] ## CS Table: Google Zero .indent[ Tuesday, October 6th at noon in the CS Commons ] ## Washington University Dual Degree Presentation *(no tokens)* .indent[ Tuesday, October 6th at 7pm in Noyce 1023 Learn about the WashU 3–3 Engineering program and their MS programs. ] ## CS Welcome Session *(tokens for non-majors only)* .indent[ Thursday, October 8th at 4pm in Noyce 3821 ] *To receive a token, send an email to let me know you attended no more than 48 hours after the event.* --- class: section, blue # Upcoming Work --- # Resubmissions If you didn't receive full credit on a lab, you can use a token to resubmit it. ## How Resubmissions Work 1. Talk with your original lab partner about your plans for a resubmission. If your partner is not planning to resubmit, you can resubmit on your own. 2. Email me with a request to resubmit the lab. Include your partner on the email if they are participating in the resubmission. 3. I will enter an extension on Gradescope so you can submit any time during the next week. 4. Upload your submission before the new, extended deadline. If you want more time, just send a follow-up email to request additional time (no token required). -- There is a limit of one resubmission per student each week, so don't leave a large number of resubmissions for the end of the semester. --- # Assignment Grading Update I want assignments to be an opportunity for you to practice skills before we apply them in other class work. The current syllabus structure for assignments is too harsh, so I am going to change it. -- ## New Assignment Grading Scale - **1 point:** Your assignment submission met all requirements and had no serious issues. - **½ point:** You submitted an assignment that shows that you made a serious effort to complete the assignment. The submitted work may not meet all requirements, or could have other serious issues. - **0 points:** You did not attempt the assignment, or the submitted work does not demonstrate a serious effort to complete the assignment. -- Graders will still give detailed feedback about assignment issues, but I will update the rubric so it also clearly conveys your actual grade on the assignment. --- # Assignment: Listing Directories **Due:** Wednesday, October 7th by 11:59pm **Late Deadline:** Friday, October 9th by 10:00am ## Questions _No new questions since last class._ --- # Lab: Malloc **Due:** Wednesday, October 7th by 11:59pm **Late Deadline:** Monday, October 12th by 11:59pm ## Questions **Why does my allocator make programs crash on startup?** Almost all programs make one very large allocation during startup. You'll need to handle requests for more than 2048 bytes before you can run test programs, even inside gdb. **What should we do to debug if the allocator makes programs crash during startup?** Your best bet is to add logging. It helps to know what sizes are being requested, what your allocator is doing, and the resulting pointer that you return. You can use `snprintf` and `log_message` to do this safely: ```c char buffer[256]; snprintf(buffer, 256, "xxmalloc(%d) called\n", size); log_message(buffer); ``` --- class: section, blue # Filesystem Implementation --- class: section, gray # Whiteboard: Elements of a Filesystem --- # A Simple Filesystem .left-col[ ## Disk Parameters 256 blocks, each 4KB 1 byte disk addresses ## inodes 56 bytes of metadata 8 direct block pointers ## Disk Layout 1 superblock 1 block for inode bitmap 1 block for data block bitmap 4 blocks for inode entries ] .right-col[ ## Questions 1. What is the total size of the disk? 2. How many inode entries or data blocks can be tracked with a single bitmap block? 3. What is the size of an inode entry? 4. How many inodes does this filesystem support? 5. How many data blocks does this filesystem have? 6. What is the largest supported file size? ] --- # A (Slightly) Better Simple Filesystem .left-col[ ## Disk Parameters 256 blocks, each 4KB 1 byte disk addresses ## inodes 56 bytes of metadata ***7 direct block pointers*** ***1 indirect block pointer*** ## Disk Layout 1 superblock 1 block for inode bitmap 1 block for data block bitmap 4 blocks for inode entries ] .right-col[ ## Questions This is almost the same as the filesytem from before, but now each inode entry contains an indirect block pointer. **What is the effect of this change?** Describe the effect, and calculate any new limits for the updated filesystem. ] --- # Discussion: Creating a File **Questions for think, pair, share:** 1. What steps are required to create and write to a new file in the simple filesystem we just discussed? 2. What order will those steps run in? *Start by thinking of answers on your own. I will let you know when to start discussion.* --- # Discussion: Crash Consequences Our list of disk operations included five different writes to the disk. A crash could mean that any one of those writes is lost. ## For Each Write Operation: 1. What happens to the filesystem if the write is lost? 2. Is there anything we could do to restore the filesystem to a safe state? *Start by thinking of answers on your own. I will let you know when to start discussion.* --- # Discussion: Journaling **Questions for think, pair, share:** 1. What is journaling? 2. What problems can journaling prevent or repair? 3. What is *metadata* journaling? Why would we use it instead of full journaling? *Start by thinking of answers on your own. I will let you know when to start discussion.* --- class: section, blue # Wrap Up --- # Reminders ## Upcoming Deadlines - **Malloc Lab:** due next Wednesday, or the following Monday with a token - **Listing Directories Assignment:** due next Wednesday, or Friday morning with a token ## Need help? Use your resources! - Book an appointment during office hours - Attend mentor office hours - Review slides, readings, and other course resources - Use tools like `gdb` and AddressSanitizer to catch and diagnose issues ## Reading - **Scheduling** (OSTEP, Chapter 7)