Agenda

<aside> 📌 Reminders

🗺Mapping Files to Memory

Usually, we use system calls like read and write to interact with files on disk

Memory mapping gives us another way to interface with files; by mapping them directly to memory, we can interact with them using memory operations.

This has the advantage of reducing the amount of IO that is expected from the system, as we know, this is typically the most expensive part of most programs.

On the other hand, changes to the file are not immediately reflected, which can lead to unexpected outcomes, especially when multiple processes/threads map or modify the same file

🔸In pintOS

Memory mapping in pintOS is accomplished through the mmap and munmap system calls:

mapid_t mmap(int fd, void *addr)
void munmap (mapid_t mapping)

Some notes about mmap