1748024 Members
4107 Online
108757 Solutions
New Discussion юеВ

Re: Pthread

 
Mulder_1
Frequent Advisor

Pthread

Hi,

There is a multi threaded process running on VMS 7.3-1

Is there any way to determine that the process is a multithreaded (Pthread).

$sh sys/multi does not show that it is a multi thread process.

Is Kthread has anything to do with Pthread ?

Thanks
13 REPLIES 13
Volker Halle
Honored Contributor

Re: Pthread

Mulder,

what problem are you trying to solve ?

You can use SDA to determine, if a process is running pthreads:

$ ANAL/SYS
SDA> SET PROC/IND=
SDA> pthread t

will print following message, if process is not threaded:

Process "CLUSTER_SERVER" (PID 20200087) is not threaded

SDA> SHOW PROC/IMA and look for PTHREAD$RTL

Kernel threads support multiple execution contexts within a single OpenVMS process (since OpenVMS Alpha V7.0). DECthreads (pthread) is a user mode thread manager, kernel threads are the basis for OpenVMS scheduling inside the executive.

The system parameter MULTITHREAD determines the amount of multithreading possible.

Volker.
John Gillings
Honored Contributor

Re: Pthread

Mulder,

Pthread is really an implementation of "coroutines" - that is, a number of threads of execution which timeshare within a single process. They (obviously) share the same address space and data. Only one thread can execute at a particular time. Thread scheduling is done by the Pthread library within the process. This is usermode, which you could implement yourself without privilege.

Kthread is very different. Each thread has most of the attributes of an independent process. The special thing about the threads is they share the same address space. Scheduling is by the operating system, and, in a multi processor environment, independent threads can execute simultaneously. This cannot be done without privilege.

Kthread threads are therefore visible at the OS level, and are displayed in SHOW SYSTEM with the "M" flag. Processes using Pthreads are not externally visible. You can infer them, as Volker has shown, but realise that the presence of PTHREAD$RTL in the image activation list does not necessarily mean it's in active use.
A crucible of informative mistakes
Mulder_1
Frequent Advisor

Re: Pthread

Please find the attached....

Also,the server is having only 1 CPU...

Thanks
Volker Halle
Honored Contributor

Re: Pthread

Yes, this process is running pthreads. As pthreads is a user mode thread manager, you do not need multiple CPUs for multiple threads. The threads will all run (one after the other) on one CPU, scheduled by pthreads.

Is there any problem you want to solve ? Or is this just a question out of pure interest ?

Volker.
Mulder_1
Frequent Advisor

Re: Pthread

Please ignore the previous attachment...

Thanks
Volker Halle
Honored Contributor

Re: Pthread

Ignored ;-)

But both attachments to me look quite similar ?!

Volker.
Mulder_1
Frequent Advisor

Re: Pthread

No there is a genuine problem with application which is using multi-threaded process...

The response received is very poor but system is functioning properly.
No problems with the network has been detected.No errors are found.

Thanks for your time...
David Jones_21
Trusted Contributor

Re: Pthread

The DECthreads library can schedule its threads as either user-mode or kernel threads depending upon flags in the image header.
By default, kernel threads are disabled for a program but can be enabled at link time with the /threads_enable qualifier. You can also use the threadcp program in sys$update (set command sys$update:threadcp.cld) to examine/modify the flags in an existing executable.

Kernel mode threads are disabled by default because true concurrency tends to expose subtle errors in the threading logic of many pthreads programs. Also, it's frequently the case that the parallelism acheived doesn't outweigh the added overhead of kernel thread scheduling vesus the user mode scheduler.
I'm looking for marbles all day long.
Ian Miller.
Honored Contributor

Re: Pthread

You should have a look at the fine manual, in particular

http://h71000.www7.hp.com/doc/73final/6493/6101pro_031.html#vms_appendix

Since when did you have the performance problem and why do you think it has something to do with pthreads?
____________________
Purely Personal Opinion