Table Of ContentVAX/VMS
and
Internals
Data Structures
LAWRENCE KENAH & SIMON E BATE
J.
VAX/VMS Internals and Data Structures
VAX/VMS
Internals
and Data Structures
LAWRENCE KENAH
J.
SIMON BATE
F.
Digital Press
Copyright 1984 by Digital Equipment Corporation.
All rights reserved. Reproduction of this book, in whole or in part, is prohibited. For
information, write Digital Press, Educational Services, Digital Equipment Corporation,
Bedford, Massachusetts.
The painting reproduced on the front cover is "From Red to Violet" (1970, oil on can-
vas) by Hannes Beckmann, courtesy of the DeCordova Museum Collection: Gift of Mr.
Michael F. Lynch.
DEC, DECnet, UNIBUS, VAX, and VMS are trademarks ofDigital Equipment Corpora-
tion.
Designed by David Ford.
Automatically typeset utilizing a VAX-11/780 by York Graphic Services, Incorporated.
Printed in U.S.A. by Halliday Lithograph.
Order number EY-00014-DP.
Library of Congress Cataloging in Publication Data
Kenah, Lawrence 1946-
J.,
VAX/VMS internals and data structures.
Includes index.
1. VAX/VMS (Computer operating system) 2. VAX-11 (Computer)—
Programming. 3. Data structures (Computer science] I. Bate,
Simon. II. Title. III. Title: VA.X./VM.S. internals and data structures.
QA76.6.K454 1984 001.64'2 83-26187
ISBN 0-932376-52-5
Preface
This bookexplains howtheVAX/VMSexecutiveworks. It describes thedata
structures maintained and manipulated by the VMS operating system, dis-
cusses the mechanisms that transfer control between userprocesses and the
VMS operating system (and among the components of the operating system
itself), and describes some of the features of the VAX hardware as they are
used by the VMS operating system. It also describes the VMS executive, in-
cludingall themajor componentsoftheexecutive, aswell as systeminitiali-
zation and the operation of all system services. It does not include a general
discussion of the I/O subsystem, because that subject is already described in
the VAX/VMS Guideto WritingaDeviceDriver(DigitalEquipmentCorpora-
tion, 1982). However, thedetailsofsomeVAX/VMSdevicedrivers, aswellas
the operations of I/O-related system services are included in this book.
Thisbookisintendedforsystemprogrammersandotherusers oftheVAX/
VMS operating system who wish to understand the internal workings of the
executive. The detailed description of data structures should help system
managers make better informed decisions when they configure systems for
space-or time-critical applications. It will also help application designers to
appreciate the effects (in speed or in memory consumption) of different de-
sign and implementation decisions. This book assumes that the reader is
familiar with the VAX architecture and the VMS operating system, particu-
larly with its use of system services and its techniques of memory manage-
ment.
In explaining the operation of a subsystem of the executive, thisbook em-
phasizes thedata structures manipulated bythat component, rather than de-
tailed flow diagrams of major routines.
This book differs from the reference manuals that make up the VAX/VMS
documentation set in that it describes internal operations and data struc-
tures. Whileitis unlikely thatany component describedinthis bookwill be
drastically changed with any major release of the VAX/VMS operating sys-
tem, there is no guarantee that a particular data structure or subroutine de-
scribed here will remain the same from release to release. With each new
version of the operating system, privileged applicationprograms that rely on
details containedin thisbookmustbetestedbeforetheyareusedforproduc-
tion work with a standard load of users.
This book is divided into nine parts, each of which describes a different
aspect of the operating system.
• Part 1 presentsanoverviewoftheVAX/VMSoperatingsystemandreviews
those concepts that are crucial to understandingthe workings of that sys-
tem.
1
Preface
• Part 2 describes the mechanisms used to pass control between user pro-
grams and the operating system and within the VMS system itself.
• Part 3 describes scheduling and timer support, concluding with a discus-
sion of the internals of the VAX/VMS lock manager.
• Part 4 discusses memory management.
• Part 5 describes the I/O subsystem.
• Part 6 describes the creation and deletion of a process and the activation
and termination of an image in the context of a process.
• Part 7 deals with system initialization and also includes a discussion on
the VAX-11/782.
• Part 8 discusses miscellaneous topics that are not conveniently classified
in any conventional catalog of operating systems:
—
The implementation of logical names
—
—The functions of miscellaneous system services
The use of listing and map files
—
The conventions used in naming symbols
• Part 9 provides information on VMS data structures.
Mostoftheoperations oftheVMS executivecanbeeasilyunderstoodonce
the contents of the various data structures are known. Although selected
structures are described throughout the book, Appendix B describes (or pro-
vides pointers to) all the structures used by the operating system. The struc-
tures related todevice drivers andthefile systemarenotdescribed. The data
structures related to device drivers are described in the VAX/VMS Guide to
Writing a Device Driver. Data structures specific to the file system have yet
to be documented.
Several documents in theVAX/VMS document set supplyimportant back-
ground information for the topics discussed in this book. The followingpro-
videanespeciallyvaluablefoundation: VAX/VMS System ServicesReference
Manual, the VAX-11 software installation guides, and the chapter in the
VAX-11 Run-Time Library Reference Manual that describes condition han-
dling.
The concepts underlying the operating system are discussed in the VAX/
VMS SummaryDescription andGlossary, and the VAXSoftwareHandbook.
Thefollowingdocumentsarealsohelpfulreferences: the VAX/VMS Guide to
Writing a Device Driver, the VAX-11 Architecture Reference Manual, and
the VAX Hardware Handbook.
AnexcellentdescriptionoftheVAXarchitecture, aswellasadiscussionof
some of the design decisions madeforits firstimplementation, the VAX-11/
780, can befoundin ComputerProgrammingandArchitecture: The VAX-1
by Henry M. Levy and Richard H. Eckhouse, Jr. (Digital Press, 1980). This
VI
Preface
bookalso contains abibliographyofsomeoftheliteraturedealingwithoper-
ating system design.
The reader should be aware of several conventions used throughout this
book.Inalldiagramsofmemory, thelowestvirtualaddressappearsatthe top
of the page and addresses increase toward the bottom of the page. This con-
vention means that the direction of stack growth is toward the top of the
page. In diagrams that display more detail, such as bytes within longwords,
addresses also increase from right to left. That is, the lowest addressed byte
(orbit) inalongwordis ontherighthandside ofafigureandthemostsignifi-
cant byte (or bit) is on the lefthand side.
Thewords "system" or "VMS system" areusedtodescribe theentire soft-
ware package that is a part of a VAX-11 system, including privileged proc-
esses, utilities, and other support software as well as the executive itself.
The word "executive" refers to those parts of the VMS operating system
that reside in system virtual address space. The executive includes the con-
tents of the file SYS.EXE, device drivers, and other code and data structures
loaded at initialization time, including RMS and the system message file.
When either "process controlblock" or "PCB" is usedwithout amodifier,
it refers to the software structure used by the scheduler. The data structure
that contains copies of the general registers (that the hardware locates
through the PR$_PCBB register) is always called the "hardware PCB."
When referring to access modes, the term "inner access modes" means
those access modes with more privilege. The term "outer access modes"
means those access modes with less privilege. Thus, the innermost access
mode is kernel and the outermost access mode is user.
The term "SYSBOOT parameter" is used to describe any of the adjustable
parameters that are used by the secondary bootstrap program SYSBOOT to
configure the system. The adjustable parameters include both the dynamic
parametersthatcanbechangedontherunningsystemandthestaticparame-
ters that require a reboot in order for their values to change. These parame-
ters are referred to by their parameter names rather than by the global loca-
tions where their values are stored. Appendix A relates the SYSBOOT
parameter names to their corresponding global locations.
The terms "byte index," "wordindex," "longword index," and so on, refer
toamethodofaccessthatusestheVAX-11 contextindexingaddressingcapa-
bility. That is, the index value will be multiplied by one, two, four, or eight
(depending on whether a byte, word, longword, or quadword is being refer-
enced)aspartofoperandevaluationinordertocalculatetheeffectiveaddress
of the operand.
In general, the component called INIT refers to a module of that name in
the executive and not the volume initialization utility. When that utility
program is being referenced, it will be clearly specified.
vn
Preface
Three conventions are observed for lists.
Inlists suchas this one, where thereisno orderorhierarchy, list elements
are indicated by l—eading bullets (•). Sublists without hierarchy are indi-
cated by dashes
( ).
Lists thatindicateanorderedset ofoperations arenumbered. Sublists that
indicate an ordered set of operations are lettered.
Numbered lists with the numbers enclosed in circles indicate a corre-
spondence between individual list elements and numbered items in a
figure.
ACKNOWLEDGMENTS
Our first thanks must go to Joe Carchidi, for suggesting that this book be
written, and to Dick Hustvedt, for his help and enlightening conversations.
Wewouldlike to thankJohnLucasforputtingtogethertheinitialversions
of Chapters 7, 10, 11, and 30 and Vik Muiznieks for writing the initial ver-
sions of Chapters 5, 18, and 19.
Appreciationgoes to all thosewho reviewed the draftsfor both editions of
the book (VAX/VMS Version 2.2 and 3.3). We would particularity like to
thank Kathy Morse for reviewing the first edition in its entirety and Wayne
Cardoza for reviewing the entire second edition. Our special thanks go to
Ruth Goldenberg for reviewing both editions in their entirety, and for her
many corrections, comments, and suggestions.
We owe a lot of thanks to our editing staff, especially to Jonathan
Ostrowskyforhis labors inpreparingthefirstedition, andBetty Steinfeldfor
herhelp and suggestions. Many thanks go to Jonathan Parsons forreviewing
andeditingthesecondedition, andforallhishelp, patience, and suggestions.
We would like to thank the Graphic Services department at Spitbrook,
particularily Pat Walker for her help in paging and production of the first
edition, and Paul King for his help in transforming innumerable slides and
rough sketches into figures. Thanks go to Kathy Greenleaf and Jackie
Markow for converting the files to our generic markup language.
Thanks go to Larry Bohn, Sue Gault, Bill Heffner, Kathleen Jensen, and
Judy Jurgens for their support and interest in this project.
Finally, we would like to thank all those who originally designed and im-
plemented the VAX/VMS operating system, and all those who have contrib-
uted to later releases.
Lawrence Kenah
J.
Simon F. Bate
August 1983
Vlll
21 1
Contents
PARTI/Introduction 2.1.2 OtherIPLLevelsUsedfor
Synchronization 32
1 SystemOverview 3 2.1.3 IPL$_QUEUEAST 33
1. Process,Job, andImage 3 2.1.4 IPL2 34
1.1.1 Process 3 2.2 SerializedAccess 35
1.1.2 Image 5 2.2.1 ForkProcessing 35
1.1.3 Job 6 2.2.2 I/OPostprocessing 36
1. FunctionalityProvidedBy 2.3 MutualExclusionSemaphores
VAX/VMS 6 (Mutexes) 36
1.2.1 OperatingSystemKernel 6 2.3.1 LockingaMutexforRead
Access 37
1.2.3 UserInterface 9
1.2.4 InterfaceamongKernel 2.3.2 LockingaMutexforWrite
Access 38
Subsystems 1
1.3 HardwareImplementation 2.3.3 MutexWaitState 39
oftheOperatingSystem 2.3.4 UnlockingaMutex 39
Kernel 13 2.3.5 ResourceWaitState 40
1.3.1 VAXArchitectureFeatures 2.4 VAX/VMSLockManagement
ExploitedbyVMS 13 SystemServices 40
1.3.2 VAX-11 InstructionSet 14
1.3.3 ImplementationofVMSKernel
Routines 15 DynamicMemory
1.3.4 MemoryManagementand Allocation 42
AccessModes 19
1.3.5 Exceptions, Interrupts,and 3.1 AllocationStrategyand
REI 20 Implementation 42
1.3.6 ProcessStructure 21 3.1.1 AllocationofDynamic
Memory 43
1.4 OtherSystemConcepts 22
1.4.1 ResourceControl 22 3.1.2 ExampleofAllocationof
DynamicMemory 44
1.4.2 OtherSystemPrimitives 23
3.1.3 DeallocationofDynamic
1.5 LayoutofVirtualAddress Memory 45
Space 24
3.1.4 ExampleofDeallocationof
1.5.1 SystemVirtualAddress
DynamicMemory 45
Space 24
1.5.2 TheControlRegion(PI 3.1.5 Synchronization 47
Space) 26 3.1.6 GranularityofAllocation 49
1.5.3 TheProgramRegion P0 3.2 PreallocatedRequest
( Packets 50
Space) 26
3.2.1 AllocationfromOneofthe
LookasideLists 50 -
2 Synchronization
3.2.2 DeallocationtotheLookaside
Techniques 30
List 51
2.1 ElevatedIPL 30 3.3 UseofDynamicMemory 53
2.1.1 UseofIPL$_SYNCH 31 3.3.1 ProcessAllocationRegion 53
IX
1 11 1 111 11 7
Contents
3.3.2 PagedDynamicMemory 53 5 HardwareInterrupts 98
3.3.3 NonpagedDynamic
Memory 56 5. HardwareInterrupt
Dispatching 98
5.1.1 InterruptDispatching 99
5.1.2 SystemControlBlock 100
PART II/Control Mechanisms 5.2 VAX/VMSInterruptService
Routines 104
4 ConditionHandling 61 5.2. RestrictionsImposedon
InterruptService
4. OverviewoftheCondition
Routines 104
HandlingFacility 61
5.2.2 ServicingUNIBUS
4.1.1 GoalsoftheVAX-11 Condition
Interrupts 105
HandlingFacility 61
5.2.3 MASSBUSInterruptService
4.1.2 FeaturesoftheVAX-1
Routines 109
ConditionHandling
5.2.4 DR32InterruptService
Facility 62
Routine 112
4.2 GenerationofExceptions 63
5.2.5 MA780Interrupt
4.2. ExceptionsThatOriginatein
Dispatching 112
theHardware 63
5.2.6 MA780Interruptsonthe
4.2.2 ExceptionsDetectedby
VAX-11/782 114
Software 74
5.3 Connect-to-Interrupt
4.3 UniformException
Mechanism 115
Dispatching 75
4.3. EstablishingaCondition
Handler 77 6 SoftwareInterrupts 117
4.3.2 TheSearchforaCondition 6. TheSoftwareInterrupt 11
Handler 78
6.1.1 HardwareMechanismof
4.3.3 MultiplyActiveSignals 81 SoftwareInterrupts 117
4.4 ConditionHandlerAction 83
6.1.2 SoftwareInterruptService
4.4.1 ContinueorResignal 84 Routines 119
4.4.2 UnwindingtheCallStack 84 6.2 SoftwareInterruptLevelsin
4.4.3 ExampleofUnwindingtheCall VAX/VMS 119
Stack 85 6.2. MountVerification
4.4.4 PotentialInfiniteLoop 88 Cancellation 120
4.4.5 UnwindingMultiplyActive 6.2.2 ForkProcessing 121
Signals 88 6.2.3 SoftwareTimer 123
4.4.6 CorrectUseofDefaultDepth 6.2.4 I/OPostprocessing 123
inSYS$UNWIND 89
6.2.5 ReschedulingInterrupt 124
4.4.7 UnwindingAST's 92 6.2.6 ASTDeliveryInterrupt 125
4.5 Default(VMS-Supplied)
ConditionHandlers 95
7 ASTDelivery 126
4.5.1 TracebackHandlerEstablished
byImageStartup 95 7. HardwareAssistancetoAST
4.5.2 Catch-AilCondition Delivery 126
Handler 95 7.1.1 REIInstruction 126
4.5.3 HandlersUsedbyOtherAccess 7.1.2 ASTLVLProcessorRegister
Modes 96 (PR$_ASTLVL) 127