LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 09-26-2008, 11:15 PM   #1
hrushi_kute
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Rep: Reputation: 0
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.
 
Old 09-27-2008, 01:55 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,459

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
Please do not expect LQ members to do your homework - you will learn much more by doing it yourself.
 
Old 09-27-2008, 05:53 AM   #3
hrushi_kute
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Original Poster
Rep: Reputation: 0
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.....
 
Old 09-27-2008, 06:00 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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?
 
Old 09-27-2008, 01:08 PM   #5
hrushi_kute
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Original Poster
Rep: Reputation: 0
@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...

Last edited by hrushi_kute; 09-27-2008 at 01:18 PM.
 
Old 09-27-2008, 03:18 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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.
 
Old 09-27-2008, 07:23 PM   #7
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 3,980

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
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

Last edited by jlinkels; 09-27-2008 at 07:24 PM.
 
Old 09-27-2008, 07:35 PM   #8
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 114Reputation: 114
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.

Last edited by jiml8; 09-27-2008 at 07:37 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
spamd creates too many child processes ACSAndy Linux - Software 1 03-16-2006 04:23 PM
A problem with threads creates 300+ zombie processes zahadumy Programming 1 11-27-2005 07:15 PM
After compiling my kernel, common user access denied. yilang *BSD 6 05-09-2005 08:29 PM
How to write a kernel module(kernel object, .ko) on linux-2.6.0? oskernel Linux - Software 2 10-18-2003 06:04 AM
postfix/spamassassin combo creates alot of processes. Pcghost Linux - Software 0 06-13-2003 04:07 PM


All times are GMT -5. The time now is 02:41 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration