Re: Best Ref-counting algorithms?



Hans Aberg <haberg_20080406@xxxxxxxxxx> wrote:
(snip)

< Does this not suggest that at least a tracing GC should be moved into
< the OS? It should have some way to mark allocated swapped out memory
< unused without swapping back in.

I have watched Win2K do that. When you exit a program using a lot
of memory, it has to page it back while deallocating the memory.

< [Seems to me that it would be easy enough to provide system calls
< that allow <dequa tecontrol from user mode. VM/370 had a user
< interface to the pager in about 1970 to let an OS running in a
< virtual machine avoid double paging. <John]

I always thought of it more as a modification to the guest OS,
but I suppose it does require host support.

You can avoid double paging by giving the full 16M to the guest.
The problem, then, is that a multitasking guest has to wait while
any task is paging. As I understand it, control is returned
to the guest even though some pages are not yet available.
Other tasks can then be run if the needed pages are available.
[Yes, it presented virtual interrupts to the guest OS to say that
a page was unavailable, and later to say it had become available. It
was up to the guest to avoid touching unavailable pages. -John]


There is an interesting and maybe related feature of many current
systems. Many now do not actually allocate pages when requested, but
wait until the allocated memory is modified. All page table entries
for newly allocated memory point to a single page filled with zeros,
with the write protect bit active. Any write to the page allocates a
real page and updates the page tables as needed.

As I understand it, the problem with this method comes when the system
is actually short on memory, but there is no way to indicate that to
the program. I tried this one earlier, after reading a post in
another newsgroup related to pointers (but not to virtual storage).

#include <stdio.h>
#include <stdlib.h>
#define X 64
int main() {
int i;
while(malloc(X*1024*1024-8)) i++;
printf("%dM allocated\n",i*X);
}

You may find that it is given more virtual storage than available
swap space, and it might be that malloc() never returns (void*)0.

-- glen
[This is getting a bit farafield from compilers. Some years ago I spun
off a separate mailing list for GC discussions, which isn't very active
but has over 700 subscribers.

To subscribe: send a message containing subscribe to gclist-request@xxxxxxxxxxxxxxx
-John]

.



Relevant Pages

  • Re: MALLOC
    ... Paging isn' treally a good model, for the reason you point out. ... I/O would suffice (we use multimedia I/O calls, which work on structured files, and can ... >exceptions on access to uncommitted memory. ... >be to allocate pagefile space in 64 KB chunks, ...
    (microsoft.public.vc.mfc)
  • Re: Regarding the virtual machines.
    ... emulate memory (for example, it could implement its own paging* for ... often the memory available to the guest is indeed a subset of the ... VM and the guest I/O do paging, so usually for a guest running a ... IMHO PAE is the facitily provided by the ...
    (comp.programming)
  • Re: Regarding the virtual machines.
    ... I was just thinking that in case of vm, like Java VM, each java ... Any new dynamic memory request made by the application will be ... often the memory available to the guest is indeed a subset of the ... VM and the guest I/O do paging, so usually for a guest running a ...
    (comp.programming)
  • Re: Problems reclaiming VM cache = XFree86 startup annoyance
    ... :I'm not sure what is overloading the disk other than the large amounts ... :of paging that are initiated the moment I invoke "startx". ... :allocable memory), with the subtle distinction being that "Cache" ... :pages used to hold disk blocks now discarded, then why not allocate ...
    (freebsd-stable)
  • Re: [RFC PATCH v2] Utilize the PCI API in the TTM framework.
    ... and the GFP_DMA32 is memory from the ZONE_DMA32. ... So I was under the impression that when you allocate coherent memory ... in the guest, the physical page comes from DMA32 memory in the host. ... So the GART is in the PCI space in one of the BARs of the device right? ...
    (Linux-Kernel)