Assessment 1 Practice
Write the read_line function for this program. The function should populate buf with characters read from fd until receiving a newline, or until the end of the file. The string in buf should be a properly null-terminated C-string. View Answer a) For assignment 2, we saw that a directory is modeled the same as a file, except its contents are a list of unsorted directory entries. A fellow filesystem designer suggests storing the entries in sorted order. In 3 sentences or less for each, explain 1 benefit and 1 drawback in terms of performance of this change. View Answer A benefit is quicker lookup of an entry, as we can use binary search to search for an entry name rather than looping over each entry. A drawback is when we add or rename directory entries, we must potentially re-sort the elements, which is extra work as opposed to the unsorted version. b) We have seen that an inode stores only 8 block numbers, and if a file has more block numbers than this, we must use approaches such as s
Assessment 1 Practice CS110: Principle of Computer Systems, Winter 2022 Based on documents by Lisa Yan, Jerry Cain, Julie Zelenski, Nick Bowman, and others Assessment 1 Practice Question 1 (win20 Midterm 2b) Write the read_line function for this program. The function should populate buf with characters read from fd until receiving a newline, or until the end of the file. The string in buf should be a properly null-terminated C-string. int read_line(int fd, char *buf, int buf_len) { // reads up to and including a newline (or EOF) from fd // replaces newline with null terminator // only reads up
Explore this link on the map →related reading
- CS111 Assignment 1: Reading Unix V6 Filesystemsweb.stanford.edu
- CS111 Assignment 1: Reading Unix V6 Filesystemsweb.stanford.edu
- Buffer cache | CS 162 Project 3cs162.org
- Subdirectories | CS 162 Project 3cs162.org
- Dropboxdropbox.com
- Linux File System - GeeksforGeeksgeeksforgeeks.org
- abseil / Performance Hintsabseil.io
- Disks and Files - Database Systemscs186berkeley.net
- CS111 Section 2: Filesystem Crash Recovery and System Callsweb.stanford.edu
- Assessing Claude Mythos Preview’s cybersecurity capabilities \ Anthropicred.anthropic.com
- Build Your Own Databasenan.fyi
- Things UNIX can do atomically — Crowley Code!rcrowley.org