Preface |
|
xix | |
Acknowledgments |
|
xxvii | |
Authors |
|
xxix | |
1 Overview of Operating Systems |
|
1 | (14) |
|
|
1 | (1) |
|
1.2 What Is an Operating System? |
|
|
1 | (2) |
|
1.3 Operating System Services |
|
|
3 | (1) |
|
1.4 Character (Command Line) versus Graphical User Interfaces |
|
|
4 | (1) |
|
1.5 Types of Operating Systems |
|
|
4 | (1) |
|
1.6 The Linux Distribution Families |
|
|
5 | (1) |
|
1.7 Linux Software Architecture |
|
|
5 | (3) |
|
1.7.1 Device Driver Layer |
|
|
5 | (1) |
|
|
6 | (1) |
|
1.7.2.1 Process Management |
|
|
6 | (1) |
|
|
6 | (1) |
|
1.7.2.3 Main Memory Management |
|
|
6 | (1) |
|
|
7 | (1) |
|
1.7.3 System Call Interface |
|
|
7 | (1) |
|
|
7 | (1) |
|
|
7 | (1) |
|
|
7 | (1) |
|
1.8 Historical Development of the Linux Operating System |
|
|
8 | (3) |
|
|
8 | (2) |
|
1.8.2 The History of Shells |
|
|
10 | (1) |
|
1.8.3 Future Developments |
|
|
10 | (1) |
|
1.9 A Basic Comparison of Linux System Distributions |
|
|
11 | (1) |
|
1.9.1 Linux System Standardization |
|
|
12 | (1) |
|
|
12 | (1) |
|
|
13 | (1) |
|
Advanced Questions and Problems |
|
|
14 | (1) |
2 "Quick Start" into the Linux Operating System |
|
15 | (40) |
|
|
15 | (1) |
|
2.2 The Structure of a Linux Command |
|
|
16 | (2) |
|
2.3 Logging On and Logging Off |
|
|
18 | (6) |
|
2.3.1 Stand-Alone Login Connection to Linux |
|
|
19 | (1) |
|
2.3.1.1 Graphical Login and Logout Procedures |
|
|
20 | (1) |
|
2.3.2 Connecting via PuTTY from a Microsoft Windows Computer |
|
|
20 | (2) |
|
2.3.2.1 Login and Logout Procedures |
|
|
21 | (1) |
|
2.3.3 Connecting via an SSH Client between Linux Machines |
|
|
22 | (2) |
|
2.3.3.1 Login and Logout Procedures |
|
|
23 | (1) |
|
2.4 File Maintenance Commands and Help on Linux Command Usage |
|
|
24 | (13) |
|
2.4.1 File and Directory Structure |
|
|
25 | (1) |
|
2.4.2 Viewing the Contents of Files |
|
|
26 | (1) |
|
2.4.3 Creating, Deleting, and Managing Files |
|
|
27 | (3) |
|
2.4.4 Creating, Deleting, and Managing Directories |
|
|
30 | (4) |
|
2.4.5 Obtaining Help with the man Command |
|
|
34 | (2) |
|
2.4.6 Other Methods of Obtaining Help |
|
|
36 | (1) |
|
|
37 | (4) |
|
2.5.1 Examining System Setups |
|
|
37 | (1) |
|
2.5.2 Printing and General Utility Commands |
|
|
38 | (1) |
|
2.5.3 Communication Commands |
|
|
39 | (2) |
|
|
41 | (1) |
|
2.7 Introduction to Linux Shells |
|
|
42 | (2) |
|
|
44 | (5) |
|
|
45 | (1) |
|
2.8.2 Which Shell Suits Your Needs? |
|
|
46 | (1) |
|
2.8.3 Ways to Change Your Shell |
|
|
46 | (2) |
|
2.8.4 Shell Start-Up Files and Environment Variables |
|
|
48 | (1) |
|
|
49 | (1) |
|
2.10 The sudo and su Commands |
|
|
50 | (1) |
|
|
50 | (1) |
|
|
51 | (1) |
|
Advanced Questions and Problems |
|
|
52 | (2) |
|
|
54 | (1) |
3 Editing Text Files |
|
55 | (14) |
|
|
55 | (3) |
|
3.1.1 nano Typographic Conventions |
|
|
55 | (1) |
|
3.1.2 Comments on Linux Text Editors and Their General Use |
|
|
55 | (2) |
|
3.1.3 Other Ways of Treating Text and Files in Linux |
|
|
57 | (1) |
|
3.2 A Quick Introduction to the nano Editor |
|
|
58 | (6) |
|
3.2.1 A Brief nano Tutorial |
|
|
59 | (11) |
|
3.2.1.1 Creating and Opening a New File |
|
|
59 | (1) |
|
3.2.1.2 How to Save a File |
|
|
60 | (1) |
|
3.2.1.3 How to Cut and Paste Text |
|
|
60 | (1) |
|
3.2.1.4 How to Search and Replace a Word |
|
|
60 | (2) |
|
3.2.1.5 How to Insert Another File into the Current One |
|
|
62 | (1) |
|
3.2.1.6 How to Show the Cursor Position |
|
|
62 | (1) |
|
3.2.1.7 How to Back Up a Previous Version of a File |
|
|
62 | (2) |
|
|
64 | (1) |
|
|
64 | (1) |
|
Advanced Questions and Problems |
|
|
65 | (2) |
|
|
67 | (2) |
4 Files and File System Structure |
|
69 | (28) |
|
|
69 | (1) |
|
4.2 The Linux File Concept |
|
|
69 | (1) |
|
|
70 | (3) |
|
4.3.1 Simple/Ordinary File |
|
|
70 | (1) |
|
|
71 | (1) |
|
|
72 | (1) |
|
4.3.4 Special (Device) File |
|
|
72 | (1) |
|
|
72 | (1) |
|
|
72 | (1) |
|
4.4 File System Structure |
|
|
73 | (4) |
|
4.4.1 File System Organization |
|
|
73 | (1) |
|
4.4.2 Home and Present Working Directories |
|
|
74 | (1) |
|
4.4.3 Pathnames: Absolute and Relative |
|
|
74 | (1) |
|
4.4.4 Some Standard Directories and Files |
|
|
75 | (2) |
|
4.5 Navigating the File Structure |
|
|
77 | (11) |
|
4.5.1 Determining the Absolute Pathname for Your Home Directory |
|
|
77 | (1) |
|
4.5.2 Browsing the File System |
|
|
78 | (3) |
|
|
81 | (1) |
|
4.5.4 Creating and Removing Directories |
|
|
81 | (1) |
|
4.5.5 Determining File Attributes |
|
|
82 | (2) |
|
4.5.6 Determining the Type of a File's Contents |
|
|
84 | (2) |
|
4.5.7 File Representation and Storage in Linux |
|
|
86 | (2) |
|
4.6 Standard Files and File Descriptors |
|
|
88 | (1) |
|
|
89 | (2) |
|
4.7.1 Displaying Disk Usage of Files and Directories |
|
|
90 | (1) |
|
|
91 | (1) |
|
|
91 | (1) |
|
|
92 | (2) |
|
Advanced Questions and Problems |
|
|
94 | (1) |
|
|
95 | (2) |
5 File Security |
|
97 | (22) |
|
|
97 | (1) |
|
5.2 Password-Based Protection |
|
|
97 | (2) |
|
5.3 Encryption-Based Protection |
|
|
99 | (1) |
|
5.4 Protection Based on Access Permission |
|
|
99 | (3) |
|
|
99 | (2) |
|
5.4.2 Types of File Operations/Access Permissions |
|
|
101 | (1) |
|
5.4.3 Access Permissions for Directories |
|
|
102 | (1) |
|
5.5 Determining and Changing File Access Privileges |
|
|
102 | (7) |
|
5.5.1 Determining File Access Privileges |
|
|
102 | (1) |
|
5.5.2 Changing File Access Privileges |
|
|
103 | (3) |
|
5.5.3 Access Privileges for Directories |
|
|
106 | (1) |
|
5.5.4 Default File Access Privileges |
|
|
107 | (2) |
|
|
109 | (4) |
|
|
109 | (2) |
|
|
111 | (1) |
|
|
112 | (1) |
|
|
113 | (1) |
|
|
114 | (2) |
|
Advanced Questions and Problems |
|
|
116 | (1) |
|
|
117 | (2) |
6 Basic File Processing |
|
119 | (34) |
|
|
119 | (1) |
|
6.2 Viewing Contents of Text Files |
|
|
119 | (7) |
|
6.2.1 Viewing Complete Files |
|
|
119 | (2) |
|
6.2.2 Viewing Files One Page at a Time |
|
|
121 | (2) |
|
6.2.3 Viewing the Head or Tail of a File |
|
|
123 | (3) |
|
6.3 Copying, Moving, and Removing Files |
|
|
126 | (9) |
|
|
127 | (2) |
|
|
129 | (1) |
|
6.3.3 Removing/Deleting Files |
|
|
130 | (3) |
|
6.3.4 Determining File Size |
|
|
133 | (2) |
|
|
135 | (1) |
|
|
136 | (1) |
|
|
137 | (5) |
|
|
137 | (4) |
|
|
141 | (1) |
|
6.7 Locating and Removing Repetition within Text Files |
|
|
142 | (1) |
|
6.8 Printing Files and Controlling Print Jobs |
|
|
143 | (5) |
|
6.8.1 Linux Mechanism for Printing Files |
|
|
143 | (1) |
|
|
144 | (2) |
|
6.8.3 Finding the Status of Your Print Requests |
|
|
146 | (1) |
|
6.8.4 Canceling Your Print Jobs |
|
|
147 | (1) |
|
|
148 | (1) |
|
|
149 | (2) |
|
Advanced Questions and Problems |
|
|
151 | (1) |
|
|
151 | (2) |
7 Advanced File Processing |
|
153 | (36) |
|
|
153 | (1) |
|
|
153 | (5) |
|
7.3 Searching for Commands and Files |
|
|
158 | (4) |
|
|
162 | (3) |
|
|
165 | (4) |
|
|
169 | (3) |
|
|
172 | (5) |
|
|
173 | (1) |
|
|
173 | (1) |
|
|
174 | (1) |
|
7.7.4 The zcat and zmore Commands |
|
|
175 | (1) |
|
7.7.5 The gzip, bzip2, and xz Commands |
|
|
176 | (1) |
|
7.8 Encoding and Decoding |
|
|
177 | (2) |
|
7.9 File Encryption and Decryption |
|
|
179 | (3) |
|
|
182 | (1) |
|
|
183 | (3) |
|
Advanced Questions and Problems |
|
|
186 | (1) |
|
|
187 | (2) |
8 File Sharing |
|
189 | (16) |
|
|
189 | (1) |
|
8.2 Duplicate Shared Files |
|
|
189 | (1) |
|
8.3 Common Logins for Team Members |
|
|
189 | (1) |
|
8.4 Setting Appropriate Access Permissions on Shared Files |
|
|
190 | (1) |
|
8.5 Common Groups for Team Members |
|
|
190 | (1) |
|
8.6 File Sharing via Links |
|
|
190 | (12) |
|
|
191 | (5) |
|
8.6.2 Drawbacks of Hard Links |
|
|
196 | (1) |
|
8.6.3 Soft/Symbolic Links |
|
|
197 | (4) |
|
8.6.4 Pros and Cons of Symbolic Links |
|
|
201 | (1) |
|
|
202 | (1) |
|
|
202 | (1) |
|
Advanced Questions and Problems |
|
|
203 | (1) |
|
|
204 | (1) |
9 Redirection and Piping |
|
205 | (26) |
|
|
205 | (1) |
|
|
205 | (1) |
|
|
206 | (1) |
|
|
207 | (2) |
|
9.5 Combining Input and Output Redirection |
|
|
209 | (1) |
|
9.6 I/O Redirection with File Descriptors |
|
|
209 | (1) |
|
9.7 Redirecting Standard Error |
|
|
210 | (1) |
|
9.8 Redirecting stdout and stderr in One Command |
|
|
211 | (2) |
|
9.9 Redirecting stdin, stdout, and stderr in One Command |
|
|
213 | (1) |
|
9.10 Redirecting without Overwriting File Contents (Appending) |
|
|
214 | (1) |
|
|
215 | (3) |
|
9.12 Redirection and Piping Combined |
|
|
218 | (1) |
|
9.13 Output and Error Redirection in the TC Shell |
|
|
219 | (3) |
|
9.14 Recap of I/O and Error Redirection |
|
|
222 | (1) |
|
|
223 | (3) |
|
|
226 | (1) |
|
|
226 | (2) |
|
Advanced Questions and Problems |
|
|
228 | (1) |
|
|
229 | (2) |
10 Processes |
|
231 | (42) |
|
|
231 | (1) |
|
10.2 CPU Scheduling-Running Multiple Processes Simultaneously |
|
|
232 | (1) |
|
10.3 Linux Process States |
|
|
233 | (1) |
|
10.4 Execution of Shell Commands |
|
|
234 | (3) |
|
|
237 | (13) |
|
10.5.1 Static Display of Process Attributes |
|
|
237 | (7) |
|
10.5.2 Linux Process and Thread Scheduling |
|
|
244 | (3) |
|
10.5.2.1 Linux Scheduling Policies and Priorities |
|
|
244 | (3) |
|
10.5.3 Dynamic Display of Process Attributes |
|
|
247 | (3) |
|
10.5.3.1 Top Interactive Keystroke Commands |
|
|
250 | (1) |
|
10.6 Process and Job Control |
|
|
250 | (11) |
|
10.6.1 Foreground and Background Processes and Related Commands |
|
|
250 | (5) |
|
|
255 | (1) |
|
10.6.3 Sequential and Parallel Execution of Commands |
|
|
255 | (2) |
|
10.6.4 Abnormal Termination of Commands and Processes |
|
|
257 | (4) |
|
10.7 Linux Start-Up, Login, and Process Hierarchy |
|
|
261 | (4) |
|
10.7.1 Linux Login and agetty |
|
|
262 | (1) |
|
10.7.2 Process Lifetime and pstree |
|
|
263 | (13) |
|
10.7.2.1 ps versus pstree |
|
|
265 | (1) |
|
|
265 | (2) |
|
|
267 | (1) |
|
|
268 | (2) |
|
Advanced Questions and Problems |
|
|
270 | (1) |
|
|
271 | (2) |
11 Networking and Internetworking |
|
273 | (38) |
|
|
273 | (1) |
|
11.2 Computer Networks and Internetworks |
|
|
274 | (1) |
|
11.3 Reasons for Computer Networks and Internetworks |
|
|
275 | (1) |
|
|
275 | (1) |
|
|
276 | (10) |
|
|
276 | (1) |
|
11.5.2 Routing of Application Data: The IP |
|
|
277 | (3) |
|
11.5.2.1 IPv4 Addresses in Dotted Decimal Notation |
|
|
279 | (1) |
|
|
280 | (1) |
|
11.5.4 Translating Names to IP Addresses: The Domain Name System |
|
|
281 | (4) |
|
11.5.5 Requests for Comments |
|
|
285 | (1) |
|
11.6 Internet Services and Protocols |
|
|
286 | (1) |
|
11.7 The Client-Server Software Model |
|
|
287 | (1) |
|
11.8 Application Software |
|
|
288 | (18) |
|
11.8.1 Displaying the Host Name |
|
|
288 | (1) |
|
11.8.2 Testing a Network Connection |
|
|
288 | (2) |
|
11.8.3 Displaying Information About Users |
|
|
290 | (1) |
|
|
291 | (3) |
|
11.8.5 SSH and Related Commands |
|
|
294 | (5) |
|
11.8.5.1 Remote Login with ssh |
|
|
294 | (3) |
|
11.8.5.2 Remote Command Execution with ssh |
|
|
297 | (2) |
|
11.8.6 Remote Copy with scp |
|
|
299 | (1) |
|
11.8.7 Secure File Transfer with sftp |
|
|
300 | (3) |
|
11.8.8 Packaged ssh Applications |
|
|
303 | (1) |
|
|
303 | (2) |
|
11.8.10 Tracing the Route from One Site to Another |
|
|
305 | (1) |
|
11.9 Important Internet Organizations |
|
|
306 | (1) |
|
|
307 | (1) |
|
|
307 | (2) |
|
Advanced Questions and Problems |
|
|
309 | (1) |
|
|
309 | (2) |
12 Introductory Bash Programming |
|
311 | (44) |
|
|
311 | (1) |
|
12.2 Running a Bash Script |
|
|
311 | (2) |
|
12.3 Shell Variables and Related Commands |
|
|
313 | (14) |
|
12.3.1 Controlling the Prompt |
|
|
315 | (1) |
|
12.3.2 Variable Declaration |
|
|
316 | (2) |
|
12.3.3 Reading and Writing Shell Variables |
|
|
318 | (3) |
|
12.3.4 Command Substitution |
|
|
321 | (1) |
|
12.3.5 Exporting Environment |
|
|
322 | (2) |
|
12.3.6 Resetting Variables |
|
|
324 | (1) |
|
12.3.7 Creating Read-Only Defined Variables |
|
|
325 | (1) |
|
12.3.8 Reading from Standard Input |
|
|
326 | (1) |
|
12.4 Passing Arguments to Shell Scripts |
|
|
327 | (4) |
|
12.5 Comments and Program Headers |
|
|
331 | (1) |
|
12.6 Program Control Flow Commands |
|
|
332 | (16) |
|
12.6.1 The if-then-elif-else-fi Statement |
|
|
332 | (8) |
|
|
340 | (2) |
|
12.6.3 The while Statement |
|
|
342 | (1) |
|
12.6.4 The until Statement |
|
|
343 | (1) |
|
12.6.5 The break and continue Commands |
|
|
344 | (1) |
|
12.6.6 The case Statement |
|
|
345 | (3) |
|
|
348 | (1) |
|
|
349 | (1) |
|
|
350 | (2) |
|
Advanced Questions and Problems |
|
|
352 | (1) |
|
|
353 | (2) |
13 Advanced Bash Programming |
|
355 | (36) |
|
|
355 | (1) |
|
13.2 Numeric Data Processing |
|
|
355 | (8) |
|
13.2.1 Bash Features for Arithmetic Operations |
|
|
355 | (6) |
|
13.2.2 Arithmetic with be |
|
|
361 | (2) |
|
|
363 | (3) |
|
|
366 | (3) |
|
13.5 Interrupt (Signal) Processing |
|
|
369 | (3) |
|
|
372 | (5) |
|
13.6.1 Reasons for Using Functions |
|
|
372 | (1) |
|
13.6.2 Function Definition |
|
|
373 | (1) |
|
13.6.3 Function Invocation/Call |
|
|
374 | (1) |
|
13.6.4 A Few More Examples of Functions |
|
|
374 | (2) |
|
13.6.5 Parameter Passing in Functions |
|
|
376 | (1) |
|
13.7 The exec Command and File I/O |
|
|
377 | (8) |
|
13.7.1 Execution of a Command (or Script) in Place of Its Parent Process |
|
|
378 | (1) |
|
13.7.2 File Input/Output via the exec Command |
|
|
379 | (6) |
|
13.8 Debugging Shell Scripts |
|
|
385 | (1) |
|
|
386 | (1) |
|
|
387 | (1) |
|
Advanced Questions and Problems |
|
|
388 | (1) |
|
|
389 | (2) |
14 Linux Tools for Software Development |
|
391 | (46) |
|
|
391 | (1) |
|
14.2 Computer Programming Languages |
|
|
391 | (1) |
|
14.3 The Compilation Process |
|
|
392 | (2) |
|
14.4 The Software Engineering Life Cycle |
|
|
394 | (1) |
|
14.5 Program Generation Tools |
|
|
395 | (21) |
|
14.5.1 Generating C Source Files |
|
|
395 | (1) |
|
14.5.2 Indenting C Source Code |
|
|
395 | (1) |
|
14.5.3 Running C, C++, Java, Perl, Python, and Ruby Programs |
|
|
396 | (6) |
|
14.5.3.1 Compiling and Executing C Programs |
|
|
397 | (1) |
|
14.5.3.2 Dealing with Multiple Source Files |
|
|
398 | (1) |
|
14.5.3.3 Linking Libraries |
|
|
399 | (1) |
|
14.5.3.4 Compiling and Executing C++ and Java Programs |
|
|
400 | (1) |
|
14.5.3.5 Running Perl, Python, and Ruby Scripts |
|
|
400 | (2) |
|
14.5.4 Handling Module-Based C Software with make |
|
|
402 | (7) |
|
14.5.5 Building Object Files into a Library Using ar and MRI Librarian |
|
|
409 | (4) |
|
14.5.5.1 Creating an Archive |
|
|
410 | (1) |
|
14.5.5.2 Displaying the Table of Contents |
|
|
410 | (1) |
|
14.5.5.3 Deleting Object Modules from an Archive |
|
|
410 | (1) |
|
14.5.5.4 Extracting Object Modules from an Archive |
|
|
411 | (1) |
|
14.5.5.5 Working with the MRI Librarian |
|
|
412 | (1) |
|
14.5.6 Working with Libraries Using ranlib and nm |
|
|
413 | (2) |
|
14.5.6.1 Ordering Archives |
|
|
413 | (1) |
|
14.5.6.2 Displaying Library Information |
|
|
414 | (1) |
|
14.5.7 Version Control with git |
|
|
415 | (1) |
|
14.6 Static Analysis Tools |
|
|
416 | (6) |
|
14.6.1 Verifying Code for Portability with cppcheck |
|
|
417 | (2) |
|
14.6.2 Source Code Metrics with gprof |
|
|
419 | (3) |
|
14.7 Dynamic Analysis Tools |
|
|
422 | (11) |
|
14.7.1 Source Code Debugging with gdb |
|
|
422 | (9) |
|
|
423 | (2) |
|
14.7.1.2 Entering the gdb Environment |
|
|
425 | (1) |
|
14.7.1.3 Executing a Program |
|
|
426 | (1) |
|
14.7.1.4 Listing Program Code |
|
|
426 | (1) |
|
14.7.1.5 Tracing Program Execution |
|
|
427 | (1) |
|
14.7.1.6 Setting Breakpoints |
|
|
428 | (1) |
|
14.7.1.7 Single-Stepping through Your Program |
|
|
428 | (1) |
|
14.7.1.8 Accessing Identifiers (Variables and Functions) |
|
|
429 | (1) |
|
|
429 | (2) |
|
14.7.1.10 Leaving gdb and Wrapping Up |
|
|
431 | (1) |
|
14.7.2 Run-Time Performance with time |
|
|
431 | (2) |
|
|
433 | (1) |
|
|
433 | (2) |
|
Advanced Questions and Problems |
|
|
435 | (1) |
|
|
435 | (2) |
15 System Programming I: File System Management |
|
437 | (32) |
|
|
437 | (1) |
|
15.2 What Is System Programming? |
|
|
438 | (1) |
|
15.3 Entry Points into the Operating System Kernel |
|
|
438 | (1) |
|
15.4 Fundamentals of System Calls |
|
|
439 | (2) |
|
15.4.1 What Is a System Call? |
|
|
439 | (1) |
|
15.4.2 Types of System Calls |
|
|
440 | (1) |
|
15.4.3 Execution of a System Call |
|
|
440 | (1) |
|
15.5 Files: The Big Picture |
|
|
441 | (2) |
|
15.5.1 File Descriptors, File Descriptor Tables, File Tables, and Inode Tables |
|
|
441 | (1) |
|
|
442 | (1) |
|
15.6 Fundamental File I/O Paradigm |
|
|
443 | (1) |
|
15.7 Standard I/O versus Low-Level I/O |
|
|
443 | (3) |
|
|
444 | (1) |
|
15.7.2 File Data I/O Using the CSL |
|
|
444 | (1) |
|
15.7.3 Low-Level I/O in Linux via System Calls |
|
|
445 | (1) |
|
15.7.4 System Call Failure and Error Handling |
|
|
446 | (1) |
|
|
446 | (13) |
|
15.8.1 Opening and Creating a File |
|
|
446 | (2) |
|
|
448 | (2) |
|
15.8.3 Reading from a File |
|
|
450 | (1) |
|
|
450 | (2) |
|
15.8.5 Positioning the File Pointer: Random Access |
|
|
452 | (3) |
|
|
455 | (2) |
|
|
457 | (2) |
|
15.9 Getting File Attributes from a File Inode |
|
|
459 | (3) |
|
15.9.1 The stat Structure |
|
|
459 | (1) |
|
15.9.2 Populating the stat Structure with System Calls |
|
|
460 | (1) |
|
15.9.3 Displaying File Attributes |
|
|
461 | (1) |
|
15.9.4 Accessing and Manipulating File Attributes |
|
|
461 | (1) |
|
15.10 Restarting System Calls |
|
|
462 | (1) |
|
15.11 System Calls for Manipulating Directories |
|
|
462 | (1) |
|
|
463 | (1) |
|
|
464 | (1) |
|
Advanced Questions and Problems |
|
|
465 | (1) |
|
|
466 | (3) |
16 System Programming II: Process Management and Signal Processing |
|
469 | (42) |
|
|
469 | (1) |
|
16.2 Processes and Threads |
|
|
470 | (7) |
|
16.2.1 What Is a Process? |
|
|
470 | (1) |
|
16.2.2 Process Control Block |
|
|
470 | (1) |
|
16.2.3 Process Memory Image (Process Address Space) |
|
|
470 | (2) |
|
16.2.4 Process Disk Image |
|
|
472 | (1) |
|
|
473 | (2) |
|
16.2.6 Commonalities and Differences between Processes and Threads |
|
|
475 | (1) |
|
16.2.7 Data Sharing among Threads and the Critical Section Problem |
|
|
475 | (2) |
|
16.3 Process Management Concepts |
|
|
477 | (10) |
|
16.3.1 Getting the PID and the PPID |
|
|
478 | (1) |
|
16.3.2 Creating a Clone of a Process |
|
|
478 | (2) |
|
16.3.3 Reporting Status to the Parent Process |
|
|
480 | (1) |
|
16.3.4 Collecting the Status of a Child Process |
|
|
480 | (3) |
|
16.3.5 Overwriting a Process Image |
|
|
483 | (3) |
|
16.3.6 Creating a Zombie Process |
|
|
486 | (1) |
|
16.3.7 Terminating a Process |
|
|
487 | (1) |
|
16.4 Processes and the File Descriptor Table |
|
|
487 | (5) |
|
16.4.1 File Sharing between Processes |
|
|
487 | (3) |
|
16.4.2 Duplicating File Descriptor |
|
|
490 | (2) |
|
16.5 Getting the Attention of a Process: Linux Signals |
|
|
492 | (6) |
|
|
492 | (1) |
|
16.5.2 Intercepting Signals |
|
|
493 | (1) |
|
16.5.3 Setting Up an Alarm |
|
|
493 | (3) |
|
|
496 | (2) |
|
16.6 Thread Programming with pthreads |
|
|
498 | (6) |
|
|
498 | (1) |
|
|
498 | (3) |
|
16.6.3 Thread Termination |
|
|
501 | (2) |
|
|
503 | (1) |
|
16.6.5 Thread-Specific Data |
|
|
503 | (1) |
|
16.6.6 Thread Synchronization |
|
|
504 | (1) |
|
|
504 | (1) |
|
|
505 | (4) |
|
Advanced Questions and Problems |
|
|
509 | (1) |
|
|
510 | (1) |
17 Linux System Administration Fundamentals |
|
511 | (90) |
|
|
511 | (3) |
|
17.1.1 System Administration the Easy Way |
|
|
513 | (1) |
|
17.2 Doing a Fresh Install from DVD ISO-Image Media and Preliminary System Configuration |
|
|
514 | (10) |
|
17.2.1 Pre-and Postinstallation Considerations and Choices |
|
|
514 | (6) |
|
17.2.2 Installation of Linux |
|
|
520 | (1) |
|
17.2.3 System Services Administration, Startup, and Shutdown Procedures |
|
|
520 | (4) |
|
17.2.3.1 The Boot and Startup Processes |
|
|
520 | (2) |
|
17.2.3.2 systemd and Traditional System Reboot or Shutdown |
|
|
522 | (1) |
|
17.2.3.3 Preliminary Considerations When Managing System Services with systemd |
|
|
523 | (1) |
|
17.2.3.4 Further References for System Service Management Using systemd |
|
|
523 | (1) |
|
|
524 | (7) |
|
17.3.1 Adding a User and Group in a Text-Based Interface on Linux |
|
|
525 | (2) |
|
17.3.2 Adding and Maintaining Groups in a Text-Based Interface |
|
|
527 | (2) |
|
17.3.3 Deleting a User Account and Group from the Command Line |
|
|
529 | (1) |
|
17.3.4 A Method of User and Group Creation Utilizing a Second Hard Disk |
|
|
529 | (1) |
|
17.3.5 Basic Password Management |
|
|
530 | (1) |
|
|
531 | (1) |
|
17.4 File Systems, Connections to Persistent Media, and Adding Disks to Your System |
|
|
531 | (12) |
|
17.4.1 Preliminary Considerations When Adding New Disk Drives |
|
|
535 | (1) |
|
17.4.2 Five Quick and Easy Ways to Find Out the Logical Device Names of Disks |
|
|
536 | (2) |
|
17.4.3 Adding a New Hard Disk to the System |
|
|
538 | (3) |
|
17.4.4 Adding Disks Using fdisk |
|
|
541 | (2) |
|
17.4.4.1 Partitioning a Disk Using fdisk |
|
|
541 | (2) |
|
17.5 Configuring a Printer |
|
|
543 | (1) |
|
17.6 File System Backup Strategies and Techniques |
|
|
543 | (18) |
|
17.6.1 A Strategic Synopsis and Overview of File Backup Facilities |
|
|
544 | (1) |
|
|
544 | (12) |
|
17.6.2.1 Archiving and Restoring Files Using tar |
|
|
546 | (1) |
|
|
547 | (2) |
|
17.6.2.3 Creating an Archive with tar |
|
|
549 | (2) |
|
17.6.2.4 Restoring Archived Files with tar |
|
|
551 | (2) |
|
17.6.2.5 Copying Directory Hierarchies Locally and Remotely |
|
|
553 | (2) |
|
17.6.2.6 Extracting Software Distributions with tar |
|
|
555 | (1) |
|
17.6.3 Other Linux Archiving and Backup Facilities |
|
|
556 | (5) |
|
|
556 | (3) |
|
17.6.3.2 Script Files for Backup and Recovery |
|
|
559 | (1) |
|
17.6.3.3 Software for Backup and Recovery: The "Zillas" and Ghost |
|
|
560 | (1) |
|
17.6.3.4 Using git and GitHub to Backup File Systems |
|
|
561 | (1) |
|
17.7 Software Updates and Operating System Upgrades (On Debian-Family and CentOS) |
|
|
561 | (7) |
|
17.7.1 Preliminary Storage Model Suggestions |
|
|
562 | (1) |
|
|
563 | (3) |
|
|
563 | (3) |
|
|
566 | (2) |
|
17.7.3.1 YUM Package Installation Procedures |
|
|
566 | (2) |
|
17.7.4 Upgrading the Operating System |
|
|
568 | (1) |
|
17.8 System and Software Performance Monitoring and Adjustment |
|
|
568 | (13) |
|
17.8.1 Application-Level Process/Thread Resource Management |
|
|
569 | (8) |
|
17.8.1.1 Traditional Process Control |
|
|
569 | (1) |
|
17.8.1.2 systemd Cgroups, Affecting the Limits of CPU Scheduling |
|
|
570 | (5) |
|
|
575 | (1) |
|
17.8.1.4 Assessment of System Disk Usage |
|
|
576 | (1) |
|
17.8.2 Network Configuration with the ip Command |
|
|
577 | (4) |
|
17.8.2.1 Basic ip Command Syntax, Options, and Operations |
|
|
577 | (2) |
|
17.8.2.2 Use Case Example: Assigning Several IP Addresses to a NIC |
|
|
579 | (2) |
|
|
581 | (11) |
|
17.9.1 Password-Based Authentication |
|
|
582 | (1) |
|
17.9.2 Access Control Credentials: DAC, MAC, and RBAC |
|
|
582 | (3) |
|
|
585 | (1) |
|
|
585 | (2) |
|
17.9.4 Linux Security Software |
|
|
587 | (2) |
|
|
587 | (1) |
|
17.9.4.2 ufw and Netfilter Interface in Debian Linux Family |
|
|
588 | (1) |
|
17.9.4.3 firewalld in CentOS |
|
|
588 | (1) |
|
17.9.5 Persistent Media Security |
|
|
589 | (1) |
|
17.9.5.1 Persistent Media Allocations for/home |
|
|
589 | (1) |
|
17.9.5.2 Securing the File System |
|
|
590 | (1) |
|
17.9.6 Process Credentials |
|
|
590 | (1) |
|
17.9.6.1 File Permission-Based Mechanisms |
|
|
590 | (1) |
|
|
591 | (1) |
|
17.9.7.1 The Meaning of Encryption |
|
|
591 | (1) |
|
17.10 Virtualization Methodologies |
|
|
592 | (1) |
|
17.10.1 Virtualization Applications |
|
|
593 | (1) |
|
|
593 | (1) |
|
|
594 | (2) |
|
Advanced Problems and Projects |
|
|
596 | (1) |
|
|
597 | (4) |
18 systemd |
|
601 | (26) |
|
18.1 Introduction: Why You Should Know about and Use systemd |
|
|
601 | (3) |
|
18.1.1 Some Prerequisites |
|
|
603 | (1) |
|
18.1.2 Where to Get Further Help and Documentation |
|
|
604 | (1) |
|
18.2 System Start-Up, Initialization, and Shutdown Using systemd |
|
|
604 | (3) |
|
18.2.1 An Overview of the Start-Up and Shutdown Processes |
|
|
604 | (1) |
|
18.2.2 systemd Start-Up: Targets, Target States, and Target Units |
|
|
605 | (1) |
|
18.2.3 systemd-Controlled Shutdown |
|
|
606 | (1) |
|
18.3 systemd System Service Management Basics Using the systemctl Command |
|
|
607 | (7) |
|
18.3.1 How to Use systemctl to Manage systemd Services and Units |
|
|
608 | (6) |
|
18.3.1.1 Service Management |
|
|
608 | (1) |
|
18.3.1.2 Starting and Stopping Services |
|
|
609 | (1) |
|
18.3.1.3 Restarting and Reloading |
|
|
610 | (1) |
|
18.3.1.4 Enabling and Disabling Services |
|
|
610 | (1) |
|
18.3.1.5 Checking the Status of Services |
|
|
610 | (2) |
|
18.3.1.6 How to Check System State |
|
|
612 | (2) |
|
18.4 Using systemctl to View the System State |
|
|
614 | (1) |
|
18.4.1 systemd Service Viewing |
|
|
614 | (1) |
|
18.5 Creating and Adding a New systemd-Controlled Service |
|
|
615 | (7) |
|
18.5.1 New-Style Daemons and Services |
|
|
615 | (2) |
|
18.5.1.1 A systemd-run Command Example |
|
|
615 | (1) |
|
18.5.1.2 Bourne-Again Daemon |
|
|
616 | (1) |
|
18.5.2 An Old-Style Simple Daemon Web Server Example |
|
|
617 | (3) |
|
18.5.2.1 How to Run webserver2 before You Make It a Service |
|
|
618 | (1) |
|
18.5.2.2 Webserver Example Program Logic Model |
|
|
618 | (1) |
|
18.5.2.3 Using the Journal Application Programming Interface (API) in webserver2 |
|
|
619 | (1) |
|
18.5.3 Making a Daemon a Service: A Simple Three-Step Example |
|
|
620 | (2) |
|
18.5.3.1 Making webserver2 a systemd Service |
|
|
621 | (1) |
|
|
622 | (1) |
|
|
623 | (2) |
|
Advanced Questions and Problems |
|
|
625 | (1) |
|
|
625 | (2) |
Appendix A: Installation Instructions |
|
627 | (14) |
Appendix B: Books for Further Reference |
|
641 | (6) |
Index |
|
647 | |