什麼是memory mapping ? 談 mmap
wiki : mmap
In computing, mmap is a POSIX-compliant Unix system call that maps files or devices into memory. It is a method of memory-mapped file I/O. It naturally implements demand paging, because initially file contents are not entirely read from disk and don't use physical RAM at all.
Linux允許將檔案對映到記憶體中。如此可以產生一個在檔案資料及記憶體資料一對一的對映。
其中新的記憶體可以透過利用/dev/zero來產生全零的檔案。而可把檔案當成記憶體,直接使用指標來操作。而mapped memory 透過shared file 做訊息的傳遞;而將 shared file mapping 到 process address space 的 system call 為叫做mmap()。
ps.
wiki : POSIX
wiki : demand paging
相關閱讀 :
小談 mmap() 與 VMA
記憶體對映mmap
In computing, mmap is a POSIX-compliant Unix system call that maps files or devices into memory. It is a method of memory-mapped file I/O. It naturally implements demand paging, because initially file contents are not entirely read from disk and don't use physical RAM at all.
Linux允許將檔案對映到記憶體中。如此可以產生一個在檔案資料及記憶體資料一對一的對映。
其中新的記憶體可以透過利用/dev/zero來產生全零的檔案。而可把檔案當成記憶體,直接使用指標來操作。而mapped memory 透過shared file 做訊息的傳遞;而將 shared file mapping 到 process address space 的 system call 為叫做mmap()。
ps.
wiki : POSIX
wiki : demand paging
相關閱讀 :
小談 mmap() 與 VMA
記憶體對映mmap
留言
張貼留言