RE: Virtual Memory Question: Does the kernel ever switch to physical memory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2007-07-02 at 10:02 +0530, Rajat Jain wrote:
> Hi,
> 
> > Does the kernel ever switch to use the physical address?
> 
> No.
> 
> > Let me give an example (to make sure i understand things correctly)
> >
> > 1 - A process in the user space is running (in virtual memory)
> > 
> > 2- Process requests something  from kernel and issues an
> > interrupt (lets say that process wants to read from a file). 
> >
> > 3- The 'int' assembly instruction switches from the user space
> > to kernel space (switch from ring 5 to ring 0, and stack pointer
> > changes to point kernel stack)
> >
> > 4- The process is now running in the kernel space and still with
> > the SAME VIRTUAL MEMORY(?) as the caller process.
> > (not sure if this is correct) 
> 
> That is correct. The virtual address space is the same. BUT now the kernel is restricted to (directly) use only the virtual memory beyond 3GB (PAGE_OFFSET).
> 
> > 5- Now the kernel has to issue an I/O operation to make the hdd
> > copy the information to memory. 
> >
> > I have a question at this point. If everything i said is correct
> > and all. How does the kernel get the information from hdd controller
> > and move it to user space? 
> > Does it switch to physcal memory? Does it find a page which is empty,
> > pass address of that page to hdd controller, and mark that page in
> > the VM table of current process?
> 
> The kernel does not use physical addresses at point. The closest it gets to that is using bus addresses for DMA. The kernel simply allocates a buffer and inserts a request into the request queue of the device. The block device driver then gets the data from device (may use DMA) and thus buffer is returned.
> 
> Thanks,
> 
> Rajat
> 
> PS: Please use plain text instead of HTML mail.

Thank you so much for the information Rajat. 
It helped me alot. 
Sincerely yours. 



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux