1 / 6

Assignment 4

Assignment 4. Introduction. Typically when we think of analyzing file data we consider the use of system calls e.g ., open() , read() , write() Each file access requires a system call and disk access We can use virtual memory techniques to treat file I/O as routine memory accesses

nolcha
Download Presentation

Assignment 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Assignment 4

  2. Introduction • Typically when we think of analyzing file data we consider the use of system calls e.g ., open(), read(), write() • Each file access requires a system call and disk access • We can use virtual memory techniques to treat file I/O as routine memory accesses • This is known as memory mapping a file

  3. Basic Mechanism • Memory mapping a file I accomplished by mapping a disk block to a page (or pages) in memory. • Initial access to the file proceeds through ordinary demand paging • However, a page-sized portion of the file is read from the file system into a physical page

  4. Basic Mechanism • Subsequent reads and writes to the file are handled as routine memory accesses • Allows system to manipulate files through memory rather than incurring the overhead of of using the read() and write() system calls • Recall that the system calls involve disk I/O

  5. Basic Mechanism • Writing to a file in mapped to main memory? What happens to file? • Could be immediate but high overhead • The OS periodically checks whether the page in memory has been modified • When the file is closed, all the memory mapped data are written back to disk and removed from the virtual memory of that process

  6. mmap() System Call void * mmap (void *addr, size_tlen, intprot , int flags, intfd, off_t offset); Consult the following URL for more info: http://beej.us/guide/bgipc/output/html/multipage/mmap.html

More Related