Advanced Programming in the UNIX Environment

Why settle for good when you can be great? Learn advanced UNIX programming interactively and own your career path.

(ADV-PROG-UNIX.AP1) / ISBN : 978-1-64459-512-1
Lessons
Lab
AI Tutor (Add-on)
Get A Free Trial

About This Course

Enroll in our advanced UNIX programming course to master the intricate interfaces driving UNIX and Linux kernels, just like generations of serious C programmers have.

In this course, you'll dive deep into files, directories, processes, signal handling, terminal I/O, threads, multithreaded programming, and socket-based IPC. We'll cover 70+ new interfaces, including POSIX asynchronous I/O, spin locks, barriers, and POSIX semaphores. 

You'll gain hands-on experience with more than ten thousand lines of downloadable, ISO C source code, testing nearly all examples on modern platforms like Solaris 10, Mac OS X, FreeBSD, and Ubuntu.

From fundamental file I/O to advanced interprocess communication and network IPC, you’ll get hands-on with real-world examples and extensive lab activities. This means you can start writing code with exceptional power, performance, and reliability.    

Skills You’ll Get

  • File System Mastery: Manipulate files and directories with precision.
  • Process Control: Manage and orchestrate system processes effectively.
  • Interprocess Communication (IPC): Facilitate seamless communication between programs.
  • Thread Management: Implement and control concurrent execution with threads.
  • Network Programming: Develop robust network applications using sockets.

1

Preface

  • Introduction
  • Changes from the Second Edition
2

UNIX System Overview

  • Introduction
  • UNIX Architecture
  • Logging In
  • Files and Directories
  • Input and Output
  • Programs and Processes
  • Error Handling
  • User Identification
  • Signals
  • Time Values
  • System Calls and Library Functions
  • Summary
  • Exercises
3

UNIX Standardization and Implementations

  • Introduction
  • UNIX Standardization
  • UNIX System Implementations
  • Relationship of Standards and Implementations
  • Limits
  • Options
  • Feature Test Macros
  • Primitive System Data Types
  • Differences Between Standards
  • Summary
  • Exercises
4

File I/O

  • Introduction
  • File Descriptors
  • open and openat Functions
  • creat Function
  • close Function
  • lseek Function
  • read Function
  • write Function
  • I/O Efficiency
  • File Sharing
  • Atomic Operations
  • dup and dup2 Functions
  • sync, fsync, and fdatasync Functions
  • fcntl Function
  • ioctl Function
  • /dev/fd
  • Summary
  • Exercises
5

Files and Directories

  • Introduction
  • stat, fstat, fstatat, and lstat Functions
  • File Types
  • Set-User-ID and Set-Group-ID
  • File Access Permissions
  • Ownership of New Files and Directories
  • access and faccessat Functions
  • umask Function
  • chmod, fchmod, and fchmodat Functions
  • Sticky Bit
  • chown, fchown, fchownat, and lchown Functions
  • File Size
  • File Truncation
  • File Systems
  • link, linkat, unlink, unlinkat, and remove Functions
  • rename and renameat Functions
  • Symbolic Links
  • Creating and Reading Symbolic Links
  • File Times
  • futimens, utimensat, and utimes Functions
  • mkdir, mkdirat, and rmdir Functions
  • Reading Directories
  • chdir, fchdir, and getcwd Functions
  • Device Special Files
  • Summary of File Access Permission Bits
  • Summary
  • Exercises
6

Standard I/O Library

  • Introduction
  • Streams and FILE Objects
  • Standard Input, Standard Output, and Standard Error
  • Buffering
  • Opening a Stream
  • Reading and Writing a Stream
  • Line-at-a-Time I/O
  • Standard I/O Efficiency
  • Binary I/O
  • Positioning a Stream
  • Formatted I/O
  • Implementation Details
  • Temporary Files
  • Memory Streams
  • Alternatives to Standard I/O
  • Summary
  • Exercises
7

System Data Files and Information

  • Introduction
  • Password File
  • Shadow Passwords
  • Group File
  • Supplementary Group IDs
  • Implementation Differences
  • Other Data Files
  • Login Accounting
  • System Identification
  • Time and Date Routines
  • Summary
  • Exercises
8

Process Environment

  • Introduction
  • main Function
  • Process Termination
  • Command-Line Arguments
  • Environment List
  • Memory Layout of a C Program
  • Shared Libraries
  • Memory Allocation
  • Environment Variables
  • setjmp and longjmp Functions
  • getrlimit and setrlimit Functions
  • Summary
  • Exercises
9

