Determining if thread sleep state is voluntary or not

Determining if thread sleep state is voluntary or not

Post by Joe Seig » Sun, 27 Jun 2004 02:29:50



Is there any way of determining whether a thread in sleep state
is voluntary or not?  Would pr_stype tell you that, assuming
you knew the valid values?

Joe Seigh

 
 
 

Determining if thread sleep state is voluntary or not

Post by Casper H.S. Di » Sun, 27 Jun 2004 04:36:13



>Is there any way of determining whether a thread in sleep state
>is voluntary or not?  Would pr_stype tell you that, assuming
>you knew the valid values?

The "pr_stype" value derives from the synchronization primitive
the thread is sleeping on; so if it is set (it looks like its
zero if it's not), it gives you the type of object
it is blocking on.

So I'm not sure if you want to know about the sleep state;
if a thread is in runnable state, it is not running (Onproc)
but it is sleeping.

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

 
 
 

Determining if thread sleep state is voluntary or not

Post by Joe Seig » Sun, 27 Jun 2004 05:09:32




> >Is there any way of determining whether a thread in sleep state
> >is voluntary or not?  Would pr_stype tell you that, assuming
> >you knew the valid values?

> The "pr_stype" value derives from the synchronization primitive
> the thread is sleeping on; so if it is set (it looks like its
> zero if it's not), it gives you the type of object
> it is blocking on.

> So I'm not sure if you want to know about the sleep state;
> if a thread is in runnable state, it is not running (Onproc)
> but it is sleeping.

If a thread page faults, can you ever see pr_name == 'S' or
is it only 'R' while page fault is being processed?

Joe Seigh

 
 
 

Determining if thread sleep state is voluntary or not

Post by Joe Seig » Sun, 27 Jun 2004 21:53:07




> >Is there any way of determining whether a thread in sleep state
> >is voluntary or not?  Would pr_stype tell you that, assuming
> >you knew the valid values?

> The "pr_stype" value derives from the synchronization primitive
> the thread is sleeping on; so if it is set (it looks like its
> zero if it's not), it gives you the type of object
> it is blocking on.

> So I'm not sure if you want to know about the sleep state;
> if a thread is in runnable state, it is not running (Onproc)
> but it is sleeping.

I think I can look at pr_syscall to see if the sleep was voluntary
or not.  I don't think there is a way for a thread to explicitly
sleep or block without doing a syscall.

Joe Seigh