Operating System - OpenVMS
1753797 Members
7350 Online
108805 Solutions
New Discussion юеВ

Thread priority in OpenVMS

 
SOLVED
Go to solution
Hoedl
Occasional Contributor

Thread priority in OpenVMS

I wrote an application using DECthreads with different thread-priority.
Everything works fine.
But how can I verify a thread priority?
I tried with
$ana/system
SDA> sho proc/all
But this shows not the required informations.

Thanks for informations
7 REPLIES 7
labadie_1
Honored Contributor

Re: Thread priority in OpenVMS

may be with

sda> pthread...
Martin P.J. Zinser
Honored Contributor

Re: Thread priority in OpenVMS

Hello Gerard,

I already gave him that answer in the business support forums ;-)

Unfortunatly there is not much documentation
on this extension as far as I know.

I did also check sys$share: for installed SDA extensions and did not find something else.

Greetings, Martin
labadie_1
Honored Contributor

Re: Thread priority in OpenVMS

it seems that
sda> set proc/id=xx
sda> pthread thread
show something similar to the following

Process name: MYSQL_SERVER Extended PID: 20200157 Thread data: "thread"
-----------------------------------------------------------------------------
Thread Name State Substate Policy Pri
------ ------------------------- --------------- ----------- ------------ ---
1 default thread blocked $synch 64 SCHED_OTHER 11
-3 exit-handling thread blocked SCHED_FIFO 32
2 blocked cond 40025 SCHED_OTHER 11
3 blocked cond 40026 SCHED_OTHER 11
4 blocked cond 40027 SCHED_OTHER 11
5 blocked cond 40028 SCHED_OTHER 11
6 blocked cond 30013 SCHED_OTHER 11
7 blocked $synch 64 SCHED_OTHER 11
8 blocked cond 10013 SCHED_OTHER 11
9 blocked $hiber SCHED_OTHER 11
174 zombie exited SCHED_OTHER 11
SDA>
Brad McCusker
Respected Contributor

Re: Thread priority in OpenVMS

Debug?

DBG> SET EVENT THREADS
DBG> pthread thread -1

this will give you the policies and priorities of the threads.

Will this get you what you want?
Brad McCusker
Software Concepts International
Hoedl
Occasional Contributor

Re: Thread priority in OpenVMS

Thanks for all the inputs.

I tried to find it on OpenVMS 6.2 sda>pthread does not help.
I learned that pthread helps on OpenVMS 7.2.

The confusing part is the result:
Thread Name Policy State Pri
------ ---- ----- ----- ---
1 default thread SCHED_OTHER blocked 11
2 SCHED_OTHER running 11

I started the process with pri=4 and created the thread with pri=7.
How come I see priority 11 for both threads?
Do I mix up something here?
Anders Sundqvist
New Member

Re: Thread priority in OpenVMS

for info on the "pthread" command in SDA, try "SDA> pthread help" (it works on 7.2-2 at least). Note that the pthread help command won't work unless the "current" process is threaded... (stupid :-))

-Anders
John Eerenberg
Valued Contributor
Solution

Re: Thread priority in OpenVMS

Hi.

Since it doesn't look like a single command will display the base priorities, here is the manual way to do it.

Take a look at the process in SDA
SDA> show process

Note the PCB (Process Control Block) address, let's call it pcbaddr. If you want, you can display the entire pcb:
SDA> format/type=pcb ! The /type isn't needed but old habits die hard

Note the number of threads for this process.
SDA> examine +pcb$l_kt_count
If this count is one, there are no threads for this process.
If this count is two or more, we can check the base priorities of each thread.

We need to find all the threads associated with this process. A block of 32bit addresses point to each KTB (Kernel Thread Block). Each ktb contains the base priority field ktb$l_prib. (Note: ktb's and pcb's are the same except certain fields are not defined in the ktb. Also, if a ktb and pcb are the address, it is okay.)

So where is this block?
SDA> examine +PCB$L_KTBVEC
This is a block of 32bit addresses that is pcb$l_kt_count*4 bytes long.
This block contains a list of addresses pointing to each ktb data structure.

Do +PCB$L_KT_Count times. So if this value is 3, do the following:

SDA> Examine @(@(+pcb$l_ktbvec)+0)+ktb$l_prib
Note that "+0" is the offset within the ktbvec block.
This is the base priority of the first thread

SDA> Examine @(@(+pcb$l_ktbvec)+4)+ktb$l_prib
Note that "+4" is the second ktb address within the ktbvec block.
This is the base priority of the second thread

SDA> Examine @(@(+pcb$l_ktbvec)+8)+ktb$l_prib
This is the base priority of the third thread

If you need to change the base priority of a thread, just look at the pid, which is the epid in the pcb, and change it from DCL. For example, to get the pid of the third ktb do the following:
SDA> @(@(+pcb$l_ktbvec)+8)+ktb$l_epid

A description of these data strucutres can be found at
http://h71000.www7.hp.com/DOC/73final/6466/6466pro_005.html#kthreads_process_structure

Hopefully, I didn't mis-state something. Let me know if there is a typo or if doesn't look right (@ can be confusing, etc.).

john

ps - if you want, I can write a small macro-32 program to do this.
It is better to STQ then LDQ