𝔖 Scriptorium
✦   LIBER   ✦

πŸ“

Systems Programming in Unix/Linux

✍ Scribed by K.C. Wang


Publisher
Springer
Year
2018
Tongue
English
Leaves
468
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Table of Contents


Preface
Contents
About the Author
Chapter 1: Introduction
1.1 About This Book
1.2 Roles of Systems Programming
1.3 Objectives of This Book
1.3.1 Strengthen Students Programming Background
1.3.2 Applications of Dynamic Data Structures
1.3.3 Process Concept and Process Management
1.3.4 Concurrent Programming
1.3.5 Timer and Time Functions
1.3.6 Signals, Signal Processing and IPC
1.3.7 File system
1.3.8 TCP/IP and Network Programming
1.4 Intended Audience
1.5 Unique Features of This Book
1.6 Use This Book As Textbook in Systems Programming Courses
1.7 Other Reference Books
1.8 Introduction to Unix
1.8.1 ATandT Unix
1.8.2 Berkeley Unix
1.8.3 HP Unix
1.8.4 IBM Unix
1.8.5 Sun Unix
1.9 Introduction to Linux
1.10 Linux Versions
1.10.1 Debian Linux
1.10.2 Ubuntu Linux
1.10.3 Linux Mint
1.10.4 RPM-Based Linux
1.10.5 Slackware Linux
1.11 Linux Hardware Platforms
1.12 Linux on Virtual Machines
1.12.1 VirtualBox
1.12.2 VMware
1.12.3 Dual Boot Slackware and Ubuntu Linux
1.13 Use Linux
1.13.1 Linux kernel image
1.13.2 Linux Booters
1.13.3 Linux Booting
1.13.4 Linux Run-levels
1.13.5 Login Process
1.13.6 Command Executions
1.14 Use Ubuntu Linux
1.14.1 Ubuntu Versions
1.14.2 Special Features of Ubuntu Linux
1.15 Unix/Linux File System Organization
1.15.1 File Types
1.15.2 File Pathnames
1.15.3 Unix/Linux Commands
1.15.4 Linux Man Pages
1.16 Ubuntu Linux System Administration
1.16.1 User Accounts
1.16.2 Add New User
1.16.3 The sudo Command
1.17 Summary
References
Chapter 2: Programming Background
2.1 Text Editors in Linux
2.1.1 Vim
2.1.2 Gedit
2.1.3 Emacs
2.2 Use Text Editors
2.2.1 Use Emacs
2.2.2 Emacs Menus
2.2.3 IDE of Emacs
2.3 Program Development
2.3.1 Program Development Steps
2.3.2 Variables in C
2.3.3 Compile-Link in GCC
2.3.4 Static vs. Dynamic Linking
2.3.5 Executable File Format
2.3.6 Contents of a.out File
2.3.7 Program Execution
2.3.8 Program Termination
2.4 Function Call in C
2.4.1 Run-Time Stack Usage in 32-Bit GCC
2.4.2 Stack Frames
2.4.3 Return From Function Call
2.4.4 Long Jump
2.4.5 Run-Time Stack Usage in 64-Bit GCC
2.5 Link C Program with Assembly Code
2.5.1 Programming in Assembly
2.5.2 Implement Functions in Assembly
2.5.3 Call C functions from Assembly
2.6 Link Library
2.6.1 Static Link Library
2.6.2 Dynamic Link Library
2.7 Makefile
2.7.1 Makefile Format
2.7.2 The make Program
2.7.3 Makefile Examples
2.8 The GDB Debugger
2.8.1 Use GDB in Emacs IDE
2.8.2 Advices on Using Debugging Tools
2.8.3 Common Errors in C programs
2.9 Structures in C
2.9.1 Structure and Pointers
2.9.2 Typecast in C
2.10 Link List Processing
2.10.1 Link Lists
2.10.2 Link List Operations
2.10.3 Build Link List
2.10.3.1 Link List in Data Area
2.10.3.2 Link List in Heap Area
2.10.4 Link List Traversal
2.10.5 Search Link List
2.10.6 Insert Operation
2.10.7 Priority Queue
2.10.8 Delete Operation
2.10.9 Circular Link List
2.10.10 Open-Ended C Structures
2.10.11 Doubly Link Lists
2.10.12 Doubly Link Lists Example Programs
2.11 Trees
2.12 Binary Tree
2.12.1 Binary Search Tree
2.12.2 Build a Binary Search Tree (BST)
2.12.3 Binary Tree Traversal Algorithms
2.12.4 Depth-First Traversal Algorithms
2.12.5 Breadth-First Traversal Algorithms
2.13 Programming Project: Unix/Linux File System Tree Simulator
2.13.1 Unix/Linux File System Tree
2.13.2 Implement General Tree by Binary Tree
2.13.3 Project Specification and Requirements
2.13.4 Commands Specification
2.13.5 Program Organization
2.13.6 Command Algorithms
2.13.7 Sample Solution
2.14 Summary
References
Chapter 3: Process Management in Unix/Linux
3.1 Multitasking
3.2 The Process Concept
3.3 A Multitasking System
3.3.1 type.h file
3.3.2 The ts.s file
3.3.3 The queue.c file
3.3.4 The t.c file
3.3.5 Explanations of the Multitasking System Code
3.4 Process Synchronization
3.4.1 Sleep Operation
3.4.2 Wakeup Operation
3.5 Process Termination
3.5.1 Algorithm of kexit()
3.5.2 Process Family Tree
3.5.3 Wait for Child Process Termination
3.6 Process Management in the MT Multitasking System
3.7 Processes in Unix/Linux
3.7.1 Process Origin
3.7.2 INIT and Daemon Processes
3.7.3 Login Processes
3.7.4 Sh Process
3.7.5 Process Execution Modes
3.8 System Calls for Process Management
3.8.1 fork()
3.8.2 Process Execution Order
3.8.3 Process Termination
3.8.4 Wait for Child Process Termination
3.8.5 Subreaper Process in Linux
3.8.6 exec(): Change Process Execution Image
3.8.7 Environment Variables
3.9 I/O Redirection
3.9.1 FILE Streams and File Descriptors
3.9.2 FILE Stream I/O and System Call
3.9.3 Redirect stdin
3.9.4 Redirect stdout
3.10 Pipes
3.10.1 Pipe Programming in Unix/Linux
3.10.2 Pipe Command Processing
3.10.3 Connect PIPE writer to PIPE reader
3.10.4 Named pipes
3.11 Programming Project: sh Simulator
3.11.1 Single Command with I/O Redirection
3.11.2 Commands with Pipes
3.11.3 ELF executable vs. sh script files
3.11.4 Sample Solution
3.12 Summary
References
Chapter 4: Concurrent Programming
4.1 Introduction to Parallel Computing
4.1.1 Sequential Algorithms vs. Parallel Algorithms
4.1.2 Parallelism vs. Concurrency
4.2 Threads
4.2.1 Principle of Threads
4.2.2 Advantages of Threads
4.2.3 Disadvantages of Threads
4.3 Threads Operations
4.4 Threads Management Functions
4.4.1 Create Thread
4.4.2 Thread ID
4.4.3 Thread Termination
4.4.4 Thread Join
4.5 Threads Example Programs
4.5.1 Sum of Matrix by Threads
4.5.2 Quicksort by Threads
4.6 Threads Synchronization
4.6.1 Mutex Locks
4.6.2 Deadlock Prevention
4.6.3 Condition Variables
4.6.4 Producer-Consumer Problem
4.6.5 Semaphores
4.6.6 Barriers
4.6.7 Solve System of Linear Equations by Concurrent Threads
4.6.8 Threads in Linux
4.7 Programming Project: User-Level Threads
4.7.1 Project Base Code: A Multitasking System
4.7.2 User-Level Threads
4.7.3 Implementation of Thread Join Operation
4.7.4 Implementation of Mutex Operations
4.7.5 Test Project with Mutex by Concurrent Programs
4.7.6 Implementation of Semaphores
4.7.7 Producer-Consumer Problem using Semaphores
4.8 Summary
References
Chapter 5: Timers and Time Service
5.1 Hardware Timer
5.2 PC Timers
5.3 CPU Operations
5.4 Interrupt Processing
5.5 Time Service Functions
5.5.1 Gettimeofday-Settimeofday
5.5.2 The Time System Call
5.5.3 The Times System Call
5.5.4 Time and Date Commands
5.6 Interval Timers
5.7 REAL Mode Interval Timer
5.8 Programming Project
5.8.1 System Base Code
5.8.2 Timer Interrupts
5.8.3 Timer Queue
5.8.4 Critical Regions
5.8.5 Advanced Topics
5.9 Summary
References
Chapter 6: Signals and Signal Processing
6.1 Signals and Interrupts
6.2 Examples of Unix/Linux Signals
6.3 Signal Processing in Unix/Linux
6.3.1 Signal Types
6.3.2 Origin of Signals
6.3.3 Signals in Process PROC Structure:
6.3.4 Signal Handlers
6.3.5 Install Signal Catchers
6.4 Signal Processing Steps
6.5 Signals and Exceptions
6.6 Signals as IPC
6.7 IPC in Linux
6.7.1 Pipes and FIFOs
6.7.2 Signals
6.7.3 System V IPC
6.7.4 POSIX Message Queues
6.7.5 Threads Synchronization Mechanisms
6.7.6 Sockets
6.8 Programming Project: Implement an IPC for Messages
6.9 Summary
References
Chapter 7: File Operations
7.1 File Operation Levels
7.2 File I/O Operations
7.3 Low Level File Operations
7.3.1 Partitions
7.3.2 Format Partitions
7.3.3 Mount Partitions
7.4 Introduction to EXT2 File System
7.4.1 EXT2 File System Data Structures
7.4.2 Superblock
7.4.3 Group Descriptor
7.4.4 Bitmaps
7.4.5 Inodes
7.4.6 Directory Entries
7.5 Programming Examples
7.5.1 Display Superblock
7.5.2 Display Bitmaps
7.5.3 Display root Inode
7.5.4 Display Directory Entries
7.6 Programming Project: Convert File Pathname to Inode
7.7 Summary
References
Chapter 8: System Calls for File Operations
8.1 Systems Calls
8.2 System Call Man Pages
8.3 System Calls for File Operations
8.4 Commonly used system Calls
8.5 Link Files
8.5.1 Hard Link Files
8.5.2 Symbolic Link Files
8.6 The stat Systen Call
8.6.1 Stat File Status
8.6.1.1 STAT(2) Linux ProgrammerΒ΄s Manual STAT(2)
8.6.2 The stat Structure
8.6.3 Stat and File Inode
8.6.4 File Type and Permissions
8.6.5 Opendir-Readdir Functions
8.6.6 Readlink Function
8.6.7 The ls Program
8.7 open-close-lseek System Calls
8.7.1 Open File and File Descriptor
8.7.2 Close File Descriptor
8.7.3 lseek File Descriptor
8.8 Read() System Call
8.9 Write() System Call
8.10 File Operation Example Programs
8.10.1 Display File Contents
8.10.2 Copy Files
8.10.3 Selective File Copy
8.11 Programming Project: Recursive Copy Files using System Calls
8.11.1 Hints and Helps
8.11.2 Sample Solution
8.12 Summary
References
Chapter 9: Library I/O Functions
9.1 Library I/O Functions
9.2 Library I/O Functions vs. System Calls
9.3 Algorithms of Library I/O Functions
9.3.1 Algorithm of fread
9.3.2 Algorithm of fwrite
9.3.3 Algorithm of fclose
9.4 Use Library I/O Function or System Call
9.5 Library I/O Modes
9.5.1 Char Mode I/O
9.5.2 Line mode I/O
9.5.3 Formatted I/O
9.5.4 In-memory Conversion Functions
9.5.5 Other Library I/O Functions
9.5.6 Restriction on Mixed fread-fwrite
9.6 File Stream Buffering
9.7 Functions with Varying Parameters
9.8 Programming Project: Printf-like Function
9.8.1 Project Specification
9.8.2 Base Code of Project
9.8.3 Algorithm of myprintf()
9.8.4 Project Refinements
9.8.5 Project Demonstration and Sample Solutions
9.9 Summary
References
Chapter 10: Sh Programming
10.1 sh Scripts
10.2 sh Scripts vs. C Programs
10.3 Command-line parameters
10.4 Sh Variables
10.5 Quotes in sh
10.6 sh Statements
10.7 sh Commands
10.7.1 Built-in Commands
10.7.2 Linux Commands
10.8 Command Substitution
10.9 Sh Control Statements
10.9.1 if-else-fi statement
10.9.2 for Statement
10.9.3 while Statement
10.9.4 until-do Statement
10.9.5 case Statement
10.9.6 continue and break Statements
10.10 I/O Redirection
10.11 Here Documents
10.12 sh Functions
10.13 Wild Cards in sh
10.14 Command Grouping
10.15 eval Statement
10.16 Debugging sh Scripts
10.17 Applications of sh scripts
10.18 Programming Project: Recursive File Copy by sh Script
10.19 Summary
References
Chapter 11: EXT2 File System
11.1 EXT2 File System
11.2 EXT2 File System Data Structures
11.2.1 Create Virtual Disk by mkfs
11.2.2 Virtual Disk Layout
11.2.3 Superblock
11.2.4 Group Descriptors
11.2.5 Block and Inode Bitmaps
11.2.6 Inodes
11.2.7 Data Blocks
11.2.8 Directory Entries
11.3 MailmanΒ΄s Algorithm
11.3.1 Test-Set-Clear Bits in C
11.3.2 Convert INODE Number to INODE on Disk
11.4 Programming Examples
11.4.1 Display Superblock
11.4.2 Display Bitmaps
11.4.3 Display Root Inode
11.4.4 Display Directory Entries
11.5 Traverse EXT2 File System Tree
11.5.1 Traversal Algorithm
11.5.2 Convert Pathname to INODE
11.5.3 Display INODE Disk Blocks
11.6 Implementation of EXT2 File System
11.6.1 File System Organization
11.6.2 Files System Levels
11.7 Base File System
11.7.1 type.h file
11.7.2 Utility Functions
11.7.3 Mount-Root
11.7.4 Implementation of Base File System
11.8 File System Level-1 Functions
11.8.1 Algorithm of mkdir
11.8.2 Algorithm of creat
11.8.3 Implementation of mkdir-creat
11.8.4 Algorithm of rmdir
11.8.5 Implementation of rmdir
11.8.6 Algorithm of link
11.8.7 Algorithm of unlink
11.8.8 Algorithm of symlink
11.8.9 Algorithm of readlink
11.8.10 Other Level-1 Functions
11.8.11 Programming Project #1: Implementation of File System Level-1
11.9 File System Level-2 Functions
11.9.1 Algorithm of open
11.9.2 lseek
11.9.3 Algorithm of close
11.9.4 Read Regular Files
11.9.5 Write Regular Files
11.9.6 Opendir-Readdir
11.9.7 Programming Project #2: Implementation of File System Level-2
11.10 File System Level-3
11.10.1 Algorithm of mount
11.10.2 Algorithm of umount
11.10.3 Cross Mounting Points
11.10.4 File Protection
11.10.5 Real and Effective uid
11.10.6 File Locking
11.10.7 Programming Project #3: Implementation of Complete File System
11.11 Extensions of File System Project
11.12 Summary
References
Chapter 12: Block Device I/O and Buffer Management
12.1 Block Device I/O Buffers
12.2 Unix I/O Buffer Management Algorithm
12.2.1 Shortcomings of Unix Algorithm
12.3 New I/O Buffer Management Algorithm
12.3.1 Buffer Management Algorithm using Semaphores
12.4 PV Algorithm
12.5 Programming Project: Comparison of I/O Buffer Management Algorithms
12.5.1 System Organization
12.5.2 Multitasking System
12.5.3 Buffer Manager
12.5.4 Disk Driver
12.5.5 Disk Controller
12.5.6 Disk Interrupts
12.5.7 Virtual Disks
12.5.8 Project Requirements
12.5.9 Sample Base Code
12.5.10 Sample Solutions
12.6 Refinements of Simulation System
12.7 Refinements of PV Algorithm
12.8 Summary
References
Chapter 13: TCP/IP and Network Programming
13.1 Introduction to Network Programming
13.2 TCP/IP Protocol
13.3 IP Host and IP address
13.4 IP Protocol
13.5 IP Packet Format
13.6 Routers
13.7 UDP User Datagram Protocol
13.8 TCP Transmission Control Protocol
13.9 Port Number
13.10 Network and Host Byte Orders
13.11 Data Flow in TCP/IP Networks
13.12 Network Programming
13.12.1 Network Programming Platforms
13.12.2 Server-Client Computing Model
13.13 Socket Programming
13.13.1 Socket Address
13.13.2 The Socket API
13.14 UDP Echo Server-Client Program
13.15 TCP Echo Server-Client Program
13.16 Hostname and IP Address
13.17 TCP Programming Project: File Server on Internet
13.17.1 Project Specification
13.17.2 Helps and Hints
13.17.3 Multi-threaded TCP Server
13.18 Web and CGI Programming
13.18.1 HTTP Programming Model
13.18.2 Web Pages
13.18.3 Hosting Web Pages
13.18.4 Configure HTTPD for Web Pages
13.18.5 Dynamic Web Pages
13.18.6 PHP
13.18.7 CGI Programming
13.18.8 Configure HTTPD for CGI
13.19 CGI Programming Project: Dynamic Webpage by CGI
13.20 Summary
References
Chapter 14: MySQL Database System
14.1 Introduction to MySQL
14.2 Install MySQL
14.2.1 Ubuntu Linux
14.2.2 Slackware Linux
14.3 Use MySQL
14.3.1 Connect to MySQL Server
14.3.2 Show Databases
14.3.3 Create New database
14.3.4 Drop Database
14.3.5 Choose Database
14.3.6 Create Tables
14.3.7 Drop Tables
14.3.8 Data Types in MySQL
14.3.9 Insert Rows
14.3.10 Delete Rows
14.3.11 Update Table
14.3.12 Alter Table
14.3.13 Related Tables
14.3.14 Join Operations
14.3.15 MySQL Database Diagram
14.3.16 MySQL Scripts
14.4 MySQL Programming in C
14.4.1 Build MySQL Client Program in C
14.4.2 Connect to MySQL Server in C
14.4.3 Build MySQL Database in C
14.4.4 Retrieve Results of MySQL Queries in C
14.5 MySQL Programming in PHP
14.5.1 Connect to MySQL Server in PHP
14.5.2 Create Database Tables in PHP
14.5.3 Insert Records into Table in PHP
14.5.4 Retrieve Results of MySQL Queries in PHP
14.5.5 Update Operation in PHP
14.5.6 Delete Rows in PHP
14.6 Summary
References
Index


πŸ“œ SIMILAR VOLUMES


Systems Programming in Unix/Linux
✍ K.C. Wang πŸ“‚ Library πŸ“… 2018 πŸ› Springer 🌐 English

Covering all the essential components of Unix/Linux, including process management, concurrent programming, timer and time service, file systems and network programming, this textbook emphasizes programming practice in the Unix/Linux environment. Systems Programming in Unix/Linux is intended as a tex

Systems Programming in Unix/Linux
✍ Wang, K.C πŸ“‚ Library πŸ“… 2018 πŸ› Springer International Publishing 🌐 English

Covering all the essential components of Unix/Linux, including process management, concurrent programming, timer and time service, file systems and network programming, this textbook emphasizes programming practice in the Unix/Linux environment. Systems Programming in Unix/Linux is intended as a tex

The Linux programming interface: a Linux
✍ Michael Kerrisk πŸ“‚ Library πŸ“… 2010 πŸ› No Starch Press 🌐 English

<em>The Linux Programming Interface</em> is the definitive guide to the Linux and UNIX programming interfaceβ€”the interface employed by nearly every application that runs on a Linux or UNIX system. In this authoritative work, Linux programming expert Michael Kerrisk provides detailed descriptions of