ref: a351bcdccdf5a4273bc8dc3360a48fbb8b8aa9ea
dir: /toc.ms/
.nr LT 13cm .nr LL 13cm .nr PO 2cm .nr HM 2cm .nr FM 2cm .nr TM 2cm .nr FL 13cm .pl 24cm .pl 24cm .po 2cm .ll 13cm .ps +4 .ce 1 .B "Table of Contents" .ps -4 .sp .1i .RS .RE .LG .ta 1i 4i 3i .B "1. Getting started 1 .RS .ta 1i 4i 3i .NS .br 1.1. What is an Operating System? 1 .br 1.2. Entering the system 2 .br 1.3. Leaving the system 5 .br 1.4. Editing and running commands 5 .br 1.5. Obtaining help 8 .br 1.6. Using files 9 .br 1.7. Directories 12 .br 1.8. Files and data 15 .br 1.9. Permissions 17 .br 1.10. Writing a C program in Plan 9 19 .br 1.11. The Operating System and your programs 21 .br 1.12. Where are the files? 22 .br 1.13. The Shell, commands, binaries, and system calls 23 .br 1.14. The Operating System and the hardware 24 .RE .LG .ta 1i 4i 3i .B "2. Programs and Processes 26 .RS .ta 1i 4i 3i .NS .br 2.1. Processes 26 .br 2.2. Loaded programs 27 .br 2.3. Process birth and death 31 .br 2.4. System call errors 35 .br 2.5. Environment 37 .br 2.6. Process names and states 39 .br 2.7. Debugging 42 .br 2.8. Everything is a file! 44 .RE .LG .ta 1i 4i 3i .B "3. Files 48 .RS .ta 1i 4i 3i .NS .br 3.1. Input/Output 48 .br 3.2. Write games 53 .br 3.3. Read games 57 .br 3.4. Creating and removing files 57 .br 3.5. Directory entries 59 .br 3.6. Listing files in the shell 63 .br 3.7. Buffered Input/Output 66 .RE .LG .ta 1i 4i 3i .B "4. Parent and Child 72 .RS .ta 1i 4i 3i .NS .br 4.1. Running a new program 72 .br 4.2. Process creation 73 .br 4.3. Shared or not? 77 .br 4.4. Race conditions 79 .br 4.5. Executing another program 80 .br 4.6. Using both calls 81 .br 4.7. Waiting for children 82 .br 4.8. Interpreted programs 85 .RE .LG .ta 1i 4i 3i .B "5. Talking Processes 88 .RS .ta 1i 4i 3i .NS .br 5.1. Input/Output redirection 88 .br 5.2. Conventions 92 .br 5.3. Other redirections 93 .br 5.4. Pipes 94 .br 5.5. Using pipes 98 .br 5.6. Notes and process groups 102 .br 5.7. Reading, notes, and alarms 105 .br 5.8. The file descriptor bulletin board 107 .br 5.9. Delivering messages 110 .RE .LG .ta 1i 4i 3i .B "6. Networking 118 .RS .ta 1i 4i 3i .NS .br 6.1. Network connections 118 .br 6.2. Names 121 .br 6.3. Making calls 123 .br 6.4. Providing services 126 .br 6.5. System services 131 .br 6.6. Distributed computing 131 .RE .LG .ta 1i 4i 3i .B "7. Resources and Names 134 .RS .ta 1i 4i 3i .NS .br 7.1. Resource fork 134 .br 7.2. Protecting from notes 136 .br 7.3. Environment in shell scripts 138 .br 7.4. Independent children 139 .br 7.5. Name spaces 139 .br 7.6. Local name space tricks 144 .br 7.7. Device files 147 .br 7.8. Unions 148 .br 7.9. Changing the name space 150 .br 7.10. Using names 151 .br 7.11. Sand-boxing 152 .br 7.12. Distributed computing revisited 154 .RE .LG .ta 1i 4i 3i .B "8. Using the Shell 158 .RS .ta 1i 4i 3i .NS .br 8.1. Programs are tools 158 .br 8.2. Lists 158 .br 8.3. Simple things 161 .br 8.4. Real programs 164 .br 8.5. Conditions 168 .br 8.6. Editing text 171 .br 8.7. Moving files around 175 .RE .LG .ta 1i 4i 3i .B "9. More tools 178 .RS .ta 1i 4i 3i .NS .br 9.1. Regular expressions 178 .br 9.2. Sorting and searching 182 .br 9.3. Searching for changes 186 .br 9.4. AWK 189 .br 9.5. Processing data 194 .br 9.6. File systems 199 .RE .LG .ta 1i 4i 3i .B "10. Concurrency 204 .RS .ta 1i 4i 3i .NS .br 10.1. Synchronization 204 .br 10.2. Locks 207 .br 10.3. Queueing locks 214 .br 10.4. Rendezvous 221 .br 10.5. Sleep and wakeup 223 .br 10.6. Shared buffers 225 .br 10.7. Other tools 230 .RE .LG .ta 1i 4i 3i .B "11. Threads and Channels 235 .RS .ta 1i 4i 3i .NS .br 11.1. Threads 235 .br 11.2. Thread names 238 .br 11.3. Channels 242 .br 11.4. I/O in threaded programs 247 .br 11.5. Many to one communication 251 .br 11.6. Other calls 258 .RE .LG .ta 1i 4i 3i .B "12. User Input/Output 262 .RS .ta 1i 4i 3i .NS .br 12.1. Console input 262 .br 12.2. Characters and runes 265 .br 12.3. Mouse input 267 .br 12.4. Devices for graphics 270 .br 12.5. Graphics 272 .br 12.6. A graphic slider 274 .br 12.7. Keyboard input 281 .br 12.8. Drawing text 285 .br 12.9. The window system 287 .RE .LG .ta 1i 4i 3i .B "13. Building a File Server 292 .RS .ta 1i 4i 3i .NS .br 13.1. Disk storage 292 .br 13.2. The file system protocol 295 .br 13.3. Semaphores for Plan 9 301 .br 13.4. Speaking 9P 302 .br 13.5. 9P requests 305 .br 13.6. Semaphores 308 .br 13.7. Semaphores as files 311 .br 13.8. A program to make things 318 .br 13.9. Debugging and testing 322 .RE .LG .ta 1i 4i 3i .B "14. Security 326 .RS .ta 1i 4i 3i .NS .br 14.1. Secure systems 326 .br 14.2. The local machine 326 .br 14.3. Distributed security and authentication 328 .br 14.4. Authentication agents 331 .br 14.5. Secure servers 336 .br 14.6. Identity changes 339 .br 14.7. Accounts and keys 342 .br 14.8. What now? 343 .br