public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* question about running program from a RAM disk
@ 2002-02-28 19:51 Hua Zhong
  2002-02-28 22:12 ` Richard B. Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: Hua Zhong @ 2002-02-28 19:51 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hi all:

If I run a program from a RAM disk, will Linux be able to run it directly
from
the disk itself (as the image is already in memory), or do it the same way
as running from a disk?

Thanks.

Hua


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question about running program from a RAM disk
  2002-02-28 19:51 question about running program from a RAM disk Hua Zhong
@ 2002-02-28 22:12 ` Richard B. Johnson
  2002-02-28 22:24   ` Hua Zhong
  0 siblings, 1 reply; 6+ messages in thread
From: Richard B. Johnson @ 2002-02-28 22:12 UTC (permalink / raw)
  To: Hua Zhong; +Cc: Linux Kernel Mailing List

On Thu, 28 Feb 2002, Hua Zhong wrote:

> Hi all:
> 
> If I run a program from a RAM disk, will Linux be able to run it directly
> from
> the disk itself (as the image is already in memory), or do it the same way
> as running from a disk?
> 
> Thanks.
> 
> Hua

It does it the same was as from a mechanical disk. If it uses
dynamic linking, the default, the runtime libraries are
memory-mapped and shared. In a perfect system, a very large
program is not read into user's virtual address space all at
once. Page-faults bring in, or discard, pages as required.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).

        111,111,111 * 111,111,111 = 12,345,678,987,654,321


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question about running program from a RAM disk
  2002-02-28 22:12 ` Richard B. Johnson
@ 2002-02-28 22:24   ` Hua Zhong
  2002-02-28 22:55     ` Oliver Neukum
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Hua Zhong @ 2002-02-28 22:24 UTC (permalink / raw)
  To: root; +Cc: Linux Kernel Mailing List

In the final system we are going to turn off swap. I had dreamed that Linux
could directly use the page frame on the RAM disk instead of doing another
copy :-)

Thanks for the reply

Hua

----- Original Message -----
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: "Hua Zhong" <hzhong@cisco.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Sent: Thursday, February 28, 2002 2:12 PM
Subject: Re: question about running program from a RAM disk


> On Thu, 28 Feb 2002, Hua Zhong wrote:
>
> > Hi all:
> >
> > If I run a program from a RAM disk, will Linux be able to run it
directly
> > from
> > the disk itself (as the image is already in memory), or do it the same
way
> > as running from a disk?
> >
> > Thanks.
> >
> > Hua
>
> It does it the same was as from a mechanical disk. If it uses
> dynamic linking, the default, the runtime libraries are
> memory-mapped and shared. In a perfect system, a very large
> program is not read into user's virtual address space all at
> once. Page-faults bring in, or discard, pages as required.
>
> Cheers,
> Dick Johnson
>
> Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).
>
>         111,111,111 * 111,111,111 = 12,345,678,987,654,321
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question about running program from a RAM disk
  2002-02-28 22:24   ` Hua Zhong
@ 2002-02-28 22:55     ` Oliver Neukum
  2002-02-28 23:48     ` H. Peter Anvin
  2002-03-01  1:40     ` Scott Murray
  2 siblings, 0 replies; 6+ messages in thread
From: Oliver Neukum @ 2002-02-28 22:55 UTC (permalink / raw)
  To: Hua Zhong, root; +Cc: Linux Kernel Mailing List

On Thursday 28 February 2002 23:24, Hua Zhong wrote:
> In the final system we are going to turn off swap. I had dreamed that Linux
> could directly use the page frame on the RAM disk instead of doing another
> copy :-)
>
> Thanks for the reply

You could use ramfs, which does so for sure.
I am actually not sure about the ramdisk code.

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question about running program from a RAM disk
  2002-02-28 22:24   ` Hua Zhong
  2002-02-28 22:55     ` Oliver Neukum
@ 2002-02-28 23:48     ` H. Peter Anvin
  2002-03-01  1:40     ` Scott Murray
  2 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2002-02-28 23:48 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <01bc01c1c0a6$a3c315e0$bb3147ab@amer.cisco.com>
By author:    "Hua Zhong" <hzhong@cisco.com>
In newsgroup: linux.dev.kernel
>
> In the final system we are going to turn off swap. I had dreamed that Linux
> could directly use the page frame on the RAM disk instead of doing another
> copy :-)
> 

However, the reply you got was completely irrelevant; he didn't answer
your question at all (even though he probably thought.)

The answer to your question is that a ramdisk lives directly in the
block cache and does not have to be copied.

You may want to consider migrating to a ramfs or tmpfs, which lives
directly in the *page* cache and therefore reduces overhead further.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question about running program from a RAM disk
  2002-02-28 22:24   ` Hua Zhong
  2002-02-28 22:55     ` Oliver Neukum
  2002-02-28 23:48     ` H. Peter Anvin
@ 2002-03-01  1:40     ` Scott Murray
  2 siblings, 0 replies; 6+ messages in thread
From: Scott Murray @ 2002-03-01  1:40 UTC (permalink / raw)
  To: Hua Zhong; +Cc: Linux Kernel Mailing List

On Thu, 28 Feb 2002, Hua Zhong wrote:

> In the final system we are going to turn off swap. I had dreamed that Linux
> could directly use the page frame on the RAM disk instead of doing another
> copy :-)

Both ramfs and tmpfs do what you're asking for.  If you are booting
from an initial ramdisk, it's possible to copy the contents of your
ramdisk into a ramfs or tmpfs filesystem at boot time, change roots
with the pivot_root utility, and then throw away the ramdisk.  See
Documentation/initrd.txt for more information on this.

Scott


-- 
Scott Murray
SOMA Networks, Inc.
Toronto, Ontario
e-mail: scottm@somanetworks.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-03-01  1:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-28 19:51 question about running program from a RAM disk Hua Zhong
2002-02-28 22:12 ` Richard B. Johnson
2002-02-28 22:24   ` Hua Zhong
2002-02-28 22:55     ` Oliver Neukum
2002-02-28 23:48     ` H. Peter Anvin
2002-03-01  1:40     ` Scott Murray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox