S I OLARIS NTERNALS Core Kernel Components i S I OLARIS NTERNALS Core Kernel Components Jim Mauro and Richard McDougall Sun Microsystems Press A Prentice Hall Title ©2000SunMicrosystems,Inc.— PrintedintheUnitedStatesofAmerica. 901SanAntonioRoad,PaloAlto,California 94303U.S.A. Allrightsreserved.Thisproductandrelateddocumentationareprotectedbycopyrightanddistributed underlicensesrestrictingitsuse,copying,distributionanddecompilation.Nopartofthisproductor relateddocumentationmaybereproducedinanyformbyanymeanswithoutpriorwrittenauthoriza- tionofSunanditslicensors,ifany. RESTRICTEDRIGHTSLEGEND:Use,duplication,ordisclosurebytheUnitedStatesGovernmentis subjecttotherestrictionsassetforthinDFARS252.227-7013(c)(1)(ii)andFAR52.227-19. TheproductdescribedinthismanualmaybeprotectedbyoneormoreU.S.patents,foreignpatents,or pendingapplications. TRADEMARKS—Sun,SunMicrosystems,theSunlogo,HotJava,Solaris,SunExpress,SunScreen, SunDocs,SPARC,SunOS,andSunSoftaretrademarksorregisteredtrademarksofSunMicrosystems, Inc.Allotherproductsorservicesmentionedinthisbookarethetrademarksorservicemarksoftheir respectivecompaniesororganizations. 10 9 8 7 6 5 4 3 2 1 ISBN0-13-022496-0 SunMicrosystemsPress A Prentice Hall Title For Traci. .. for your love and encouragement ..........................................Richard For Donna, Frankie and Dominick. All my love, always... ..........................................Jim A CKNOWLEDGEMENTS 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. • ThankyoutothesystemsengineersandtechnicalsupportstaffatSunforthe 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 slip this thing a few times) and support. vii 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 thekeypointsweremade.Theyalsoprovidedsomewonderfulexplanationsinvar- 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 [email protected] 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 - itis 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 [email protected] Cupertino, California June, 2000 x Acknowledgements