login
Header Space

 
 

stop process from getting scheduled out

October 14, 2008 - 8:33am
Submitted by Anonymous on October 14, 2008 - 8:33am.
Linux

I want to stop my process for getting scheduled out for 3-4 statements.
in the sense I want my 3-4 statements to get executed atomically.

ret = waitpid (-1, &live_status, WNOHANG | WUNTRACED);
if(live_ret==0)
{
kill(PIDGET(inferior_ptid),SIGINT);
}

how to achieve it ?
after waitpid's execution....my process should not get scheduled out.
and able to successfully execute kill statement.

Come at this from another direction:

October 14, 2008 - 9:03am
Anonymous (not verified)
The process that might exit
Just before a successful exit, this process takes a lock.
The process that waits and kills
If the other process exited without error, kill something and release the lock
Any other process working on the same data
Take the lock before doing anything that would upset the other processes

why?

October 14, 2008 - 9:28am

normal processes can't avoid to get scheduled out, and as unix programs work without that capability this is not needed and would indeed be dangerous. but why do you want to do that? if you don't want the child process to run because it could exit and defeat the purpose of the kill(), that doesn't work with SMP anyway: the child could be running on another CPU.

if you just want to make sure the pid still refers to a child and not to another process: if you don't ignore SIGCHLD, the child will survive in half-dead state (as a zombie process) to reserve the pid until the parent process got the pid returned from wait(). if you didn't, your kill() will always hit your child, as intended, it just may me dead anyway.

the problem is: the kill

October 14, 2008 - 11:21am
Anonymous (not verified)

the problem is:

the kill signal is not issued by the parent, but by debugger.
so precess is not going to get killed rather it is going to be stopped.

what I want is :
after I do
kill(PIDGET(inferior_ptid),SIGINT);

I want to nulify the efect of SIGINT.
in the sense, I should be able to tell kernel, please cancel this kill request.
I do not want to send anymore....

is it possible ?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary