All of lore.kernel.org
 help / color / mirror / Atom feed
* finding process blocking on a system call
@ 2005-01-06 12:18 selvakumar nagendran
  2005-01-06 16:03 ` Daniel Gryniewicz
  0 siblings, 1 reply; 3+ messages in thread
From: selvakumar nagendran @ 2005-01-06 12:18 UTC (permalink / raw)
  To: linux-kernel

Hello linux-experts,
   I want to find whether a process blocks in a system
call due to the unavailability of the resource that is
accessed in it. For eg, if a semaphore key is not
available to the process while executing the system
calls like read, write etc, it will wait in the
TASK_INTERRUPTIBLE state. 
   Now, I don't want the process to simply sleep,
waiting for the semaphore. I want it to be added into
the runqueue again. And also, I want to determine this
in the kernel module. How can I do this? Can anyone
help me regarding this?
 I am intercepting system calls in kernel 2.4.28.

Thanks,
selva


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: finding process blocking on a system call
  2005-01-06 12:18 finding process blocking on a system call selvakumar nagendran
@ 2005-01-06 16:03 ` Daniel Gryniewicz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Gryniewicz @ 2005-01-06 16:03 UTC (permalink / raw)
  To: selvakumar nagendran; +Cc: linux-kernel

On Thu, 2005-01-06 at 04:18 -0800, selvakumar nagendran wrote:
> Hello linux-experts,
>    I want to find whether a process blocks in a system
> call due to the unavailability of the resource that is
> accessed in it. For eg, if a semaphore key is not
> available to the process while executing the system
> calls like read, write etc, it will wait in the
> TASK_INTERRUPTIBLE state. 
>    Now, I don't want the process to simply sleep,
> waiting for the semaphore. I want it to be added into
> the runqueue again. And also, I want to determine this
> in the kernel module. How can I do this? Can anyone
> help me regarding this?
>  I am intercepting system calls in kernel 2.4.28.
> 
> Thanks,
> selva
> 

This is a very bad idea, as the process will expect the syscall to be
complete when it runs again.  Just use the non-blocking versions of the
syscall (file/network IO all have non-blocking versions), and handle the
EWOULDBLOCK return value in your userspace application.

Daniel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: finding process blocking on a system call
       [not found] <e4cb1987050106133642b931ce@mail.gmail.com>
@ 2005-01-07  4:13 ` selvakumar nagendran
  0 siblings, 0 replies; 3+ messages in thread
From: selvakumar nagendran @ 2005-01-07  4:13 UTC (permalink / raw)
  To: lkml.ThinkingInBinary; +Cc: linux-kernel

> You can't both block but have it added to the
> runqueue--blocking means
> it does not run... you either need to use
> non-blocking calls or two
> threads.  If you want to find the process, top can
> do this
> (interactively) or you can use the /proc filesystem.
> 

Hello,
   I accept that we can't have a process both blocked
and in the runqueue. See, I want to give a special
state to the process blocked on a particular resource
like semaphore as TASK_BLOCKED and I will not add it
into the wait queue. 
   If the scheduler picks up this blocked process
again, I will identify the process that is having the
semaphore and I will run that.  with this, I am giving
some timeslice of the blocked process to the process
having that resource so that it can release it soon.
  So, if a process blocks on the syscall, I will
change the state as TASK_MYSTATE. Since, a process may
block on a system call for many reasons, I am not able
to clearly figure out how can I do that? Can u help me
regarding this?

Thanks,
selva




		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-07  4:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-06 12:18 finding process blocking on a system call selvakumar nagendran
2005-01-06 16:03 ` Daniel Gryniewicz
     [not found] <e4cb1987050106133642b931ce@mail.gmail.com>
2005-01-07  4:13 ` selvakumar nagendran

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.