does sending a signal cause task switching


 
Thread Tools Search this Thread
Operating Systems Linux does sending a signal cause task switching
# 1  
Old 05-01-2009
does sending a signal cause task switching

Hi all,

i am porting a system, that used to manipulate memory across processes using an interrupt handler - which means that upon return from the interrupt handler the memory change would be finished. I am trying to simulate this using signals on Linux 2.6.2x.

What i would like to know is wether sending a signal (ex. kill( pid , SIGUSR1 ) ) from a process will cause the kernel to perform taskswitching and put the calling process in queue, allowing the signal handler to run if it is ready?


A simplified scenario:
We have a shared memory area attached to both processes "share".

Process1:
...
share->variable = 0;
kill( Process2_pid , SIGUSR1 )
printf("share->variable= %d\n",share->variable);
...

Process2:
SIGUSR1_handler()
{
share->variable = 1;
}

It seems that the printf allways prints a "1" . Which would mean that taskswitching occurs, and that the handler in process2 has finished when process1 returns from kill().

But is this something one can rely on Running Linux 2.6.2x ?


Regards
Paul
# 2  
Old 05-01-2009
I do not think you cannot depend on process 1 to wait for process 2. The signal is asynchronous. Your results are dependent on an assumed timing that the signal will be received and processed before the sending process executes the next line.

To be atomic, you need to use a semaphore, for example.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Switching over to C++

Hi, We've been using a perl script to extract datas from several logs to generate a report. I've been asked to rewrite the code in C++. I want to know if it is wise to have a code in C++ and will it be more faster than Perl? (23 Replies)
Discussion started by: Ribosome
23 Replies

2. UNIX for Dummies Questions & Answers

Help with switching the users

Hello. I am using a instance of Centos 5.5, I currently have two users root and zetaris, but when I try to switch the user from root su zetaris or su - zetaris the next command line shows bash-3.2$ and stops there. Further there is no response from instance. Please help me with this problem. I... (3 Replies)
Discussion started by: nnani
3 Replies

3. Solaris

The switching in the different AP's

HI, I am using the windows 2003 server R2 in there we are using the putty as to access the different AP's now from the primary AP i want to login to several different AP's using a script what the script will do is :- input a text file in which list of different ap's and the corresponding... (0 Replies)
Discussion started by: amiglani
0 Replies

4. OS X (Apple)

vt switching

greetings, i hope this hasn't been covered previously. has anyone heard of a .kext or daemon that would allow linux or (open)solaris-like vt switching? googling didn't help much.. i know os x allows a '>console' login from loginwindow.app, but i'm mainly interested in this because there are... (0 Replies)
Discussion started by: bamdad
0 Replies

5. UNIX for Dummies Questions & Answers

Sending signal from child to parent process!

Hi All, I facing a problem in handling signals between parent process communication. I am trying to send a signal(SIGINT) from child to parent. I am using kill function to do so and I am trying to read the signal using sigaction(). But the program is ending abruptly and I am not able to figure out... (4 Replies)
Discussion started by: vkn_1985
4 Replies

6. Shell Programming and Scripting

Parse an XML task list to create each task.xml file

I have an task definition listing xml file that contains a list of tasks such as <TASKLIST <TASK definition="Completion date" id="Taskname1" Some other <CODE name="Code12" <Parameter pname="Dog" input="5.6" units="feet" etc /Parameter> <Parameter... (3 Replies)
Discussion started by: MissI
3 Replies

7. Shell Programming and Scripting

Switching between two users

Can any one tell me : How we can switch between two users without prompting for the password. (In the SHELL SCRIPT can we fetch the USERID and PASSWORD from a specified file, without using SUDO command)? (2 Replies)
Discussion started by: deepusunil
2 Replies

8. Shell Programming and Scripting

comment and Uncomment single task out of multiple task

I have a file contains TASK gsnmpproxy { CommandLine = $SMCHOME/bin/gsnmpProxy.exe } TASK gsnmpdbgui { CommandLine = $SMCHOME/bin/gsnmpdbgui.exe I would like to comment and than uncomment specific task eg TASK gsnmpproxy Pls suggest how to do in shell script (9 Replies)
Discussion started by: madhusmita
9 Replies

9. Shell Programming and Scripting

su (switching to other user)

Hi, what is the use of the double quotes and !! in the following code segment: su - user1 << ""!! > /dev/null 2>&1 echo "welcome user1" EOF !! also what is the difference between below: su - user1 << ""!! > /dev/null 2>&1 and su - $USER << ""!!!> /dev/null 2>&1. Note: $USER =... (2 Replies)
Discussion started by: bjagadeesh
2 Replies

10. UNIX for Dummies Questions & Answers

Sending a signal from Unix to Windows

Hi all, I was wondering if anyone could help me here. I have got a Unix Server (Solaris 8) which we access over the network from a Windows NT machine using Exceed. The Unix box has Samba installed so it is very easy to send a signal from Windows to UNIX by simply creating a dummy file which... (3 Replies)
Discussion started by: robbiegregg
3 Replies
Login or Register to Ask a Question