Date: | November 8, 2005 / year-entry #340 |
Tags: | history |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20051108-05/?p=33423 |
Comments: | 10 |
Summary: | John Elliott wondered why the GlobalWire function was called GlobalWire. First, some background for those who never had to write 16-bit Windows programs. The GlobalWire function was similar to the 16-bit GlobalLock function, except that it had the bonus feature of relocating the memory to the lowest available linear address. You used this function as... |
John Elliott wondered why the First, some background for those who never had to write 16-bit Windows programs. The But why "wire"? This employs a colloquial sense of the word "wire" as a verb which has lost its currency in the intervening years. To wire means to fasten securely in a very strong sense. It probably derives from the phrase "hard-wired", which means "permanently attached in circuitry". Therefore, "wiring" memory into place ensures that it doesn't move around. |
Comments (10)
Comments are closed. |
I believe that in modern VM parlance this would be called "pinning". One "pins" memory to prevent it from being paged out or GC’d.
"But why "wire"?"
In applications where a nut-and-bolt fastening system must not vibrate loose, the nut used is a "castlelated" nut, the bolt has a hole through it. After tightening the nut, a "safety-wire" is run through the hole, and twisted into place. There are special "safety-wire" pliers, which make the twisting of the wire very quick.
Thoughts of old core memory leap to mind…
"GlobalWire"??? – Sounds more like a financial transaction!
Is this a prime example of why APIs should be vetted for colloquialisms?
Are there any win32 functions that have esoteric names?
Wow. That was almost same-year service :-)
Gabe: I don’t think this is quite the same as pinning, because that would be done with GlobalLock. Or maybe GlobalFix. Oddly enough, there isn’t a GlobalPin or GlobalGlue or GlobalWeld…
I like PrestoChangoSelector() more.
A function with the same intent as GlobalWire might still be useful.
Suppose your program is used for number crunching on potentially very large matrices. You might need to grab several BIG chunks of memory from the allocator.
If you could ensure that your program’s modules (application, DLLs, etc.) hugged the fringes of virtual memory address space, that would leave lots of free empty room in the middle.
Wide open stretches of contiguous unallocated memory could mean the difference between success and failure when you call malloc(REALLY_BIG_NUMBER).
Daev> The system DLLs are already mapped at the top end of the lower 2GB of the address space. As for your own allocs, VirtualAlloc() lets you specify the virtual address in the address space, so if you know you’re going to have large allocs, you can do them in the middle of the 2GB range.
Or, you can use the techniques that Raymond posted about a while ago (in the series about misconceptions regarding memory and address space) if you need to manually swap data in/out of your address space.
GlobalWire and PrestoChangoSelector are still more meaningful than the BurgerMaster segment!
"GlobalWire and PrestoChangoSelector are still more meaningful than the BurgerMaster segment! "
Not if you’re hungry after working long hours on the memory manager. :-)