Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!metro!cluster!necisa!boyd From: boyd@necisa.ho.necisa.oz.au (Boyd Roberts) Newsgroups: comp.unix.questions Subject: Re: sbrk(2) question Message-ID: <2038@necisa.ho.necisa.oz.au> Date: 11 Mar 91 00:50:41 GMT References: <1991Mar8.180132.12025@Think.COM> Organization: NEC Information Systems Australia Pty. Ltd. Lines: 21 In article <1991Mar8.180132.12025@Think.COM> barmar@think.com (Barry Margolin) writes: > >Assuming most implementations provide zero-filled memory, is this generally >done using some kind of optimization of all-zero memory pages, or does it >have to explicitly zero lots of memory and swap space pages (assuming you >give sbrk() a large value)? > On System V paging systems the right thing is done. The process' page tables are expanded and the corresponding DBDs (disk block descriptors) are marked to be demand-fill zero. The memory isn't allocated until a validity fault occurs on the first reference to the page. A page is attached to the pte, then it's zeroed, then the process continues. You'd hope that other paging systems would use the same scheme. It's simple and it makes sense. Boyd Roberts boyd@necisa.ho.necisa.oz.au ``When the going gets wierd, the weird turn pro...''