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

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.

Rakesh sorry for everything.
Actually your question was formulated like you are not doing nothing.
Best of lucks.