Process Control

  • Introduction
  • Process Identifiers
  • fork Function
  • vfork Function
  • exit Functions
  • wait and waitpid Functions
  • waitid Function
  • wait3 and wait4 Functions
  • Race Conditions
  • exec Functions
  • Changing User IDs and Group IDs
  • Interpreter Files
  • system Function
  • Process Accounting
  • User Identification
  • Process Scheduling
  • Process Times
  • Summary
  • Exercises
10

Process Relationships

  • Introduction
  • Terminal Logins
  • Network Logins
  • Process Groups
  • Sessions
  • Controlling Terminal
  • tcgetpgrp, tcsetpgrp, and tcgetsid Functions
  • Job Control
  • Shell Execution of Programs
  • Orphaned Process Groups
  • FreeBSD Implementation
  • Summary
  • Exercises
11

Signals

  • Introduction
  • Signal Concepts
  • signal Function
  • Unreliable Signals
  • Interrupted System Calls
  • Reentrant Functions
  • SIGCLD Semantics
  • Reliable-Signal Terminology and Semantics
  • kill and raise Functions
  • alarm and pause Functions
  • Signal Sets
  • sigprocmask Function
  • sigpending Function
  • sigaction Function
  • sigsetjmp and siglongjmp Functions
  • sigsuspend Function
  • abort Function
  • system Function
  • sleep, nanosleep, and clock_nanosleep Functions
  • sigqueue Function
  • Job-Control Signals
  • Signal Names and Numbers
  • Summary
  • Exercises
12

Threads

  • Introduction
  • Thread Concepts
  • Thread Identification
  • Thread Creation
  • Thread Termination
  • Thread Synchronization
  • Summary
  • Exercises
13

Thread Control

  • Introduction
  • Thread Limits
  • Thread Attributes
  • Synchronization Attributes
  • Reentrancy
  • Thread-Specific Data
  • Cancel Options
  • Threads and Signals
  • Threads and fork
  • Threads and I/O
  • Summary
  • Exercises
14

Daemon Processes

  • Introduction
  • Daemon Characteristics
  • Coding Rules
  • Error Logging
  • Single-Instance Daemons
  • Daemon Conventions
  • Client–Server Model
  • Summary
  • Exercises
15

Advanced I/O

  • Introduction
  • Nonblocking I/O
  • Record Locking
  • I/O Multiplexing
  • Asynchronous I/O
  • readv and writev Functions
  • readn and writen Functions
  • Memory-Mapped I/O
  • Summary
  • Exercises
16

Interprocess Communication

  • Introduction
  • Pipes
  • popen and pclose Functions
  • Coprocesses
  • FIFOs
  • XSI IPC
  • Message Queues
  • Semaphores
  • Shared Memory
  • POSIX Semaphores
  • Client–Server Properties
  • Summary
  • Exercises
17

Network IPC: Sockets

  • Introduction
  • Socket Descriptors
  • Addressing
  • Connection Establishment
  • Data Transfer
  • Socket Options
  • Out-of-Band Data
  • Nonblocking and Asynchronous I/O
  • Summary
  • Exercises
18

Advanced IPC

  • Introduction
  • UNIX Domain Sockets
  • Unique Connections
  • Passing File Descriptors
  • An Open Server, Version 1
  • An Open Server, Version 2
  • Summary
  • Exercises
19

Terminal I/O

  • Introduction
  • Overview
  • Special Input Characters
  • Getting and Setting Terminal Attributes
  • Terminal Option Flags
  • stty Command
  • Baud Rate Functions
  • Line Control Functions
  • Terminal Identification
  • Canonical Mode
  • Noncanonical Mode
  • Terminal Window Size
  • termcap, terminfo, and curses
  • Summary
  • Exercises
20

Pseudo Terminals

  • Introduction
  • Overview
  • Opening Pseudo-Terminal Devices
  • pty_fork Function
  • pty Program
  • Using the pty Program
  • Advanced Features
  • Summary
  • Exercises
21

A Database Library

  • Introduction
  • History
  • The Library
  • Implementation Overview
  • Centralized or Decentralized?
  • Concurrency
  • Building the Library
  • Source Code
  • Performance
  • Summary
  • Exercises
22

Communicating with a Network Printer

  • Introduction
  • The Internet Printing Protocol
  • The Hypertext Transfer Protocol
  • Printer Spooling
  • Source Code
  • Summary
  • Exercises
A

Appendix B. Miscellaneous Source Code

  • B.1. Our Header File
  • B.2. Standard Error Routines

1

File I/O

  • Using the open, openat, and lseek Functions
  • Performing File Operations
  • Using File Synchronization Functions
