1833582 Members
3662 Online
110061 Solutions
New Discussion

Sched_noage

 
Karen Shen_1
Occasional Advisor

Sched_noage

We are at the point to use this HP feature on our application/database server. But does anyone know how to find if a particular process is using it or still using the default shceduler (sched_hpus)?
Thanks!
Karen
5 REPLIES 5
James Murtagh
Honored Contributor

Re: Sched_noage

Hi Karen,

There are two ways I know of :

1) Walk the kernel process and thread structures to find this. Only HP staff are normally lazy enough to do this but I'll show you if you want! :-)
2) Use the pstat interface on 11.00 and beyond. A little knowledge of C is required here. The lwp_schedpolicy and pst_schedpolicy will tell you the thread/process scheduling, but you only really need to look at the thread data as they are really all that is scheduled to run. Compare the values returned for the definitions in /usr/include/sys/sched.h

Regards,

James.
Karen Shen_1
Occasional Advisor

Re: Sched_noage

Hi, James:
Thanks for the reply. I'd appreciate if you can show me how to do in either way.
Thanks
Karen
James Murtagh
Honored Contributor

Re: Sched_noage

Hi Karen,

I'll show you the q4 way now, as it is quicker. I'll add the pstat code when I'm able to write it, tonight or more likely tomorrow morning.

11i

# ied q4 /stand/vmunix /dev/kmem
q4> load proc_t from proc_list next p_factp max nproc
q4> keep p_pid ==
q4> load kthread_t from p_firstthreadp next kt_factp max p_livethreads
q4> print -x kt_tid kt_schedpolicy

Which will produce something similar to the following, although how many entries will depend on how many threads you have.

kt_tid kt_schedpolicy
0x79b 0x2
0x79a 0x2
0x799 0x2
0x798 0x2
0x797 0x2
0x796 0x2
0x793 0x2
0x769 0x2

So you can see, after comparing 0x2 in sched.h that this is sched_hpux.

On hpux 11.00, things are a little different in the proc and thread commands:

# ied q4 /stand/vmunix /dev/kmem
q4> load struct proc from proc max nproc
q4> keep p_pid ==
q4> load kthread_t from p_firstthreadp next kt_link max p_livethreads
q4> print -x kt_tid kt_schedpolicy

Which gives:

kt_tid kt_schedpolicy
0x6a4 0x6

Here you can see the schedulicy policy is now 0x6, so this is SCHED_RTPRIO from sched.h. Basically I ran a job using rtprio and used this.

Regards,

James.
James Murtagh
Honored Contributor

Re: Sched_noage

Hi Karen,

The pstat code is attached. I was a bit delayed as it uses different codes as the kernel/sched.h do, but i've listed them at the bottom of the output. You can compile it just using the following syntax:

# cc -o lwp lwp.c

The output is similar to the following and it takes a process PID as the argument:

# ./lwp 1785

Process: PID SCHED Command
: 1785 4 /opt/perf/bin/midaemon

Thread: TID SCHED
: 1823 4
: 1834 4
: 1835 4

HPUX TIMESHARE 1
HPUX RTPRIO 2
HPUX FIFO 4
POSIX RR 8
POSIX RR II 10
HPUX NOAGE 20

(it doesn't have the ":"s, hopefully these will keep the format)

I was also just thinking, if you wanted to scan all threads looking for certain schedling priorities, i.e. sched_noage, you could use (11i):

q4> load kthread_t from kthread_list next kt_factp max nkthread
q4> keep kt_schedpolicy == 0x8
q4> print -tx|grep kt_tid (find the thread you want to keep)
q4> keep kt_tid ==
q4> load proc_t from kt_procp
q4> print -x p_comm
p_comm
"midaemon"

Regards,

James.


James Murtagh
Honored Contributor

Re: Sched_noage

Hi (again) Karen,

Sorry, that was the wrong version of the code. I won't post it again, if you just move "#endif" to immediately below "#define PS_NOAGE 0x20" this should work on 11.00 and 11i whether sched_noage is implemented or not.

Regards,

James.