ADVANCED TOPICS IN UNIX: FILES, PROCESSES, SYSTEMS TABLE OF CONTENTS CHAPTER 1 INTRODUCTION TO UNIX 1 1.1 Overview OF UNIX 1 1.2 The File System 9 1.3 Hierarchy of Processes 11 1.4 The Kernel, User and Kernel Mode 16 1.5 UNIX as a Real-time Operating System 18 1.6 History of UNIX 20 1.7 Different versions of UNIX 21 Summary 23 References for Chapter 1 23 Exercises 24 CHAPTER 2 THE USER INTERFACE 27 2.2 Shell Commands 28 2.2.1 environment commands 29 2.2.2 file system commands 32 2.2.3 process control commands 36 2.2.4 administrative commands 39 2.2.5 utility commands 40 2.2.6 programming commands 41 2.3 The Bourne and C Shells 46 2.4 Shell Programming 49 2.5 Additional Programming Examples 52 2.6 The User Interface 55 Summary 57 Exercises 58 CHAPTER 3 INPUT AND OUTPUT 61 3.1 File Pointers 61 3.2 File Descriptors 70 3.3 Asynchronous I/O 80 3.4 Terminal I/O 81 3.5 Devices and Device Drivers 84 3.6 Use of File Pointers for Random Acess 90 3.7 Simulation of Disk Operations 92 Summary 98 References 99 Exercises 99 CHAPTER 4 THE FILE SYSTEM 103 4.1 Disk Organization 103 4.2 File Creation 106 4.3 File Access - i-nodes and i-numbers 107 4.4 Links 111 4.5 Disk Scheduling 113 4.6 Alternate Views of File System Organization 114 4.7 File Systems in SVR4 124 Summary 126 References 126 CHAPTER 5 INTRODUCTION TO PROCESSES 129 5.1 Process Creation and fork() 129 5.2 Processes 133 5.3 The Segments Associated With a Process 135 5.4 Initializing new Processes with exec() 137 5.5 The Structure of an Executable File and Sharable Text Segments 143 5.6 The Process Table 147 5.7 The Kernel Process 149 5.8 Lightweight processes 150 Summary 156 References 157 Exercises 158 CHAPTER 6 MEMORY AND PROCESS MANAGEMENT 161 6.1 Virtual Memory 161 6.2 Memory Allocation 166 6.3 Processes and the UNIX System Call Interface 171 6.4 Concurrency 173 6.5 Scheduling of Processes 175 6.6 Real-time scheduling in UNIX 180 6.7 The Reader-Writer Problem 181 6.8 The Critical Section Problem and Mutual Exclusion 184 Summary 191 References 192 Exercises 193 CHAPTER 7 INTRODUCTION TO INTERPROCESS COMMUNICATION 197 7.1 Introduction 197 7.2 Files 200 7.3 Shared FIle Pointers 206 7.4 Pipes 212 7.5 FIFOs/Named Pipes 216 7.6 Streams 219 Summary 222 References 223 CHAPTER 8 THE SYSTEM V IPC PACKAGE 225 8.1 Introduction 225 8.2 Messages 226 8.3 Semaphores 236 8.4 Shared Memory 251 Summary 270 References 271 CHAPTER 9 SIGNALS, SOCKETS, AND RPC 275 9.1 Signals 275 9.2 Sockets 284 9.3 Remote Procedure Call 298 9.4 RPC Language and the rpcgen Utility 309 9.5 Process Tracing 317 Summary 318 References 319 Exercises 320 CHAPTER 10 IPC COMPARISON 325 10.1 Comparison of ipc Methods 325 Summary 334 References 334 Exercises 335 CHAPTER 11 FAULT-TOLERANT UNIX SOFTWARE 337 11.1 Some Methods Used for Software Fault-tolerance 338 11. 2 A Method for Fault-Tolerance of General C programs 340 11.3 The Recovery Block Method in UNIX 343 11.4 N-Version Programming in UNIX 350 Summary 356 References 357 Exercises 357 CHAPTER 12 STANDARDIZATION AND THE FUTURE OF UNIX 361 12.1 Issues in Standardization 361 12.2 Issues in Real-time Performance 363 12.3 POSIX 365 12.4 Security 368 12.5 The Role of ANSI C and C++ in Future Versions of UNIX 370 References 372