Ask the Wizard Questions
We have an application which receives messages on a UDP por
The Question is:
on realtime basis from some devices over the Ethernet.
The problem we have is whenever the VAX gets loaded, the
UDP buffer overflows and we end up losing messages.
The current appliction can be represented by following loop -
create a UDP port.
$QIOW on UDP port.
we have incresed the size of UDP buffer and it helps. The # of
lost messages are reduced. I also want to increase the base
prority of this process which recives UDP messages by 3-4
so it does not compete with other interactive processes.
Currently this one runs at base prioority of 4 like all
other interactive process. There are other group of people
which do not want to increase the priority and want to use
ASTs for processing messages. This is where I have some questions
If modify the above code as -
create a UDP port
QIO on UDP Port wirth Process_Message as AST
sys$setast(0) ! disable further interupts.
another QIO with AST Process_message;
do the real processin like before;
sys$setast(1) ! enable interupts
End ! process_message routine
Keeping this in mind here are my questions -
1. Will VMS preempt another process running at same priority
when AST is delivered, our PRIORITY_OFFSET sysgen parameter is 0.
2. Since I am disabling AST delivery in begining how and
where VMS would store info about this events?
I had seen a white paper presented at DECUS seminar that
described how ASTs work on VMS and would have answered my
quuestion. If it is still around somewhere I would appreciate
getting a copy.
The Answer is:
Warning: "realtime" has many meanings.
Which IP package is in use here?
Note that network transports and OpenVMS real-time process priorities
(16+) tend not to mix particularly well, as network support software
tends to run at non-realtime priorities, and can thus get blocked by
the realtime activities.
An AST does not interrupt an AST.
Here's an example:
allocate some number of buffer blocks and place them into
a freelist queue. (The total can be set at run-time, or
can be a compile-time value...)
associate the OpenVMS channel with the UDP port.
// issue a repeating wakeup, every 30 seconds or so -- not strictly
// necessary, but often a useful workaround for programming
// or queue problems.
// Start the process running...
sys$qio on the channel, specifying ProcessMsgAst as the AST
// ASTs hit asynchronous to this `for' loop; this loop keeps
// trying to drain the MsgInQueue. When drained, it sleeps.
while ( Dequeue( BusyQ ))
ExitApplicationFlag = ProcessMsg();
EnQueue( FreeQ );
if ( ExitApplicationFlag )
// process a message off the queue
// performed at non-AST, to prevent blocking ASTs.
// release blocks onto the FreeQueue.
ProcessMsgAst( ASTPRM )
// pull a new block off the FreeQueue.
Dequeue( FreeQ );
sys$qio on the channel, specifying ProcessMessage
as the AST, specify the new block. (I'd
put all tracking information into the block,
including the IOSB and the read buffer, etc.)
Specify the buffer as the $qio ASTPRM arg.
// queue the process request (see the ASTPRM arg) to the
// mainline code via an interlocked queue. (see
// lib$insqXX, or the C queue instruction built-ins,
Enqueue( BusyQ );
// Multiple $wake calls can be made; extra wake requests
// are ignored until $hiber.
:1. Will VMS preempt another process running at same priority
: when AST is delivered, our PRIORITY_OFFSET sysgen parameter is 0.
I don't think this is particularly relevent, as I see no shared
resources here. (And if you are running at a realtime priority,
there is no rescheduling until/unless a higher-priority process
:2. Since I am disabling AST delivery in begining how and
: where VMS would store info about this events?
There is no need to disable AST delivery here, as having an AST
active will block reception of other ASTs.
:I had seen a white paper presented at DECUS seminar that
:described how ASTs work on VMS and would have answered my
:quuestion. If it is still around somewhere I would appreciate
:getting a copy.
There is documentation on AST processing in the OpenVMS Programming
Concepts manual, as well as in various other manuals in the OpenVMS
documentation set. The internals of the AST delivery mechanism are
documented in the Internals and Data Structures Manual (IDSM). (And
the details at the level listed in the IDSM are seldom necessary.)
I would strongly recommend looking at the DECthreads documentation and
support, as well.