Re: question about ramdisk

From: Richard B. Johnson
Date: Wed Jul 14 2004 - 12:00:12 EST


On Wed, 14 Jul 2004 lya755@xxxxxxxxxxxxxxxxxxxx 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.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/