Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Now addr is the virtual address.
I need to know where it is located in the RAM(ie., physical address).
How can i know the physical address of this addr?.
I guess you either didn't read my reply or didn't believe me, so please see here: http://www.makelinux.net/ldd3/chp-8-sect-4 "When a driver needs a real physical address (such as a DMA address, used by peripheral hardware to drive the system's bus), you can't easily use vmalloc."
Indeed ... please read that manual section carefully!
Now consider, "why is it so?" The answer, of course, is that this function allocates virtual memory. This is a chunk of memory as perceived by the user-land process. It will now exist in the process's address space and be accessible to that process at thus-and-so virtual address (since by definition every address perceived by a userland program is a virtual address).
What does that mean to the kernel? As always, it means that the area is physically divided into pages ... and any of those pages may or may not at any point in time actually be resident in RAM. Actually, it might not yet exist, since physical pages (and swap space) are allocated only on-demand. (The area appears as zeroes until the process, or you, actually write to it.)
Kernel code has the prerogative to use either virtual or physical addresses, and in the case of kernel threads they can even tolerate page faults. But you must very clearly understand at all times what is going on. "With great power comes great responsibility."