public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeffrey Hundstad <jeffrey.hundstad@mnsu.edu>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: "Ravinandan Arakali (rarakali)" <rarakali@cisco.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Multiple instances of program sharing same text segment ?
Date: Tue, 20 Mar 2007 14:40:26 -0500	[thread overview]
Message-ID: <460038AA.4050506@mnsu.edu> (raw)
In-Reply-To: <460023F1.8060102@goop.org>

Keep in mind that while the text of the program IS SHARED any 
configuration file that is then loaded into ram after the execution IS 
NOT SHARED.

BTW you can find out what is shared and not by taking a look at the proc 
files:

# ps auxwww | grep emacs | grep -v grep # -- find the pids
user       21529  0.2  0.3  16784  7560 pts/11   S+   14:27   0:00 
xemacs -nw
user       21549  0.2  0.3  16784  7548 pts/12   S+   14:27   0:00 
xemacs -nw

# cat /proc/21529/maps |grep xemacs | grep "r-xp" # -- find the mapped 
text executable
08048000-081f5000 r-xp 00000000 08:02 201672393  
/usr/bin/xemacs-21.4.19-nomule

# cat /proc/21549/maps |grep xemacs | grep "r-xp" # -- find the mapped 
text executable
08048000-081f5000 r-xp 00000000 08:02 201672393  
/usr/bin/xemacs-21.4.19-nomule

#ls -li /usr/bin/xemacs-21.4.19-nomule # -- confirm that 201672393 is 
the inode we're looking at.
201672393 -rwxr-xr-x 1 root root 1800764 2006-11-03 11:11 
/usr/bin/xemacs-21.4.19-nomule


Jeremy Fitzhardinge wrote:
> Ravinandan Arakali (rarakali) wrote:
>   
>> I note that do_exec calls do_mmap to map the executable file to memory.
>> But not sure what happens(w.r.t text sharing) when another instance of 
>> the program is invoked. BTW, this is 2.6.10.
>>     
>
> Yes, they will be shared.  As far as the rest of the kernel is
> concerned, an mmap is an mmap is an mmap, and the pages will be shared.
>
>     J
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>   

      parent reply	other threads:[~2007-03-20 19:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-20 17:47 Multiple instances of program sharing same text segment ? Ravinandan Arakali (rarakali)
2007-03-20 18:12 ` Jeremy Fitzhardinge
2007-03-20 18:22   ` Ravinandan Arakali (rarakali)
2007-03-20 19:40   ` Jeffrey Hundstad [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=460038AA.4050506@mnsu.edu \
    --to=jeffrey.hundstad@mnsu.edu \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rarakali@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox