About This eBook
ePUB is an open, industry-standard format for eBooks. However, support of ePUB and its many features varies across reading devices and applications. Use your device or app settings to customize the presentation to your liking. Settings that you can customize often include font, font size, single or double column, landscape or portrait mode, and figures that you can click or tap to enlarge. For additional information about the settings and features on your reading device or app, visit the device manufacturers Web site.
Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the eBook in single-column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a Click here to view code image link. Click the link to view the print-fidelity code image. To return to the previous page viewed, click the Back button on your device or app.
The Design and Implementation of the
FreeBSD
Operating System
Second Edition
Marshall Kirk McKusick
George V. Neville-Neil
Robert N.M. Watson
Upper Saddle River, NJ Boston Indianapolis San Francisco
New York Toronto Montreal London Munich Paris Madrid
Capetown Sydney Tokyo Singapore Mexico City
UNIX is a registered trademark of X/Open in the United States and other countries. FreeBSD and the FreeBSD logo used on the cover of this book are registered and unregistered trademarks of the FreeBSD Foundation and are used by Pearson Education with the permission of the FreeBSD Foundation. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Pearson was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at or (800) 382-3419.
For government sales inquiries, please contact .
For questions about sales outside the United States, please contact
Visit us on the Web: informit.com/aw
Library of Congress Cataloging-in-Publication Data
McKusick, Marshall Kirk.
The design and implementation of the FreeBSD operating system / Marshall
Kirk McKusick, George V. Neville-Neil, Robert N. M. Watson.
pages cm
Includes bibliographical references and index.
ISBN-13: 978-0-321-96897-5 (hardcover : alk. paper)
ISBN-10: 0-321-96897-2 (hardcover : alk. paper)
1. FreeBSD. 2. Free computer software. 3. Operating systems (Computers)
I. Neville-Neil, George V. II. Watson, Robert N. M. III. Title.
QA76.774.F74M35 2014
005.432dc23 2014020072
Copyright 2015 by Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-321-96897-5
ISBN-10: 0-321-96897-2
Text printed on recycled and acid-free paper at Courier in Westford, Massachusetts.
Second Printing, November 2014
Dedication
This book is dedicated to the BSD community.
Without the contributions of that communitys members,
there would be nothing about which to write.
Contents
Preface
This book follows the earlier authoritative and full-length descriptions of the design and implementation of the 4.3BSD and 4.4BSD versions of the UNIX system developed at the University of California at Berkeley. Since the final Berkeley release in 1994, several groups have continued development of BSD. This book details FreeBSD, the system with the largest set of developers and the most widely distributed releases. Although the FreeBSD distribution includes nearly 1000 utility programs in its base system and nearly 25,000 optional utilities in its ports collection, this book concentrates almost exclusively on the kernel.
UNIX-like Systems
UNIX-like systems include the traditional vendor systems such as Solaris and HP-UX; the Linux-based distributions such as Red Hat, Debian, Suse, and Slackware; and the BSD-based distributions such as FreeBSD, NetBSD, OpenBSD, and Darwin. They run on computers ranging from smart phones to the largest supercomputers. They are the operating system of choice for most multiprocessor, graphics, and vector-processing systems, and are widely used for the original purpose of timesharing. The most common platform for providing network services (from FTP to WWW) on the Internet, they are collectively the most portable operating system ever developed. This portability is due partly to their implementation language, C [] (which is itself a widely ported language), and partly to the elegant design of the system.
Since its inception in 1969 [Distributions produced by the Computer Systems Research Group (CSRG) of the University of California at Berkeley. The Linux operating system, although developed independently of the other UNIX variants, implements the UNIX interface. Thus, applications developed to run on other UNIX-based platforms can be easily ported to run on Linux.
Berkeley Software Distributions
The distributions from Berkeley were the first UNIX-based systems to introduce many important features including the following:
Demand-paged virtual-memory support
Automatic configuration of the hardware and I/O system
A fast and recoverable filesystem
The socket-based interprocess-communication (IPC) primitives
The reference implementation of TCP/IP
The Berkeley releases found their way into the UNIX systems of many vendors and were used internally by the development groups of many other vendors. The implementation of the TCP/IP networking protocol suite in 4.2BSD and 4.3BSD, and the availability of those systems, played a key role in making the TCP/IP networking protocol suite a world standard. Even the non-UNIX vendors such as Microsoft have adopted the Berkeley socket design in their Winsock IPC interface.
The BSD releases have also been a strong influence on the POSIX (IEEE Std 1003.1) operating-system interface standard, and on related standards. Several featuressuch as reliable signals, job control, multiple access groups per process, and the routines for directory operationshave been adapted from BSD for POSIX.
Early BSD releases contained licensed UNIX code, thus requiring recipients to have an AT&T source license to be able to obtain and use BSD. In 1988, Berkeley separated its distribution into AT&T-licensed and freely redistributable code. The freely redistributable code was licensed separately and could be obtained, used, and redistributed by anyone. The final freely redistributable 4.4BSD-Lite2 release from Berkeley in 1994 contained nearly the entire kernel and all the important libraries and utilities.