diff --git a/chapters/io/file-descriptors/drills/tasks/buffering/README.md b/chapters/io/file-descriptors/drills/tasks/buffering/README.md index bd3bd62247..026e8c3153 100644 --- a/chapters/io/file-descriptors/drills/tasks/buffering/README.md +++ b/chapters/io/file-descriptors/drills/tasks/buffering/README.md @@ -21,6 +21,9 @@ We'll checkout how effective buffering is in `libc` and then we'll do it ourselv Wrote 1048576 bytes to test-file.txt in 38 ms ``` + If possible, try to manually test your implementation. + Use `./checker.sh` only when you are sure of your result. + Buffering achieves dramatic performance gains, reducing read times by **98%** and write times by **99.8%** in this example! This demonstrates the power of buffering, even though it’s an extreme case. diff --git a/chapters/io/file-descriptors/drills/tasks/mmap_cp/README.md b/chapters/io/file-descriptors/drills/tasks/mmap_cp/README.md index 64a22fd61d..1610e87c9a 100644 --- a/chapters/io/file-descriptors/drills/tasks/mmap_cp/README.md +++ b/chapters/io/file-descriptors/drills/tasks/mmap_cp/README.md @@ -1,6 +1,8 @@ # Copy a File with `mmap()` -Navigate to `file-descriptors/drills/tasks/mmap_cp` and run `make` to generate `support`. +Enter the `mmap_cp/` directory in the lab archive (or `chapters/io/file-descriptors/drills/tasks/mmap_cp` if you are working directly in +the repository), run `make skels`, then enter `support/`. +Run through the practice items below. As you know `mmap()` can map files in memory, perform operations on them, and then write them back to the disk. Let's check how well it performs by comparing it to the `cp` command. The benchmarking is automated by `benchmark_cp.sh` so focus on completing `mmap_cp.c` for now. @@ -16,6 +18,11 @@ make: Nothing to be done for 'all'. Test PASSED (File copies are identical) ``` +To test your implementation, navigate to the `mmap_cp/support/src` folder. +Run `make` to compile the code and test it manually with files generated by you. + +When you think your code is correct, go to `mmap_cp/support/test` and run `checker.sh` to validate your solution. + 1. Open `mmap_cp.c` and complete the TODOs to map the files in memory and copy the contents. Do not forget to clean up by unmapping and closing the files. diff --git a/chapters/io/file-descriptors/drills/tasks/my-cat/README.md b/chapters/io/file-descriptors/drills/tasks/my-cat/README.md index a7927c7210..359426b2b4 100644 --- a/chapters/io/file-descriptors/drills/tasks/my-cat/README.md +++ b/chapters/io/file-descriptors/drills/tasks/my-cat/README.md @@ -1,6 +1,8 @@ # My `cat` -Navigate to `chapters/io/file-descriptors/drills/tasks/my-cat/support/src` and checkout `my_cat.c`. +Enter the `my_cat/` directory in the lab archive (or `chapters/io/file-descriptors/drills/tasks/my_cat` if you are working directly in +the repository), run `make skels`, then enter `support/`. +Run through the practice items below. We propose to implement the Linux command `cat` that reads one or more files, **concatenates** them (hence the name `cat`), and prints them to standard output. 1. Inside the `tests/` directory, you will need to run `checker.sh`. The output for a successful implementation should look like this: @@ -18,6 +20,11 @@ Good job! ---------------------------------------- ``` +To test your implementation, navigate to the `mmap_cp/support/src` folder. +Run `make` to compile the code and test it manually with files generated by you. + +When you think your code is correct, go to `mmap_cp/support/test` and run `checker.sh` to validate your solution. + 1. Implement `rread()` wrapper over `read()`. `read()` system call does not guarantee that it will read the requested number of bytes in a single call. diff --git a/chapters/io/ipc/drills/tasks/anon-pipes/README.md b/chapters/io/ipc/drills/tasks/anon-pipes/README.md index 3bbb762b00..167c6f08b9 100644 --- a/chapters/io/ipc/drills/tasks/anon-pipes/README.md +++ b/chapters/io/ipc/drills/tasks/anon-pipes/README.md @@ -1,6 +1,8 @@ # Anonymous Pipes Communication -Navigate to `chapters/io/ipc/drills/tasks/anon-pipes` and run `make` to generate the `support/` folder. +Enter the `anon_pipes/` directory in the lab archive (or `chapters/io/ipc/drills/tasks/anon-pipes` if you are working directly in +the repository), run `make skels`, then enter `support/`. +Run through the practice items below. In this exercise, you'll implement client-server communication between a parent and a child process using an anonymous pipe. The parent will act as the sender, while the child acts as the receiver, with both processes sharing messages through the pipe. Since pipes are unidirectional, each process should close the end of the pipe it does not use. @@ -15,6 +17,11 @@ Test for short string ........... PASSED Test for long string ........... PASSED ``` +To test your implementation, navigate to the `mmap_cp/support/src` folder. +Run `make` to compile the code and test it manually with files generated by you. + +When you think your code is correct, go to `mmap_cp/support/test` and run `checker.sh` to validate your solution. + 1. Use the [`pipe()` syscall](https://man7.org/linux/man-pages/man7/pipe.7.html) to create the pipe. Remember, the first file descriptor (`fds[0]`) is the read end, and the second (`fds[1]`) is the write end, similar to how `stdin` and `stdout` are represented by file descriptors `0` and `1`. diff --git a/chapters/io/overview/reading/lab9.md b/chapters/io/overview/reading/lab9.md new file mode 100644 index 0000000000..2cb050b78b --- /dev/null +++ b/chapters/io/overview/reading/lab9.md @@ -0,0 +1 @@ +The contents of the lab are located in the [lab archive](https://github.com/cs-pub-ro/operating-systems/raw/refs/heads/lab-archives/Lab_9_File_Descriptors.zip) and in the [GitHub repository](https://github.com/cs-pub-ro/operating-systems). diff --git a/config.yaml b/config.yaml index 289396106b..f0e8ff003b 100644 --- a/config.yaml +++ b/config.yaml @@ -126,6 +126,7 @@ lab_structure: - title: Lab 9 - File Descriptors filename: lab9.md content: + - reading/lab9.md - tasks/my-cat.md - tasks/mmap_cp.md - tasks/anon-pipes.md