Re: stopping a process temporarily

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pooja,

I am aware of set_task_state() and friends. The problem
as I see it is that I need to do this from the context
of a different process. In other words, running from 
the context of process A, I want to stop process B
from running for some time. Process B could be in any 
state at the moment I attempt to stop it, including
being blocked on something etc. 

I am not sure what would happen if I call
interruptible_sleep_on on a process that is already
blocked. Do you know if this is okay?

Did you run into this problem? 

TIA,

Vamsi.

On Sat, Feb 09, 2002 at 06:40:52AM +0000, Pooja Gupta wrote:
> Hi Vamsi,
>    You can do this by just having the task_struct for
> the task you want to make to sleep.  
> 
> You can use the macros predefined in linux/sched.h
> like set_task_state(....)  or set_current_state(..) by
> the different states in the same file.   Set the state
> to TASK_INTERRUPTIBLE, etc.Call schedule() after that.
> 
> You can even use interruptible_sleep_on(..) for making
> the process sleep.
>    
> To find out the task_struct, use the function
> find_task_by_pid(..).
> 
> 
> You can easily do this.  This has worked out in my
> code.
> 
> Hope this helps,
> 
> Pooja.
> 
>   
> 
>  --- "Vamsi Krishna S ." <vamsi@in.ibm.com> wrote: >
> Hello,
> > 
> > I need to stop a process temporarily from the
> > context of a different process.
> > 
> > I can't send it SIGKILL, I need to stop it
> > _temporarily_. 
> > I can't send it SIGSTOP (I think); if the process is
> > being ptrace'd the parent
> > will get control, not what we want.
> > 
> > I suspect we should be able to achieve this by
> > fiddling with task->state bits
> > but not sure, especially considering that the target
> > process could be in
> > any state (running/blocked/readytorun ...) when we
> > want to do this.
> > 
> > Any ideas/help greatly appreciated.
> > 
> > Thanks,
> > -- 
> > 
> > Vamsi Krishna S.
> > Linux Technology Center,
> > IBM Software Lab, Bangalore.
> > Ph: +91 80 5262355 Extn: 3959
> > Internet: vamsi@in.ibm.com
> 
> 
> ________________________________________________________________________
> Looking for a job?  Visit Yahoo! India Careers
>       Visit http://in.careers.yahoo.com

-- 
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5262355 Extn: 3959
Internet: vamsi@in.ibm.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux