Solaris Internals Core Kernel Components

  S OLARIS

  

I

NTERNALS Core Kernel Components

  S OLARIS

  I NTERNALS Core Kernel Components

  Jim Mauro and Richard McDougall

Sun Microsystems Press

  © 2000 Sun Microsystems, Inc. — Printed in the United States of America. 901 San Antonio Road, Palo Alto, California 94303 U.S.A.

  

All rights reserved. This product and related documentation are protected by copyright and distributed

under licenses restricting its use, copying, distribution and decompilation. No part of this product or

related documentation may be reproduced in any form by any means without prior written authoriza-

tion of Sun and its licensors, if any.

  

RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the United States Government is

subject to the restrictions as set forth in DFARS 252.227-7013 (c)(1)(ii) and FAR 52.227-19.

The product described in this manual may be protected by one or more U.S. patents, foreign patents, or

pending applications.

  

TRADEMARKS—Sun, Sun Microsystems, the Sun logo, HotJava, Solaris, SunExpress, SunScreen,

SunDocs, SPARC, SunOS, and SunSoft are trademarks or registered trademarks of Sun Microsystems,

Inc. All other products or services mentioned in this book are the trademarks or service marks of their

respective companies or organizations.

  10 9 8 7 6 5 4 3 2 1

ISBN 0-13-022496-0

  

Sun Microsystems Press

A Prentice Hall Title

  For Traci.

.. for your love and encouragement

.......................................... Richard

For Donna, Frankie and Dominick.

  All my love, always...

  .......................................... Jim

  CKNOWLEDGEMENTS A

  It ‘s hard to thank all people that helped us with this book. As a minimum, we owe:

  • Thanks to Brian Wong, Adrian Cockcroft, Paul Strong, Lisa Musgrave and

  Fraser Gardiner for all your help and advise for the structure and content of this book.

  • Thanks to Tony Shoumack, Phil Harman, Jim Moore, Robert Miller, Martin Braid, Robert Lane, Bert Beals, Magnus Bergman, Calum Mackay, Allan Packer, Magnus Bergman, Chris Larson, Bill Walker, Keith Bierman, Dan Mick and Raghunath Shenbagam for helping to review the material.
  • A very special thanks to David Collier-Brown, Norm Shulman, Dominic Kay,

  Jarod Jenson, Bob Sneed, and Evert Hoogendoorn for painstaking page by page reviews of the whole book.

  • Our thanks to the engineers in the Solaris business unit - Jim Litchfield,

  Michael Shapiro, Jeff Bonwick, Wolfgang Thaler, Bryan Cantrill, Roger Faulker, Andy Tucker, Casper Dik, Tim Marsland, Andy Rudoff, Greg Onufer, Rob Gingell, Devang Shah, Deepankar Das, Dan Price and Kit Chow for their advise and guidance. We’re quite sure there are others, and we apolo- gize up front to those whose names we have missed.

  • Thank you to the systems engineers and technical support staff at Sun for the corrections and suggestions along the way.
  • Thanks to Lou Marchant - for the endless search for engine pictures, and

  Dwayne Schumate at Lotus Cars USA for coordinating permission to use the images of the Lotus V8 engine.

  • Thanks to the folks at Prentice Hall - Greg Doench for his patience (we did
viii Acknowledgements

  • Thanks to our enduring copy editor, Mary Lou Nohr for her top notch edito- rial work and style suggestions.

  Without your help, this book wouldn’t be what it is today.

  From Jim:

  I wish to personally acknowledge Jeff Bonwick and Andy Tucker of Solaris ker- nel engineering. They demonstrated great patience in clarifying things that were complex to me but second nature to them. They answered innumerous emails, which contributed significantly to the accuracy of the text, as well as insuring all the key points were made. They also provided some wonderful explanations in var- ious areas of the source code, which definitely helped.

  Roger Faulkner and Jim Litchfield, also of Solaris kernel engineering, deserve and additional note of thanks for their efforts and time. Thanks to Nobel Shelby and Casey Palowitch for reviewing sections of the manuscript and providing insightful feedback and suggestions. I owe a debt of gratitude to Hal Stern that goes way beyond his support for this work. His mentoring, guidance and friendship over the years have had a profound impact on my development at Sun.

  Last, but certainly not least, comes the family acknowledgment. This may appear cliche’, as every technical book I’ve ever seen recognizes the writers family in the acknowledgements section. Well, there’s a very good reason for that. There are only 24 hours in a day and 7 days in a week. That doesn’t change just because you decide to write a book, nor do the other things that demand your time, like your job, your house, your lawn, etc., all of a sudden become less demanding. So the ones that end up getting the short end of the stick is invariably your family. Thus, my deepest gratitude goes to my wife Donna, and my sons, Frankie and Dominick. Without their love, sacrifice and support, I would not have been able to complete this work. Thanks guys, I’m back now (of course, there is that pesky lit- tle matter of the updated version for Solaris 8...).

  Jim Mauro jim.mauro@eng.sun.com

  Green Brook, New Jersey June, 2000 Acknowledgements ix

  From Richard:

  I would like to thank Adrian Cockcroft and Brian Wong for first giving me the opportunity to join their engineering group in 1995, working from my remote out- post in Australia. Their leadership and guidance has meant a lot to me during my career at Sun.

  Thank you to our friends, visitors and family who seemingly understood for 2 years when I abstained from many invites to dinners, day trips and fun events cit- ing “when the books done...”. Yes - it is done now!

  And yes, a special thank you to my wife Traci, who provided a seemingly end- less amount of encouragement and personal sacrifice along the way. This project would have been forever unfinished without her unquestionable co-operation and support.

  Richard McDougall rmc@eng.sun.com

  Cupertino, California June, 2000 x

Acknowledgements

  REFACE P

  The internals of the UNIX kernel is fairly well documented, most notably by Good- heart and Cox These texts have become a common source of reference information for those who want to bet- ter understand the internals of UNIX. However little has been written about the specifics of the Solaris kernel.

  The paucity of Solaris specific information led us to create our own reference material. As we published information through white papers, magazine columns, and tutorials, the number of folks expressing interest motivated us to produce a complete work that discussed Solaris exclusively.

  About This Book

  This book is about the internals of Sun’s Solaris Operating Environment. The rapid growth of Solaris has created a large number of users, software developers, systems administrators, performance analysts, and other members of the techni- cal community, all of whom require in-depth knowledge about the environment in which they work.

  Since the focus of this book is the internals of the Solaris kernel, the book pro- vides a great deal of information on the architecture of the kernel and the major data structures and algorithms implemented in the operating system. However, rather than approach the subject matter from a purely academic point of view, we xii Preface

  tained herein. Thus, we have emphasized the methods and tools that can be used on a Solaris system to extract information that otherwise is not easily accessible with the standard bundled commands and utilities. We want to illustrate how you can apply this knowledge in a meaningful way, as your job or interest dictates.

  To maximize the usefulness of the text, we included specific information on Solaris versions 2.5.1, 2.6, and Solaris 7. We cover the major Solaris subsystems, including memory management, process management, threads, files, and file sys- tems. We do not cover details of low-level I/O, device drivers, STREAMS, and net- working. For reference material on these topics, see “Writing Device Drivers” the “STREAMS Programming Guide”

  The material included in this book is not necessarily presented at an introduc- tory level, although whenever possible we begin discussing a topic with some con- ceptual background information. We assume that you have some familiarity with operating systems concepts and have used a Unix-based operating system. Some knowledge of the C programming language is useful but not required.

  Because of the variety of hardware platforms on which Solaris runs, it is not practical to discuss the low-level details of all the different processors and architec- tures, so our hardware focus, when detail is required, is admittedly UltraS- PARC-centric. This approach makes the most sense since it represents the current technology and addresses the largest installed base. In general, the concepts put forth when detail is required apply to other processors and platforms supported. The differences are in the specific implementation details, such as per-processor hardware registers.

  Throughout the book we refer to specific kernel functions by name as we describe the flow of various code segments. These routines are internal to the oper- ating system and should not be construed as, or confused with, the public inter- faces that ship as part of the Solaris product line—the systems calls and library interfaces. The functions referenced throughout the text, unless explicitly noted, are private to the kernel and not callable or in any way usable by application pro- grams.

  Intended Audience

  We hope that this book will serve as a useful reference for a variety of technical staff members working with the Solaris Operating Environment.

  • Application developers can find information in this book about how Solaris implements functions behind the application programming interfaces. This information helps developers understand performance, scalability, and imple-
How This Book Is Organized xiii

  mentation specifics of each interface when they develop Solaris applications. The system overview section and sections on scheduling, interprocess commu- nication, and file system behavior should be the most useful sections.

  • Device driver and kernel module developers of drivers, STREAMS mod- ules, loadable system calls, etc., can find herein the general architecture and implementation theory of the Solaris Operating Environment. The Solaris kernel framework and facilities portions of the book (especially the locking and synchronization primitives chapters) are particularly relevant.
  • Systems administrators, systems analysts, database administrators,

  and ERP managers responsible for performance tuning and capacity plan-

  ning can learn about the behavioral characteristics of the major Solaris sub- systems. The file system caching and memory management chapters provide a great deal of information about how Solaris behaves in real-world environ- ments. The algorithms behind Solaris tunable parameters (which are detailed in the appendix) are covered in depth throughout the book.

  • Technical support staff responsible for the diagnosis, debugging and sup- port of Solaris will find a wealth of information about implementation details of Solaris. Major data structures and data flow diagrams are provided in each chapter to aid debugging and navigation of Solaris Systems.
  • System users who just want to know more about how the Solaris kernel works will find high-level overviews at the start of each chapter.

  In addition to the various technical staff members listed above, we also believe that members of the academic community will find the book of value in studying how a volume, production kernel implements major subsystems and solves the problems inherent in operating systems development.

  How This Book Is Organized

  We organized Solaris Internals into several logical parts, each part grouping sev- eral chapters containing related information. Our goal was to provide a building block approach to the material, where later sections build on information provided in earlier chapters. However, for readers familiar with particular aspects of operat- ing systems design and implementation, the individual parts and chapters can stand on their own in terms of the subject matter they cover.

  • Part One: Introduction •
xiv Preface

  • Part Three: Processes, Threads, and IPC

  Solaris Source Code

  In February 2000, Sun announced the availability of Solaris source. This book pro- vides the essential companion to the Solaris source and can be used as a guide to the Solaris kernel framework and architecture.

  It should also be noted that the source available from Sun is Solaris 8 source. Although this book covers Solaris versions up to and including Solaris 7, almost all of the material is relevant to Solaris 8.

  Updates and Related Material

  To complement this book, we created a Web site where we will place updated mate- rial, tools we refer to, and links to related material on the topics covered. The Web site is available at http://www.solarisinternals.com Notational Conventions xv

  We will regularly update the Web site with information about this text and future work on Solaris Internals. We will place information about the differences between Solaris 7 and 8 at this URL, post any errors that may surface in the current edi- tion, and share reader feedback and comments and other bits of related informa- tion.

  Commands you type within an example.

  $ Bourne shell and Korn shell superuser prompt

  C shell prompt machine_name% C shell superuser prompt machine_name# Bourne shell and Korn shell prompt

  Shell Prompt

  A major page fault occurs when… Table P-2 Command Prompts

  AaBbCc123 New terms as they are introduced.

  $ vmstat r b w swap free re mf 0 0 0 464440 18920 1 13

  AaBbCc123

  Notational Conventions

  AaBbCc123(2) Manual pages. Please see vmstat(1M).

  The vmstat command. The <sys/proc.h> header file. The proc structure. AaBbCc123() Function names. page_create_va()

  AaBbCc123 Command names, file names, and data struc- tures.

  Typeface or Symbol Meaning Example

  Table P-1 Typographic Conventions

  .

  # The crash utility prompt crash > xvi Preface

  A Note from the Authors

  We certainly hope that you get as much out of reading Solaris Internals as we did from writing it. We welcome comments, suggestions, and questions from readers. We can be reached at: richard.mcdougall@Eng.Sun.COM jim.mauro@Eng.Sun.COM

  

  

  

  

  

  

  

  xviii

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  xix

  

  

  

  

  

  

  

  

  

  

  

  

  

  xx

  

  

  

  

  

  

  

  

  

  

  

  

  xxi

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  xxii

  

  

  

  

  

  

  

  

  

  xxiii

  

  

  

  

  

  

  

  

  

  

  

  

  xxiv

  

  

  

  

  

  

  

  

  

  

  

  

  

  xxv

  

  

  

  

  

  

  

  

  

  

  

  xxvi

  

  

  

  

  

  

  

  

  

  

  

  

  

  xxvii

  

  

  

  

  

  

  

  

  

  

  

  

  xxviii

  

  

  

  

  

  

  

  

  

  

  

  

  

  xxix

  xxx

  L

Figure 2.2 Process, Interrupt, and Kernel Threads .......................................... 31Figure 3.1 Parallel Systems Architectures ........................................................ 62Figure 2.12 Time-of-Day Clock on SPARC Systems .......................................... 58Figure 2.11 Solaris 2.5.1 Callout Tables .............................................................. 52Figure 2.10 Solaris 2.6 and Solaris 7 Callout Tables........................................... 48Figure 2.9 System Call Execution ..................................................................... 45Figure 2.8 The Kernel System Call Entry ( sysent) Table ................................ 44Figure 2.7 Interrupt Table on sun4u Architectures ......................................... 42Figure 2.6 Interrupt Thread Global Priorities .................................................... 41Figure 2.5 Handling Interrupts with Threads .................................................... 40Figure 2.4 Solaris Interrupt Priority Levels ......................................................... 38Figure 2.3 UltraSPARC I & II Trap Table Layout................................................ 35Figure 2.1 Switching into Kernel Mode via System Calls ............................... 28

  IST OF F

Figure 1.9 The Solaris Device Tree .................................................................... 25

  VFS/Vnode Architecture ................................................................. 24

  

Figure 1.7 Files Organized in a Hierarchy of Directories ................................ 22Figure 1.6 Address Spaces, Segments, and Pages........................................ 20Figure 1.5 Global Thread Priorities.................................................................... 16Figure 1.4 Two-Level Thread Model................................................................. 15Figure 1.3 Kernel Threads, Processes, and Lightweight Processes ............... 15Figure 1.2 Core Kernel and Loadable Modules ............................................. 13Figure 1.1 Solaris Kernel Components ............................................................. 12

  IGURES

Figure 3.2 Atomic Instructions for Locks on SPARC ........................................ 65

  xxxii

Figure 5.12 Anonymous Memory Data Structures ......................................... 154Figure 5.5 SPARC sun4u 32- and 64-Bit Process Address Space................. 134Figure 5.6 Intel x86 Process Address Space .................................................. 135Figure 5.7 The Address Space ........................................................................ 137Figure 5.8 Virtual Address Space Page Fault Example ............................... 142Figure 5.9 Segment Interface......................................................................... 144Figure 5.10 The seg_vn Segment Driver Vnode Relationship ....................... 149Figure 5.11 Shared Mapped Files..................................................................... 151Figure 5.13 Anon Slot Initialized to Virtual Swap Before Page-out ............... 160Figure 5.3 Process Virtual Address Space ..................................................... 131Figure 5.14 Physical Swap After a Page-out Occurs ..................................... 161Figure 5.15 Swap Allocation States ................................................................. 163Figure 5.16 Watchpoint Data Structures ......................................................... 167Figure 5.17 The Page Structure ........................................................................ 168Figure 5.18 Locating Pages by Their Vnode/Offset Identity ......................... 169Figure 5.19 Machine-Specific Page Structures: sun4u Example .................. 170Figure 5.20 Contiguous Physical Memory Segments..................................... 171Figure 5.21 Physical Page Mapping into a 64-Kbyte Physical Cache......... 175Figure 5.4 SPARC 32-Bit Shared Kernel/Process Address Space ................ 133Figure 5.2 Solaris Virtual Memory Layers ....................................................... 130Figure 3.4 Solaris Locks — The Big Picture ....................................................... 70Figure 3.13 Solaris 2.5.1 and Solaris 2.6 Turnstiles .............................................. 93Figure 3.5 Solaris 7 Adaptive and Spin Mutex ................................................ 74Figure 3.6 Solaris 2.6 Mutex ............................................................................... 79Figure 3.7 Solaris 2.5.1 Adaptive Mutex........................................................... 80Figure 3.8 Solaris 2.5.1 Mutex Operations Vectoring ..................................... 80Figure 3.9 Solaris 7 Reader/Writer Lock ........................................................... 83Figure 3.10 Solaris 2.6 Reader/Writer Lock ........................................................ 86Figure 3.11 Solaris 2.5.1 RW Lock Structure ....................................................... 86Figure 3.12 Solaris 7 Turnstiles .............................................................................. 91Figure 3.14 Solaris 2.5.1 and 2.6 Turnstiles.......................................................... 94Figure 5.1 Solaris Virtual-to-Physical Memory Management ...................... 127Figure 3.15 Kernel Semaphore ........................................................................... 99Figure 3.16 Sleep Queues in Solaris 2.5.1, 2.6, and 7 ..................................... 101Figure 4.1 Core Kernel Directory Hierarchy .................................................. 105Figure 4.2 Bootblock on a UFS-Based System Disk ....................................... 108Figure 4.3 Boot Process ................................................................................... 110Figure 4.4 Loading a Kernel Module ............................................................. 117Figure 4.5 Module Control Structures ............................................................ 118Figure 4.6 Module Operations Function Vectoring ..................................... 121Figure 5.22 Two-Handed Clock Algorithm...................................................... 180

  xxxiii

  Flow to Object-Specific Routine ........................................ 300

Figure 8.9 PID Structure ................................................................................... 278Figure 8.10 Process Open File Support Structures .......................................... 284Figure 8.11 The Process, LWP, and Kernel Thread Structure Linkage........... 290Figure 8.12 Process Creation ........................................................................... 294

  

  exec

  Flow ....................................................................................... 299

  exec

Figure 8.15 Initial Process Stack Frame............................................................ 301Figure 8.7 Process State Diagram .................................................................. 275Figure 8.16 procfs Kernel Process Directory Entries ........................................ 310Figure 8.17 procfs Directory Hierarchy ............................................................ 311Figure 8.18 procfs Data Structures................................................................... 312Figure 8.19 procfs File Open ............................................................................. 313Figure 8.20 procfs Interface Layers.................................................................. 315Figure 8.21 Signal Representation in k_sigset_t Data Type ........................... 330Figure 8.22 Signal-Related Structures .............................................................. 332Figure 8.23 High-Level Signal Flow ................................................................... 339Figure 8.24 Process Group Links ....................................................................... 344Figure 8.8 Process Lineage Pointers............................................................... 277Figure 8.6 Process Virtual Address Space ..................................................... 271Figure 5.24 Scan Rate Interpolation with the Priority Paging Algorithm...... 185Figure 6.4 Objects, Caches, Slabs, and Pages of Memory ........................ 219Figure 5.25 Page Scanner Architecture.......................................................... 188Figure 5.26 Role of the HAT Layer in Virtual-to-Physical Translation ............. 190Figure 5.27 UltraSPARC-I and -II MMUs ............................................................ 194Figure 5.28 Virtual-to-Physical Translation ....................................................... 195Figure 5.29 UltraSPARC-I and -II Translation Table Entry (TTE)........................ 196Figure 5.30 Relationship of TLBs, TSBs, and TTEs............................................... 197Figure 6.1 Solaris 7 64-Bit Kernel Virtual Address Space............................... 207Figure 6.2 Kernel Address Space ................................................................... 211Figure 6.3 Different Levels of Memory Allocation ........................................ 213Figure 6.5 Slab Allocator Internal Implementation ...................................... 224Figure 8.5 The Process Structure and Associated Data Structures ............ 270Figure 7.1 Process Private and Shared Mappings (

  /bin/sh Example) .... 244

Figure 7.2 MemTool GUI: File System Cache Memory................................. 249Figure 7.3 MemTool GUI: Process Memory ................................................... 251Figure 7.4 MemTool GUI: Process/File Matrix ................................................ 253Figure 8.1 Process Execution Environment.................................................... 263Figure 8.2 The Multithreaded Process Model ............................................... 266Figure 8.3 ELF Object Views............................................................................ 268Figure 8.4 Conceptual View of a Process .................................................... 269Figure 8.25 Process and Session Structure Links.............................................. 346

  xxxiv

Figure 12.2 Traditional File Access Scheme .................................................... 531Figure 10.7 Solaris Doors Structures .................................................................. 471Figure 10.8 door_call() Flow with Shuttle Switching ....................................... 476Figure 11.1 File-Related Structures ................................................................... 484Figure 11.2 Kernel File I/O Interface Relationships ......................................... 489Figure 11.3 File Read with read(2) ................................................................... 509Figure 11.4 Memory Mapped File I/O ............................................................. 510Figure 12.1 Block- and Extent-Based Allocation ............................................ 527Figure 12.3 File System Metadata Logging .................................................... 535Figure 10.5 POSIX Message Queue Structures ............................................... 466Figure 13.1 Solaris File System Framework ....................................................... 542Figure 13.2 The Vnode Object ......................................................................... 544Figure 13.3 The vfs Object ................................................................................ 551Figure 13.4 The Mounted vfs List..................................................................... 555Figure 13.5 The read()/write() vs. mmap() Methods for File I/O.............. 558Figure 13.6 Solaris 2.3 Name Cache................................................................ 570Figure 13.7 Solaris 2.4 DNLC.............................................................................. 572Figure 14.1 UFS Directory Entry Format ............................................................ 580Figure 10.6 Solaris Doors .................................................................................... 470Figure 10.4 POSIX Named Semaphores .......................................................... 463Figure 9.2 Solaris Scheduling Classes and Priorities...................................... 354Figure 9.11 Condition Variable ........................................................................ 405Figure 9.3 Scheduling Class Data Structures ................................................ 362Figure 9.4 tsproc Structure Lists .................................................................... 371Figure 9.5 Solaris Dispatch Queues................................................................ 374Figure 9.6 Setting RT Priorities .......................................................................... 377Figure 9.7 Setting a Thread’s Priority Following fork()............................... 379Figure 9.8 Priority Adjustment with ts_slpret............................................. 384Figure 9.9 Kernel Thread Queue Insertion..................................................... 389Figure 9.10 Thread Preemption Flow ............................................................... 400Figure 9.12 Sleep/Wake Flow Diagram ........................................................... 407Figure 10.3 Process Address Space with mmap(2)........................................ 461Figure 9.13 Solaris 2.5.1 and Solaris 2.6 Sleep Queues................................... 408Figure 9.14 Solaris 7 Sleep Queues .................................................................. 409Figure 9.15 Setting a Thread’s Priority in ts_sleep() ................................... 412Figure 9.16 Two-Level Threads Model ............................................................. 415Figure 9.17 CPU Structure and Major Links...................................................... 421Figure 9.18 Processor Partition (Processor Set) Structures and Links ............ 427Figure 10.1 Shared Memory: ISM versus Non-ISM........................................... 441Figure 10.2 System V Message Queue Structures .......................................... 456Figure 14.2 Unix Directory Hierarchy ................................................................ 580

  xxxv

Figure 14.4 UFS Layout....................................................................................... 582Figure 14.5 The UFS inode Format .................................................................... 584Figure 0.1 Default File Allocation in 16-Mbyte Groups ................................ 586Figure 14.6 The UFS File System......................................................................... 591Figure 14.7 ufs_read()........................................................................................ 594Figure 14.8 ufs_write()........................................................................................ 596Figure 14.9 The UFS inode ................................................................................. 597Figure 14.10 UFS Idle Queue ............................................................................... 599Figure 15.1 The Old-Style Buffer Cache .......................................................... 602Figure 15.2 The Solaris Page Cache ................................................................ 603

  

  VM Parameters That Affect File Systems ..................................... 613

Figure 15.4 In-Memory Inodes (Referred to as the “Inode Cache”) ........... 618

   Kernel Address Space and Segments ......................................... 633 Solaris 7 sun4u 64-Bit Kernel Address Space ............................... 636 Solaris 7 sun4u 32-Bit Kernel Address Space ............................... 637 Solaris 7 sun4d 32-Bit Kernel Address Space ............................... 638 Solaris 7 sun4m 32-Bit Kernel Address Space .............................. 639 Solaris 7 x86 32-Bit Kernel Address Space................................ 640

  xxxvi

  

L

  IST OF T ABLES

   Solaris Release History........................................................................ 6 File Systems Available in Solaris File System Framework .............. 24 Solaris UltraSPARC I & II Traps .......................................................... 32 UltraSPARC Software Traps ............................................................. 36 System Call Latency ........................................................................ 47 Hardware Considerations and Solutions for Locks....................... 67 System Directories .......................................................................... 104 Module Management Interfaces ................................................ 120 Module Install Routines.................................................................. 122 Maximum Heap Sizes..................................................................... 136 Solaris 7 Address Space Functions ............................................... 139 Solaris 7 Segment Drivers............................................................... 145 Solaris 7 Segment Driver Methods................................................ 146 mmap Shared Mapped File Flags ............................................... 151 Anon Layer Functions .................................................................... 155 Swap Space Allocation States ..................................................... 157 Swap Accounting Information ..................................................... 164 Watchpoint Flags ........................................................................... 165 Solaris 7 Page Level Interfaces ..................................................... 172 Page Sizes on Different Sun Platforms.......................................... 174 Solaris Page Coloring Algorithms ................................................. 177 Page Scanner Parameters............................................................ 186 swapfs Cluster Sizes....................................................................... 189 Memory Scheduler Parameters ................................................... 190 Machine-Independent HAT Functions ........................................ 191

  xxxviii

   Solaris 7 UltraSPARC-I and -II TSB Sizes .......................................... 198 UltraSPARC-I and -II Address Space Identifiers ........................... 198 UltraSPARC MMU Protection Modes............................................ 199 UltraSPARC-I and -II MMU Traps.................................................... 200 Sample TLB Miss Data from a SuperSPARC Study....................... 201 Large-Page Database Performance Improvements ................ 203 Virtual Memory Data Structures ................................................... 208 Kernel Loadable Module Allocation ........................................... 209 Solaris 7 Kernel Memory Segment Drivers ................................... 212 Solaris 7 Resource Map Allocator Functions from <sys/map.h>215 Solaris 7 segkmem Segment Driver Methods.............................. 216 Solaris 7 Kernel Page Level Memory Allocator ........................... 217 Performance Comparison of the Slab Allocator ....................... 218 Solaris 7 Slab Allocator Interfaces from < sys/kmem.h> ............ 222 Slab Allocator Callback Interfaces from < sys/kmem.h>.......... 222 General-Purpose Memory Allocation.......................................... 223 Magazine Sizes ............................................................................... 226 Kernel Memory Allocator Parameters ......................................... 227 kmastat Columns ........................................................................... 230 Slab Allocator Per-Cache Statistics ............................................. 230 Kernel Memory Debugging Parameters ..................................... 232 Solaris Memory Monitoring Commands ...................................... 239 Statistics from the vmstat Command .......................................... 242 MemTool Utilities ............................................................................. 246 prtmem Rows ................................................................................. 246 memps Columns ............................................................................ 248 MemTool Buffer Cache Fields....................................................... 250 MemTool Process Table Field........................................................ 251 Statistics from the memstat Command ...................................... 255 Credentials Structure Members.................................................... 273 Kernel Thread and Process States................................................ 288 procfs Control Messages............................................................... 316 lrusage Fields .................................................................................. 318 Microstates ..................................................................................... 322 Microstate Change Calls into new_mstate

  ()............................ 323 Signals.............................................................................................. 325 UltraSPARC Traps and Resulting Signals ...................................... 329 sigqueue Structure......................................................................... 331 siginfo Structure .............................................................................. 333 Scheduling Class Priority Ranges.................................................. 351 Timeshare and Interactive Dispatch Table ................................. 363 Scheduling-Class-Specific Data Structure Members ................. 370 Sources of Calls to swtch()............................................................ 400 CPU State Flags .............................................................................. 424

  xxxix

  

  IPC ID Structure Names ................................................................. 431 ipc_perm Data Structure .............................................................. 431 Shared Memory APIs...................................................................... 434 shmid_ds Data Structure ............................................................... 435 Shared Memory Tunable Parameters.......................................... 436 Semaphore Kernel Tunables......................................................... 445 Message Queue Tunable Parameters......................................... 452 POSIX IPC Interfaces ...................................................................... 459 Solaris Semaphore APIs ................................................................. 462 Solaris Doors Interfaces.................................................................. 469 Solaris File Types.............................................................................. 482 File Descriptor Limits ....................................................................... 485 Standard I/O Functions ................................................................. 491 File Streams ..................................................................................... 493 File I/O System Calls ....................................................................... 494 File Data Integrity Flags ................................................................. 498 Solaris 7 mmap Flags from <sys/mman.h> .................................. 511 Solaris 7 mmap Protection Options from <sys/mman.h> .......... 512 Large File Extended 64-bit Data Types ........................................ 521 File Systems Available in the Solaris File System Framework...... 525 Third-Party File Systems Available for Solaris................................ 525 File System Structure and Allocation ........................................... 528 File System Capacities................................................................... 529 Space Efficiency for 1,000 Files with Different File/Block Sizes .. 530 File System Block Size Support ...................................................... 531 File System ACL Support ................................................................ 532 File System Logging Characteristics............................................. 533 File System Grow/Shrink Support .................................................. 537 Summary of File System Features ................................................. 538 Solaris 7 vnode Types from sys/vnode.h ...................................... 545 Solaris 7 Vnode Interface Methods from sys/vnode.h............... 546 Solaris 7 vnode Paging Functions from vm/pvn.h...................... 549 Solaris7 Paged I/O Functions from sys/bio.h ............................... 550 Solaris 7 vfs Interface Methods from sys/vfs.h ........................... 551 Solaris 7 vfs Support Functions from <sys/vfs.h> ........................ 554 Solaris 7 vfs Support Functions .................................................... 555 seg_map Functions Used by the File Systems ............................. 561 Architecture-Specific Sizes of Solaris 7 seg_map Segment....... 562 Statistics from the seg_map Segment Driver .............................. 564 Functions for Cached Access to Files from Within the Kernel .. 567 Path-Name Traversal Functions from <sys/pathname.h> ......... 568 Solaris DNLC Changes ................................................................... 569 Solaris 7 DNLC Functions from sys/dnlc.h .................................... 572 Parameters That Affect fsflush ................................................. 576

  xl

   Paging Counters from the memstat Command ........................ 610 DNLC Default Sizes......................................................................... 616 System V IPC - Shared Memory.................................................... 623 System V IPC - Semaphores.......................................................... 623 System V IPC - Message Queues ................................................. 624 Virtual Memory ............................................................................... 624 File System and Page Flushing Parameters................................. 626 Swapfs Parameters ........................................................................ 628 Miscellaneous Parameters ............................................................ 628 Process and Dispatcher (Scheduler) Parameters ...................... 630 STREAMS Parameters ..................................................................... 631

  L

  IST OF H EADER F

  ILES