LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   want to write a kernel module which creates 10 processes to access common varaible (https://www.linuxquestions.org/questions/programming-9/want-to-write-a-kernel-module-which-creates-10-processes-to-access-common-varaible-672645/)

hrushi_kute 09-26-2008 11:15 PM

want to write a kernel module which creates 10 processes to access common varaible
 
i want to write a kernel module which will spawn 10 processes ,and all these processes will update a common variable. Use of semaphores or rather spinlocks is allowed.

jlliagre 09-27-2008 01:55 AM

Please do not expect LQ members to do your homework - you will learn much more by doing it yourself.

hrushi_kute 09-27-2008 05:53 AM

thanks....but I used Fork(),its givin an error (actually a warning: implicit declaration of function ‘fork’)....i used clone() its givin d same error....I want to use do_fork() but am not gettin what parameters to use in that.....or please suggest some other function.....

pixellany 09-27-2008 06:00 AM

Maybe tell us more about your course of study and why you need to do something like this. Also show examples of your code.

Have you ever written a kernel module?
What kind of development environment are you using?

hrushi_kute 09-27-2008 01:08 PM

@pixellany: i am pursuing bachelors degree in computer science . I need this in order to check the working of semaphores and spinlocks. I am using Ubuntu 7.10. Now can u suggest some way to solve this problem please. ......n also i had written kernel modules for linked list and character device driver and block device driver...

pixellany 09-27-2008 03:18 PM

I'm not the one that will be able to help....

This is a pretty specialized question but, if you will post a sample of your code, someone may be able to help you.

jlinkels 09-27-2008 07:23 PM

hrushi_kute, maybe the intention of this assignment is to learn you how to create multiple processes and still use shared memory. There are a few techniques for learning that.

Not only that, but those are very well documented and from the fundamentals of today's multitasking operating systems.

Since you keep asking the obvious, and apparently you did either not read the entire book, or stopped at the 'fork' chapter. I wonder once you graduated for this course how you will proceed in your professional life if you can't even put effort in finding out how to write multiple processes using shared memory.

Try to google with the keywords you gave us, and start to read.

jlinkels

jiml8 09-27-2008 07:35 PM

I don't think fork() is available in the kernel anyway. Not sure of that, but I don't think so.

edit: after googling for just a short while, I am sure that fork() isn't available in the kernel.


All times are GMT -5. The time now is 10:06 AM.