[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

Threads a benefit on a uniprocessor? (take II)

» close window

The Question is:

 
Dear Sir,
    I did asked a question about the benefit of
multithread programming on sigle CPU and the answer
is "it depends" so I would like to know some more
if talk about only VMS , does it support
full function of multithread such as
it allows computational threads to execute
while I/O threads are waiting for I/Os to
complete or not. Regard that my task is
suitable for multithread programming.
I run VMS 7.1 on Alpha 2100 , DEC 5.6.
    I think I still stuck with the question
that I still gain benefit from the multithread
on single CPU or not if I use VMS.
 
 
Regards
Seng
 
 


The Answer is :

You've reached a different Wizard this time, but you are going to get pretty
much the same answer, I'm afraid.
 
Whether or not your application will gain benefits from using multiple
threads when running on only one CPU depends mostly on the application, and
only slightly on the implementation of the threads services.
 
Part of it depends on how you define "benefits".  As the other Wizard
indicated, using threads can simplify your application's implementation,
either by making the code itself simpler or by making its operation easier to
understand.  Likewise, if you rely on threads instead of asynchronous
programming, your code is likely to be much more portale.  These "benefits"
are applicable regardless of which operating system you are running on and
regardless of how many processors you have.
 
In terms of seeing a performance benefit, using threads on a single CPU
system is only likely to help your application if it is able to perform
compute activity in one thread while one or more other threads are waiting
for I/O (or some other blocking activity).
 
In your specific case, running on VMS V7.1, you may need to use the /THREADS
qualifier when you link your application, in order to see any significant
benefit.  This qualifier enables the kernel support for threads, which causes
all system calls (e.g., I/O blocks) to be thread-synchronous.  (Without it,
threads are run on a strict timeslice model, and if a thread makes a blocking
system call, then it will block the entire process for the duration of its
timeslice; furthermore, if the blocking thread has the highest priority, it
will be scheduled to run again for the next timeslice, and the process will
remain blocked.)
 

answer written or last revised on ( 11-SEP-1998 )

» close window