Operating Systems 2019F Lecture 10
Video
Video from the lecture given on October 4, 2019 is now available.
Notes
Code
Note: The code below is not the same code that was shown in lecture. Both have been improved with better error handling, and the mmap version now works. The key problems that had to be fixed were:
- If you do a writable mmap, the mmap has to be read/write and the file must be opened read/write.
- You can mmap a region larger than the underlying file; but if you do so, you'll get bus errors when you access the part of memory that has no corresponding part of the file. The solution is to seek out to the length you want minus one and then write one byte - the file will then have the length you want.
3000copy-rw.c