Re: question about ramdisk

Richard B. Johnson
2004-07-14T16:57:54Z

On Wed, 14 Jul 2004 lya755@ece.northwestern.edu wrote:

> Thanks so much for the hint! Really appreciate it. I'll try out your
> suggestions.
>
> I am still a bit confused, though. If the code is in ramdisk, then it will be
> mapped to the process address space, which as I understand, does not involve
> any actual data copy and transfer. This sounds very reasonable. But what if
> the code is in hard disk? Would the kernel copy it to memory (somewhere
> allocated) then map this region as the text section for the address space, and
> then run the instructions from ram? That's the way I understand it, but I
> don't know whether that is correct.
>
> Thanks!
> Lei

The instructions are always executed from RAM even if the executable
file is on a physical disk. The file is memory-mapped. Execute
`man mmap`. One of the parameters is MAP_FILE. The whole file
is mapped, however, only that which is necessary at a particular
time is actually read from the disk, one page at a time.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.