sbrk(2) question

Boyd Roberts boyd at necisa.ho.necisa.oz.au
Mon Mar 11 10:50:41 AEST 1991


In article <1991Mar8.180132.12025 at Think.COM> barmar at 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 at necisa.ho.necisa.oz.au

``When the going gets wierd, the weird turn pro...''



More information about the Comp.unix.questions mailing list