2

Files and Directories

  • Retrieving File Metadata Using System Calls
  • Managing File Access Permissions
  • Using the umask Function
  • Managing Ownership of Files and Directories
  • Managing and Analyzing Files
  • Managing Files and Directories
  • Creating and Reading Symbolic Links
  • Managing File Timestamps
  • Performing File Timestamp Operations
  • Traversing the File Hirerachy
  • Reading and Managing Directories
3

Standard I/O Library

  • Using the fwide Function
  • Handling Standard Input, Output, and Error
  • Performing File Stream Operations
  • Exploring File I/O Techniques
  • Positioning a Stream
  • Formatting I/O
  • Creating Temporary Files
  • Using Memory Streams
4

System Data Files and Information

  • Retrieving System Information
  • Handling Time and Data Routines
5

Process Environment

  • Creating the main Function
  • Using Command-Line Arguments
  • Allocating Dynamic Memory
  • Using Environment Variables
  • Handling Non-Local Jumps and Resource Limits
6

Process Control

  • Identifying Processes
  • Creating and Terminating a Process
  • Demonstrating Race Conditions in Process Synchronization
  • Using exec Functions
  • Using Process Accounting, Scheduling, and User Identification
7

Process Relationships

  • Using the setsid and getsid Functions
  • Using the tcgetpgrp, tcsetpgrp, and tcgetsid Functions
  • Managing Jobs
  • Handling Orphaned Process Groups
8

Signals

  • Using the kill and raise Functions
  • Handling Signals
  • Handling Advanced Signals
  • Using the system Function
  • Using the Sleep and Signal Queue Functions
9

Threads

  • Managing Thread Identification, Creation, Termination, and Synchronization
10

Thread Control

  • Configuring Synchronization Attributes
  • Using Threads with Signals, Forks, and I/O
11

Daemon Processes

  • Using Error Logging
  • Using Single-Instance Daemons and Daemon Conventions
12

Advanced I/O

  • Using Record Locking
  • Using I/O Multiplexing
  • Using Nonblocking and Asynchronous I/O
  • Performing Buffered and Vectorized I/O Operations
  • Performing Memory-Mapped I/O
13

Interprocess Communication

  • Using Coprocesses
  • Using Named Pipes
  • Using Interprocess Communication
  • Using Semaphores
  • Using POSIX Semaphores
14

Network IPC: Sockets

  • Managing Socket Descriptors
  • Performing Network Addressing and Byte Order Operations in Sockets
  • Performing Data Transfer in Sockets
  • Using the OOB Flag
15

Advanced IPC

  • Using File Descriptors in Sockets
16

Terminal I/O

  • Getting and Setting Terminal Attributes
  • Using the Baud Rate and Line Control Functions
  • Using Canonical Mode and Noncanonical Mode
  • Using the termcap, terminfo, and curses Libraries
17

Pseudo Terminals

  • Opening Pseudo-Terminal Devices
18

A Database Library

  • Building a Library

Any questions?
Check out the FAQs

  Want to Learn More?

Contact Us Now

Unix is primarily written in C, which was actually developed to build Unix itself.

Absolutely. Unix powers critical systems in servers, finance, cloud infrastructure, and macOS (which is Unix-based).

The key prerequisite is a solid grasp of the C programming language. 

While some courses might recommend familiarity with basic UNIX commands and operating system concepts, the core understanding needed is strong C programming skills. This UNIX system programming course focuses on system libraries rather than teaching fundamental C syntax.

  • Start with fundamentals: Learn basic commands (ls, cd, grep, awk, sed), file systems, permissions, and shell scripting.
  • Practice daily: Use Linux/UNIX terminals (Ubuntu, CentOS, FreeBSD) or online sandboxes.
  • Take structured courses: Enroll in this advanced UNIX programming course.
  • Read books: "The UNIX Programming Environment" or "UNIX and Linux System Administration Handbook".
  • Work on projects: Automate tasks, manage servers, or contribute to open-source UNIX tools.

  • Master shell scripting (Bash, Zsh) and text processing (awk, sed, regex).
  • Learn system administration: User/group management, cron jobs, networking, and security (SSH, firewalls).
  • Understand kernel/OS internals: Process management, filesystems, system calls.
  • Get certified: Red Hat (RHCSA/RHCE), Linux Foundation (LFCS/LFCE), or UNIX certifications.
  • Solve real problems: Manage servers, debug crashes, or optimize performance.
  • Join communities: UNIX/Linux forums, GitHub, or local meetups to learn from experts.

Related Courses

All Course
scroll to top