Vic wrote:
> 
> > If you check all the PSA's you should be able to determine if
> > the task is dispatched.
> 
> I was also considering the PSA approach by comparing each PSATOLD with
the
> address of the TCB in question. If there's match, then its active. If
> there's no match and the TCB is not waiting or paused can I assume
that
> it's dispatchable?

No, you have to simultaneously compare PSAAOLD with the address space
you're interested in and PSATOLD with the task you are interested in
because you will find TCBs at the same address in many address spaces.
One "creative" way to do this is PLO.CL where you use the ASCB address
as the compare value for PSAAOLD and load from PSATOLD. If the compare
fails you just skip that PSA because the associated cpu isn't executing
any task (or SRB) in that address space. 

But even if the TCB you're interested in happens to appear to be
dispatched at the moment you looked, there's no guarantee at all that it
is still running at the end of the instruction(s) you used to decide
that it was running. That's the "feature" of asynchronous execution,
there's just no way to know for sure what the state of any other unit of
work is from moment to moment.

> The TCBTTIME approach won't work for me since I need to know the
status at
> the time the sample is taken.

If you are disabled at the point you begin your scan of the PSA's and
the TCB you want really is active at that moment, then there is more
likelihood that you will "catch it in the act". But, once again, no
guarantees. You can get (legally) disabled by obtaining the CPU lock
prior to the PSA scan and releasing it afterward.

CC

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to