From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,e86c7ee8800beb5b X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1994-12-19 13:51:50 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uwm.edu!lll-winken.llnl.gov!decwrl!pa.dec.com!nntpd2.cxo.dec.com!nabeth.cxo.dec.com!alan From: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Newsgroups: comp.sys.dec Subject: Re: Alpha OSF/1 : swap space problems Date: 19 Dec 1994 21:48:54 GMT Organization: Digital Equipment Corporation Distribution: world Message-ID: <3d4v46$8as@nntpd2.cxo.dec.com> References: <1994Dec19.134407.22556@hrbicf> Reply-To: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) NNTP-Posting-Host: nabeth.cxo.dec.com In article <1994Dec19.134407.22556@hrbicf>, m1w@icf.hrb.com (Michael E. Warren) writes: > >For an Alpha running OSF/1: > >Can someone explain how swap space and memory is allocated/deallocated? I've >got a system of processes, all fairly memory and cpu intensive. They seem to >work fine for several minutes after startup and then the operating system >starts killing them off for lack of swap space. I've checked for memory leaks >by hand but don't see any. Are there any free tools out that would help find >them, if they exist? Any other ideas about what could be wrong? There are two schemes for page/swap space allocation. Call them eager and lazy. Using eager space allocation, the virtual code reserves page/swap space for a process whenever its virtual memory requirements expand. This ensures that if a process does need to page or swap that the space is available to it. Assignment of space to the pages needing to it, is delayed until they are paged out the first time. The disadvantage of this method is that the system's virtual memory is limited the amount of page/swap space available. With the lazy scheme, no reservation is made and when a process needs to be swapped or have some of its pages written out, the space is allocated. If there isn't enough space, then the kernel starts selecting processes to be killed to make space. It prefers "idle" processes, but in exteme conditions, anything but the process itself will look "idle". The advantage of this scheme is that limit on virtual memory for the system is the sum of physical memory and the page/swap space rather than just the page/swap space. If you can accurately predict the virtual memory needs of a process load and ensure that limit won't be exceeded, it lets you size the balance between page space and physical memory reasonably. The disadvantage is the one you've seen. If your virtual memory requirements exceed the system's capacity, then processes will die. It sounds like you have one of those "extreme" conditions where everything starts to look idle. In V1.2 and V1.3 a doubling scheme was used for virtual memory allocation. A process would start out at some reasonably small value and when more virutal memory was needed the previous size would be doubled. So, if a process started out needing 1 MB and then needed more, 2 MB would be allocated. If more was needed again, it would use 4 MB. Berkeley used a similar scheme, but it had an upper bound where it wouldn't double anymore. I'm not sure OSF/1 had the upper bound. I also don't know if the initial allocation of virtual memory used the same scheme. If so, processes using large amounts of virtual memory could be trying allocate obscene amounts of virtual memory. This misfeature was fixed in V2.0. In V1.2 actual space allocations wouldn't be interleaved among multiple devices, but this was fixed in V1.3. As with most UNIX systems, malloc/free manage space for the calling process and free merely makes the space available to malloc and not the system. A program that has a high short term dynamic memory need will use up a bunch of space that it may not need in normal use, but can't give back. > >Mike Warren >HRB Systems >State College, PA > > -- Alan Rollow alan@nabeth.cxo.dec.com