README (win32-mmap)

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

Description

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

Prerequisites

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

Installation

Standard Installation

rake test (optional)
rake install

Gem Installation

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

Synopsis

   
   require 'win32/mmap'
   include Win32

   map1 = MMap.new(:file => "C:\\test.map", :size => 1024)
   map1.foo = 'hello'
   map1.bar = 77
   map1.close

   map2 = MMap.new(:file => "C:\\test.map")
   p map2.foo # 'hello'
   p map2.bar # 77
   map2.close
   

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.

License

Ruby's

Copyright

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

Warranty

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.

Authors

Daniel J. Berger
Park Heesob

[Validate]