README (win32-mmap)

Last Update: Wed May 16 13:44:37 -0600 2007


This package provides a Ruby interface for memory mapped I/O on MS Windows.


Ruby 1.8.0 or later.
windows-pr, 0.5.5 or later.


Standard Installation

rake test (optional)
rake install

Gem Installation

ruby win32-mmap.gemspec
gem install win32-mmap-x.y.z.gem


   require 'win32/mmap'
   include Win32

   map1 = => "C:\\", :size => 1024) = 'hello' = 77

   map2 = => "C:\\")
   p # 'hello'
   p # 77

About Memory Mapped Files under Windows

Under Windows, code and data are both repesented by pages of memory backed by files on disk - code by executable image an data by system pagefile (swapfile). These are called memory mapped files. Memory mapped files can be used to provide a mechanism for shared memory between processes. Different processes are able to share data backed by the same swapfile, whether it's the system pagefile or a user-defined swapfile.

Windows has a tight security system that blockquotevents processes from directly sharing information among each other, but mapped memory files provide a mechanism that works with the Windows security system - by using a name that all processes use to open the swapfile.

A shared section of the swapfile is translated into pages of memory that are addressable by more than one process, Windows uses a system resource called a prototype page table entry (PPTE) to enable more than one process to address the same physical page of memory, thus multiple process can share the same data without violating the Windows system security.

In short, MMF's provide shared memory under Windows.

(This explanation was largely borrowed from Roger Lee's Win32::MMF Perl module.)

Future Plans

Suggestions welcome.




(C) 2003-2007 Daniel J. Berger, All Rights Reserved


This package is provided "as is" and without any exblockquotess or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.


Daniel J. Berger
Park Heesob