Operating System - OpenVMS
1748182 Members
3509 Online
108759 Solutions
New Discussion

VAX/VMS 5.5-2 & POSIX Threads ...

 
Ruslan R. Laishev
Super Advisor

VAX/VMS 5.5-2 & POSIX Threads ...

Hi  All!

Is there some good and enough old boy who have had an expirience of  using pthreads under VAX/VMS 5.5-2 ? :-)

Any importrant difference beetwen under VMS 5.5-2 and 7.x? Limitations ?

 

2 REPLIES 2
Hoff
Honored Contributor

Re: VAX/VMS 5.5-2 & POSIX Threads ...

As for OpenVMS VAX, AFAICT, POSIX threads was from ~1995.   OpenVMS VAX V5.5-2 from 1992.  So there are no threads in the base distro, unless you count the VAX C not-POSIX-based parallel-processing interfaces.  Back that far, the ANSI C compiler and threading was an add-on.

As for your question, and assuming the AACRT060 kit is installed: somewhat buggy.   That's from twenty-year-old recollections, too.   One look at the various OpenVMS updates and the threading-related patch kits that have arrived since that era and since VAX was retired would have told you that, though.

Threading support really didn't settle down until after the KP work and AFAIK that support was never available on VAX.

This assuming pthreads can work at all — and I'm somewhat skeptical about that.   An approach similar to GCD (with compiler support and library assists) works rather better here in my experience, but VMS completely lacks support for that.

Ruslan R. Laishev
Super Advisor

Re: VAX/VMS 5.5-2 & POSIX Threads ...

Thanks for answer , Hoff!

I expected that the Dave Butenhoff can be drop some words  but .... only good old @Hoff still here. :-)

Of course  I installed the AACRT060 before trying pthreads. 

I caugh the first "difference" that I cannot use 0, or NULL  as a second argument  in the pthread_create call (), and i suspect that there is some other differences.

#include        <starlet.h>
#include        <stdio.h>
#include        <pthread.h>

void    thread  (void)
{
        for (int i = 0; i < 13; i++)
                printf("[TID:%x%x] Iteration = %d\n", pthread_self(), i);

        pthread_exit(NULL);
}

struct timespec interval = {3, 0};
void    main    (void)
{
int     status;
pthread_t       tid;
pthread_attr_t  tattr = {0};

        for (int i = 0; i < 3; i++)
                {
                if ( status = pthread_create(&tid, tattr, thread, NULL) )
                        printf("pthread_create() -> %d", status);
                }

        pthread_delay_np(&interval);
}

 

Let me read about the KP, thanks for the reference.