Go Back   The UNIX and Linux Forums > Top Forums > Programming
.
google site



Programming Post questions about C, C++, Java, SQL, and other programming languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-14-2006
Rakesh Ranjan's Avatar
Registered User
 

Join Date: Aug 2005
Location: India
Posts: 42
Example for use of kernel semaphore

Hi friends I'm doing a project and in that I need to use kernel semaphore but I'm not very clear about how to use it. I've used system V semaphore.
What I find difficult to understand is that in system V semaphore, a semaphore set is registered to the system (the semid returned from semget call is unique and can identify the semaphore set) allowing synchronisation between processes as against this in kernel semaphore it seems to me only a instance of structure semaphore needs to be created and up() and down() called upon it for synchronisation. But how can an instance of structure declared in one program be known in other program.

May be I'm thinking wrong way plz. rectify me if so and plz. show me an example how to use kernel semaphore.
Thanks in advance

Last edited by Rakesh Ranjan; 03-16-2006 at 05:01 AM..
Sponsored Links
  #2 (permalink)  
Old 03-15-2006
Registered User
 

Join Date: Mar 2006
Posts: 7
Please first try it.

Please when you are asking questions first try.
1:Search from the inrternet
2:Read from the books
after all this if you can not do nothing then ask to help you.
If you even do not start to write your project how we can help you.
  #3 (permalink)  
Old 03-16-2006
Rakesh Ranjan's Avatar
Registered User
 

Join Date: Aug 2005
Location: India
Posts: 42
I'm elaborating

Quote:
Originally Posted by i.pas
Please when you are asking questions first try.
1:Search from the inrternet
2:Read from the books
after all this if you can not do nothing then ask to help you.
If you even do not start to write your project how we can help you.
Sorry i.pas because i didn't elaborate it might have given u impression that i hadn't put in enough effort. But I would like to make it clear that its not so i've gone through all possible sources where i could find help. My project is not all about semaphores but it deals with an extension of netfilter. I've coded and tested rest of modules that does not require synchronisation. Now since u desire I'll elaborate my question :
Say I have a kernel module that takes a specific routing decision based on the state of a variable and at the same time the state(value) of the variable can be asynchronously changed by another process. Now I've to make sure that the routing decision is not taken while the state is being changed (changing the state requires some communication from other systems on network and so routing decision can be taken while the state of the variable is being updated).
So for this synchronisation i need to use kernel semaphore as the processes will be running in kernel. Now just to make it direct I made a pin-pointed question that if this semaphore is a just an instance of struct semaphore whose scope is limited to the file it has been declared in how can that be used to synchronise two or more processes. This is different from what is done in sys V IPC where the semaphore has an id that it is unique over one system. And to give u an idea of my problem, i am running this application on P-II 233MHz system where it takes atleast 4-5 hrs compiling kernel (and which if ur suggestion is taken might end up in a fiasco). Add to it the fact that if my one mistake might lead my linux machine not to boot (after all u can't play with ur kernel) and end up the work that i've done thus far.
I hope that u understand the gravity of the problem now and cooperate.

I've also checked the database of forum and could not locate any similar post.
So plz. help if u can.

Last edited by Rakesh Ranjan; 03-16-2006 at 01:59 PM..
  #4 (permalink)  
Old 03-20-2006
Registered User
 

Join Date: Mar 2006
Posts: 7
Rakesh sorry for everything.
Actually your question was formulated like you are not doing nothing.
Best of lucks.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Semaphore Jaken Shell Programming and Scripting 2 04-04-2009 06:10 PM
max number of slabs per kernel module (kernel 2.6.17, suse) Brendan Kennedy SuSE 4 01-23-2008 09:40 AM
Kernel panic - not syncing: cannot execute a PAE-enabled kernel on PAE-less CPU dave043 Linux 2 05-10-2007 02:57 AM
Semaphore vjsony UNIX for Dummies Questions & Answers 3 04-07-2003 03:06 PM
semaphore yls177 UNIX for Dummies Questions & Answers 1 10-09-2002 12:18 AM



All times are GMT -4. The time now is 05:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0