TY - BOOK AU - Card,Rémy AU - Dumas,Eric AU - Mével,Franck TI - The Linux Kernel book / SN - 0471981419 PY - 1998/// CY - Chichester PB - John Wiley and Sons KW - SISTEMAS OPERATIVOS KW - LINUX N1 - CONTENIDO Chapter 1 LINUX: Introduction 1 1.1 History 1 1.2 Description of Linux and its functionality 2 Chapter 2 General overview 7 2.1 Different types of operating system 7 2.2 The role of the operating system 8 2.2.1 Virtual Machine 8 2.2.2 Sharing the processor 9 2.2.3 Memory management 10 2.2.4 Resource management 10 2.2.5 Communication hub of the machine 10 2.3 General operating system structure 11 2.4 Kernel mode, User mode 12 2.4.1 Principle 12 2.4.2 System Calls 13 Chapter 3 Development with Linux 15 3.1 GNU products 15 3.1.2 GNU tools 16 3.2 Development tools 17 3.2.1 The different phases of compilation 17 3.2.2 gcc 19 3.2.3 Debugger 20 3.2.4 strace 20 3.2.5 make 22 3.3 Format of executables 22 3.3.1 a.out: the original! 22 3.3.2 ELF 23 3.4 Libraries 25 3.4.1 Library functionality 25 3.4.2 Use of libraries 26 3.5 Organisation of kernel source programs 26 3.5.1 Kernel 26 3.5.2 Header files 28 3.6 Kernel operation 28 3.6.1 System calls 28 3.6.2 Utility functions 33 3.6.3 Manipulation of address space 33 Chapter 4 Processes 37 4.1.1 The idea of process 37 4.1.2 Process states 37 4.1.3 Attributes of a process 38 4.1.4 Process identifiers 39 4.1.5 Process creation 39 4.1.6 Process Groups 41 4.1.7 Sessions 41 4.1.8 Multi-programming 42 4.2 Basic system calls 42 4.2.1 Creation of processes 42 4.2.2 Termination of current process 43 4.2.3 Waiting for the termination of a child process 44 4.2.4 Reading attributes of the current process 47 4.2.5 Modification of attributes 48 4.2.6 Compatibility information 49 4.2.7 Limits 51 4.2.8 Groups of processes 52 4.2.9 Sessions 53 4.2.10 Program execution 54 4.3 Advanced concepts 55 4.3.1 Scheduling 55 4.3.2 Personalities 56 4.3.3 Cloning 57 4.4 Complementary system calls 58 4.4.1 Changing 'personality' 58 4.4.2 Schedule modification 58 4.4.3 Process priorities 61 4.4.4 Control of the execution of a process 62 4.4.5 Cloning 64 4.5 General introduction to implementation 69 4.5.1 Table of processes 69 4.5.2 Processor registers 76 4.5.3 Process synchronisation 78 4.5.4 Timers 79 4.5.5 Execution domains 80 4.5.6 Formats of executable files 81 4.6 Detailed description of implementation 82 4.6.1 Internal functions 82 4.6.2 Implementation of system calls 85 Chapter 5 Signals 91 5.1.2 Definition of signals 91 5.1.3 List of signals 92 5.1.4 Display of signals 95 5.2 Basic system calls 96 5.2.1 Sending a signal 96 5.2.2 Signal handling 98 5.2.3 Waiting for the signal 99 5.3 Advanced concepts 101 5.3.1 Interruptible system calls 101 5.3.2 Re-entrant functions 101 5.3.3 Signal groups 101 5.4 Complementary system calls 102 5.4.1 Advanced signal management 102 5.4.2 Alarm management 107 5.4.3 The signal SIGCHLD 112 5.5 General overview of implementation 113 5.5.1 Data structures 113 5.6 Detailed description of implementation 116 5.6.1 Library functions 116 5.6.2 System calls 116 Chapter 6 Filesystems 121 6.1.1 Organisation of files 121 6.1.2 File types 122 6.1.3 File linkages 123 6.1.4 File attributes 124 6.1.5 Input and Output primitives 125 6.1.6 Input and Output descriptors 126 6.2 Basic system calls 126 6.2.1 File inputs and outputs 126 6.2.2 Manipulation of files 133 6.2.3 Management of directories 140 6.2.4 Symbolic links 148 6.3 Advanced concepts 149 6.3.1 inodes 149 6.3.2 Input/output descriptors 150 6.3.3 Sharing descriptors 151 6.3.4 Locking of files 154 6.3.5 Mounting filesystems 154 6.3.6 Disk quotas 155 6.4 Complementary system calls 156 6.4.1 Reading and writing to several buffers 156 6.4.2 Duplication of input/output descriptors 157 6.4.3 File attributes 158 6.4.4 Dates associated with files 162 6.4.5 Properties of open files 163 6.4.6 Control of the process bdflush 164 6.4.7 Locking 166 6.4.8 Mounting of filesystems 168 6.4.9 Information on filesystems 170 6.4.10 Information on filesystem types supported 171 6.4.11 Manipulation of disk quotas 171 6.5 General overview of implementation 173 6.5.1 The virtual filesystem 173 6.5.2 VFS structures 176 6.5.3 Generic operations 188 6.6 Detailed description of implementation 196 6.6.1 Internal functions of VFS 196 6.6.2 The buffer cache 210 6.6.3 Implementation of system calls 219 6.6.4 Filesystems supported 228 6.6.5 Implementation of the filesystem Ext2 229 6.6.6 Implementation of the filesystem/proc 242 Chapter 7 Input/output 249 7.2 System calls 250 7.2.1 System calls creation of a special file 250 7.2.2 Input and output in devices 252 7.2.3 Multiplexing inputs and outputs 252 7.2.4 Control over devices 254 7.3 General overview of implementation 255 7.3.1 Peripherals supported by the kernel 255 7.3.2 Disk input and output 255 7.4 Detailed description of implementation 256 7.4.1 Management of supported devices 256 7.4.2 Input/outputs to disk 257 7.4.3 Input/output on peripheral devices in block mode 258 7.4.4 Multiplexing input/output 258 7.4.5 Interrupt management 261 7.4.6 Management of DMA channels 261 7.4.7 Access to input/output ports 262 7.4.8 Example of a device in block mode: the disk memory 263 7.4.9 Example of a peripheral in block mode: the printer 265 Chapter 8 Memory management 269 8.1.1 Process address space 269 8.1.2 Memory allocation 271 8.2 Basic system calls 272 8.2.1 Changing the size of data segments 272 8.2.2 Memory allocation and release functions 272 8.3 Advanced concepts 273 8.3.1 Memory regions 273 8.3.2 Memory protection 274 8.3.3 Locking of memory zones 275 8.3.4 Mapping of files in memory 276 8.3.5 Swap devices 276 8.4 Complementary system calls 277 8.4.1 Protection of memory pages 277 8.4.2 Locking memory pages 278 8.4.3 Mapping to memory 279 8.4.4 Synchronisation of memory pages 282 8.4.5 Management of swap device 283 8.5 General overview of implementation 285 8.5.1 Management of page tables 285 8.5.2 Management of memory pages 290 8.5.3 Memory allocation for the kernel 291 8.5.4 Process address spaces 295 8.5.5 Non-contiguous memory allocation for the kernel 300 8.5.6 Management of swap 300 8.5.7 Memory operations 303 8.6 Detailed description of implementation 304 8.6.1 Allocation for the kernel 304 8.6.2 Management of page tables 305 8.6.3 Management of memory regions 308 8.6.4 Processing of traps 309 8.6.5 Access to the process address space 310 8.6.6 Modifying memory regions 311 8.6.7 Creation and deletion of address space 315 8.6.8 Mapping of files into memory 315 8.6.9 Management of swap 318 Chapter 9 POSIX terminals 323 9.1.2 Configuration of a terminal 324 9.1.3 Special characters and the c_cc table 331 9.1.4 The command stty 334 9.1.5 The command setserial 334 9.1.6 Terminal groups the session 335 9.1.7 Pseudo-terminals 335 9.2 POSIX functions 336 9.2.1 Access to and modification of terminal attributes 337 9.2.2 An example of line configuration 338 9.2.3 Transmission speed 340 9.2.4 Line control 343 9.2.5 Identification of the terminal 345 9.2.6 Process groups 347 9.2.7 Pseudo-terminals 347 9.3 Kernel organisation data structures 351 9.3.1 Organisation 351 9.3.2 Internal data structures 352 9.4 Implementation 360 9.4.1 Initialisation 360 9.4.2 Terminal inputs and outputs 361 9.4.3 Other general functions 362 9.4.4 Managing disconnection 362 9.4.5 Management of line discipline 363 9.4.6 Pseudo-terminals 365 Chapter 10 Communication by pipes 367 10.1.2 Anonymous pipes and named pipes 368 10.2 System calls 369 10.2.1 Anonymous pipes 369 10.2.2 Named pipes 375 10.3 General overview of implementation 376 10.3.1 Named pipes 377 10.3.2 Anonymous pipes 377 10.4 Detailed description of implementation 378 10.4.1 Creation of a pipe inode 378 10.4.2 Creation of a named pipe 378 10.4.3 Creation of an anonymous pipe 378 10.4.4 Input/output operations 379 Chapter 11 IPC System V 381 11.1.2 Management of keys 382 11.1.3 Access permissions 384 11.2 System calls 384 11.2.1 Message queues 385 11.2.2 Semaphores 399 11.2.3 Shared memory 406 11.3 Advanced concepts 419 11.3.1 Kernel compilation option 419 11.3.2 The programs ipcs and ipcrm 419 11.4 General overview of implementation 422 11.4.1 Common functions 422 11.4.2 Algorithms 422 11.4.3 Key management 423 11.5 Detailed description of implementation 424 11.5.1 Message queue 424 11.5.2 Semaphores 426 11.5.3 Shared memory 429 Chapter 12 Loadable modules 433 12.1.2 Compilation 434 12.1.3 Command line operation: manual loading 435 12.1.4 On-demand loading 436 12.2 Advanced concepts 438 12.2.1 Design of loadable modules 438 12.2.2 System calls specific to modules 441 12.3 Implementation of loadable modules 444 12.3.1 Overview 444 12.3.2 Implementation of system calls 445 12.3.2.1 create_module 445 12.3.2.2 init_module 445 12.3.2.3 delete_module 445 12.3.2.4 get_kernel_sums 446 12.3.3 Management of virtual files 446 12.3.4 Anciliary functions 446 12.4 Automatic loading of modules (KERNELD) 447 12.4.1 Overview 447 12.4.2 Implementation details 447 Chapter 13 System administration 451 13.1 Basic concepts 451 13.1.1 Information intended for processes 451 13.1.2 Information controlling execution 452 13.1.3 Change of status in the kernel 453 13.1.4 Dynamic configuration of the system 453 13.1.4.1 Overview 453 13.4.1.2 An alternative method 453 13.2 Administration system calls 454 13.2.1 Information relating to the workstation 454 13.2.2 Control of execution 457 13.2.2.1 Time 457 13.2.2.2 Display mode of kernel messages 459 13.2.2.3 Machine status 461 13.2.2.4 Clock synchronisation 463 13.2.3 Change of status of the kernel 465 13.2.4 Dynamic system configuration 465 13.3 Implementation 469 13.3.1 sethostname, gethostname, setdomain name and uname 469 13.3.2 reboot 470 13.3.3 syslog 470 13.3.4 gettimeofday, settimeofday, time and stime 470 13.3.4.1 time 470 13.3.4.2 stime 470 13.3.4.3 gettimeofday 471 13.3.4.4 settimeofday 471 13.3.4.5 sysctl 471 13.3.5 adjtimex 472 Appendix 1 Phases of a 'C' compilation 473 1 Pre-processor 474 2 Compiler 474 3 Assembler 475 4 Linker 476 Appendix 2 Utilisation of gdb 477 Appendix 3 Utilisation of make 481 1 Functioning of make 481 2 Writing from a makefile file 481 Appendix 4 Management of libraries 483 1 Creation and handling tools 483 2 Static libraries 484 3 a.out dynamic libraries 4 ELF dynamic libraries 485 5 Dynamic loading of libraries 485 References 489 Index 493 ER -