LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   linux kernel questions need help (https://www.linuxquestions.org/questions/linux-kernel-70/linux-kernel-questions-need-help-824906/)

nakul.k1 08-08-2010 07:20 AM

linux kernel questions need help
 
Hi guys
It would be of great help if i get some answers for my questions bellow.

1) I wanted to know can kernel space access user space pointers ,variable
and functions just by including the user space header files yes or no ?
if no then what happen when kernel tries to access user space pointer.

2) kmalloc(1024,GFP_USER);
where does the above kmalloc function allocate memory is it kernel space
or in user space.

3) How is semaphore used in Inter process communication?

4) How is device power management handled in linux ?
i mean i need the complete process in the form of code and document
for any simple device.
a) starting from registering the device driver into the kernel module
b) power consumed by the module during run time idle time etc and who
decide the power consumed by the device must be 'x' volts during
normal operation and 'x-y' volts during idle mode and 0 volts
during sleep mode in which case the state of the device is saved
and restored back when the device is woken up.

Meson 08-08-2010 08:01 AM

Sounds like a homework question.

bsat 08-09-2010 03:35 AM

Hi,

It would be great help for us if you atleast try to use google once before posting the questions.
You can refer the follwoing
http://oreilly.com/catalog/linuxdrive3/book/index.csp

Understanding Linux Kernel.

Aquarius_Girl 08-09-2010 03:52 AM

Quote:

Originally Posted by nakul.k1 (Post 4059723)
1) I wanted to know can kernel space access user space pointers ,variable
and functions just by including the user space header files yes or no ?
if no then what happen when kernel tries to access user space pointer.

2) kmalloc(1024,GFP_USER);
where does the above kmalloc function allocate memory is it kernel space
or in user space.

See if the below link helps you somehow:
http://www.makelinux.net/ldd3/chp-8-sect-1.shtml
and
http://people.ee.ethz.ch/~arkeller/l...ace_howto.html

Aquarius_Girl 08-09-2010 04:00 AM

Quote:

Originally Posted by nakul.k1 (Post 4059723)
3) How is semaphore used in Inter process communication?

4) How is device power management handled in linux ?
i mean i need the complete process in the form of code and document
for any simple device.
a) starting from registering the device driver into the kernel module
...

These questions can be answered by Google.
Put in the following keywords in Google search bar and hit enter:
Quote:

linux semaphore ipc
Quote:

device power management linux
http://tldp.org/LDP/khg/HyperNews/ge...s/devices.html

One more advice:
Quote:

Always search Google before asking any question. And in your opening post always mention whatever you have tried till now to solve your problem.
Simply marking the post as not helpful and moving ahead is not going to help you anyway.

nakul.k1 08-09-2010 05:23 AM

Hi Anisha and bsat

thanks for the reply

Before posting these questions i google to find the solutions but was unable to catch up
my questions are quite simple
atleast for these 2 questions i am expecting to get some straight forward answer in one or two lines

-------------------------------------------------------------------------------
1) I wanted to know can kernel space access user space pointers ,variable
and functions just by including the user space header files yes or no ?
if no then what happen when kernel tries to access user space pointer.

2) kmalloc(1024,GFP_USER);
where does the above kmalloc function allocate memory is it kernel space
or in user space?

(doubt)i know the answer for the above question is
(solution as seen in google)--Used to allocate memory for user-space pages

now the doubt is where is this memory allocated in user space or in kernel space and for which process is this memory allocated user space process or kernel space process.
i ask this question because user space process allocates memory with call to malloc
and kernel space process allocates memory with call to kmalloc(size,GFP_KERNEL).

-------------------------------------------------------------------------------

Aquarius_Girl 08-09-2010 05:41 AM

Quote:

Originally Posted by nakul.k1 (Post 4060546)
1) I wanted to know can kernel space access user space pointers ,variable
and functions just by including the user space header files yes or no ?
if no then what happen when kernel tries to access user space pointer.

I think yes,
The below link shows function access_ok, read its description.
http://www.gnugeneration.com/mirrors...api/x3936.html

and all I tried to get that link was to search in Google your keywords:
Quote:

kernel tries to access user space pointer
You could have done that too !!!!

nakul.k1 08-09-2010 09:35 AM

Once again thanks for your time anisha it was of great help


¬Nakul

Aquarius_Girl 08-09-2010 10:38 AM

I am glad I could help you here :)


All times are GMT -5. The time now is 07:35 PM.