Sponsored Content
Operating Systems Linux does sending a signal cause task switching Post 302312355 by pfarre on Friday 1st of May 2009 03:09:59 AM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
KILL(2) 						      BSD System Calls Manual							   KILL(2)

NAME
kill -- send signal to a process LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <signal.h> int kill(pid_t pid, int sig); DESCRIPTION
The kill() system call sends the signal given by sig to pid, a process or a group of processes. The sig argument may be one of the signals specified in sigaction(2) or it may be 0, in which case error checking is performed but no signal is actually sent. This can be used to check the validity of pid. For a process to have permission to send a signal to a process designated by pid, the user must be the super-user, or the real or saved user ID of the receiving process must match the real or effective user ID of the sending process. A single exception is the signal SIGCONT, which may always be sent to any process with the same session ID as the sender. In addition, if the security.bsd.conservative_signals sysctl is set to 1, the user is not a super-user, and the receiver is set-uid, then only job control and terminal control signals may be sent (in par- ticular, only SIGKILL, SIGINT, SIGTERM, SIGALRM, SIGSTOP, SIGTTIN, SIGTTOU, SIGTSTP, SIGHUP, SIGUSR1, SIGUSR2). If pid is greater than zero: The sig signal is sent to the process whose ID is equal to pid. If pid is zero: The sig signal is sent to all processes whose group ID is equal to the process group ID of the sender, and for which the process has permission; this is a variant of killpg(2). If pid is -1: If the user has super-user privileges, the signal is sent to all processes excluding system processes (with P_SYSTEM flag set), process with ID 1 (usually init(8)), and the process sending the signal. If the user is not the super user, the signal is sent to all processes with the same uid as the user excluding the process sending the signal. No error is returned if any process could be signaled. For compatibility with System V, if the process number is negative but not -1, the signal is sent to all processes whose process group ID is equal to the absolute value of the process number. This is a variant of killpg(2). RETURN VALUES
The kill() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The kill() system call will fail and no signal will be sent if: [EINVAL] The sig argument is not a valid signal number. [ESRCH] No process or process group can be found corresponding to that specified by pid. [EPERM] The sending process does not have permission to send sig to the receiving process. SEE ALSO
getpgrp(2), getpid(2), killpg(2), sigaction(2), sigqueue(2), raise(3), init(8) STANDARDS
The kill() system call is expected to conform to ISO/IEC 9945-1:1990 (``POSIX.1''). HISTORY
The kill() function appeared in Version 7 AT&T UNIX. BSD
March 15, 2012 BSD
All times are GMT -4. The time now is 09:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy