Operating Systems 2019F Lecture 10

From Soma-notes
Revision as of 15:02, 5 October 2019 by Soma (talk | contribs) (Created page with "==Video== Video from the lecture given on October 4, 2019 [https://homeostasis.scs.carleton.ca/~soma/os-2019f/lectures/comp3000-2019f-lec10-20191004.m4v is now available]. =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

downloadable version


3000copy-mmap.c

downloadable version