From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,66b81258f3d96edb,start X-Google-Attributes: gidfee84,public From: pgh@fetch.unx.dec.com (Paul Henderson) Subject: Re: Do multiple processes running same program share memory? Date: 1996/02/16 Message-ID: <4g2gge$3r8@zk2nws.zko.dec.com>#1/1 X-Deja-AN: 140070579 references: <31223D7B.4C09@pweh.utc.com> organization: CTG newsgroups: comp.unix.osf.osf1 Pete Bradley (bradlepc@pweh.utc.com) wrote: : If I have multiple processes running the same program : on a single alpha running OSF (Er...Digital Unix ;-), : will the text of the program be shared in memory? : The program in question has 5 Mb of text and will be : running on a 4-CPU Sable. : Pete Bradley : Pratt & Whitney I asked our technical director who is a kernel whiz, and he said: Yes, the code sections and any shared library code sections will only physically exist once, all applications will map in those physical pages. For data sections, they are loaded "virgin" from the disk and as long as they haven't been modified, all applications share a "read only" copy of the pages, once an application tries to do something (like x++) a page fault occurs and a separate physical copy of the page is made for the process doing the write. This is typically done on a page-by-page basis. So, if you run a HUGE program with HUGE data multiple times you only take the hit for it once until each program starts writing its own data then it starts splitting off till there are two complete copies (still share the code segments).