TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Simeon Cran
from: Mike Bilow
date: 1995-11-12 17:37:00
subject: Can memory have 2 addresses at the

Simeon Cran wrote in a message to all:

SC> This may seem like a strange thing to try and do, but I
SC> notice that Linux is able to have the same memory object
SC> allocated to two or more addresses within the one process.

SC> Under Linux you do a shared memory get, to get a handle to
SC> the memory, then a shared memory attach, to attach an
SC> address to the handle. You can then attach more addresses to
SC> the handle and address the memory at a number of different
SC> addresses.

SC> Is OS/2 capable of the same feat?

Not quite.  OS/2 uses virtual addresses for shared memory, allocating Ring
3 selectors in the GDT.  This is much faster than the Linux approach, and
the virtual address for shared memory will be the same for all processes.
Applications have no control over the actual virtual addresses mapped to
blocks, and these addresses must be treated as "magic cookies." 
Shared memory in OS/2 is allocated "top-down" from the 512 MB
boundary between Ring 3 and Ring 0 accessible areas.

By adding the layer of indirection, Linux takes a performance penalty. 
What you are actually doing when you perform an attach is creating an LDT
mapping for the shared memory area.  Linux must maintain reference counters
and go through a fairly complex procedure to implement LRU swapping, while
OS/2 does this directly in hardware.  Linux gains portability and
generality from this approach, however.  Linux can run on many processors
where there is no notion comparable to that of the Intel 386 memory
architecture, but where memory must be managed by privilege level.

That said, it is entirely possible for a device driver to implement
free-for-all mapping in OS/2.  Device drivers can create and destroy
selectors, modify privilege levels, and even map the same memory to
multiple virtual addresses. If these is some reason to do these things,
then OS/2 does allow device drivers
-- but not applications -- to do them.

-- Mike


---
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 517 628 713/888 800/1 7877/2809
@PATH: 323/107 150 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.