LinuxQuestions.org
Review your favorite Linux distribution.
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
 
Search this Thread
Old 02-16-2004, 07:16 AM   #1
eshwar_ind
Member
 
Registered: Feb 2004
Location: Bangalore
Distribution: Redhat
Posts: 144

Rep: Reputation: 15
Linux kernel module programming(Signal and semaphore)


Hi!
I have a doubt regarding signals and semaphores.
When a process is executing in kernel mode it takes a semaphore1 and waiting for another semaphore2. It enters into pended state. At that instant another process sends a signal to it and terminates the process1.

What about the semaphore 1?
Is it reclaimed automatically? or Is it possible to terminate a process waiting for a kernel resource in kernel mode?
Please reply me.
Thanks
bye,
Eshwar
 
Old 02-16-2004, 01:10 PM   #2
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
remember that when u take a semaphore, you use one of these:
down(&sem);
down_interruptible(&sem);

the difference being that the 2nd can be interrupted by a signal. it returns 1 if interrupted, 0 otherwise. hence you always do this:
if(down_interruptible(&sem)){
//then we were interrupted by a signal, so let go of the first semaphore
up(&sem1);
return -ERESTARTSYS;
}

it is completely up to you to deal with all this.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Kernel Module Programming astronaut3000 Linux - Software 1 09-23-2005 03:02 AM
Linux kernel debugging and Linux kernel module programming Igor007 Programming 2 08-13-2005 06:12 AM
Linux kernel debugging and Linux kernel module programming Igor007 Linux - Enterprise 3 08-12-2005 03:47 PM
trying to send signal from linux module andreiij Programming 1 05-02-2005 01:46 PM
Signal processing programming in Linux naveenhifi Linux - Software 3 12-20-2003 05:31 AM


All times are GMT -5. The time now is 10:01 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