Next:
Contents
Contents
Ceng 425 System Programming
Cem Özdogan
Date:
16 May 2007
Contents
List of Tables
List of Figures
Getting Started
Compiling with GCC
Compiling a Single Source File
Optimization Options
Linking Object Files
Common Command-line Options
Error Checking and Warnings
Automating the Process with GNU Make
Debugging with GNU Debugger (GDB)
Compiling with Debugging Information
Running GDB
Finding More Information
Man Pages
Header Files
SYSTEMS PROGRAMMING LABORATORY I - Getting Started
Writing Good GNU/Linux Software
Interaction With the Execution Environment
GNU/Linux Command-Line Conventions
Using getopt_long
Standard I/O
Program Exit Codes
The Environment
Using Temporary Files
Coding Defensively
Errors and Resource Allocation
Writing and Using Libraries
Archives
Shared Libraries
Library Dependencies
Pros and Cons
SYSTEMS PROGRAMMING LABORATORY II - Writing Good GNU/Linux Software
Introduction to Shell Programming
What is Linux Shell?
What is Shell Script ?
Getting started with Shell Programming
How to write shell script
Variables in Shell
Shell Arithmetic
Exit Status
The read Statement
Why Command Line arguments required
Redirection of Standard output/input
Shells (bash) structured Language Constructs
Decision making
Loops
How to de-bug the shell script?
Advanced Shell Scripting Commands
Local and Global Shell variable (export command)
Conditional execution i.e.
and
User Interface and dialog utility
Dialog Utility
getopts command
SYSTEMS PROGRAMMING LABORATORY III - Introduction to Shell Programming
Examples&Exercises:
Processes
Looking at Processes
Process IDs
Viewing Active Processes
Killing a Process
Process Control
Attributes
Creating Processes
Using system and popen
Using fork and exec
Using clone
Process Scheduling
Signals
Process Termination
Waiting for Process Termination
The wait System Calls
Zombie Processes
Cleaning Up Children Asynchronously
SYSTEMS PROGRAMMING LABORATORY IV - Processes
Examples&Exercises:
Threads
Thread Creation
Passing Data to Threads
Joining Threads
Thread Return Values
Thread Attributes
Thread Cancellation
Synchronous and Asynchronous Threads
Uncancelable Critical Sections
Thread-Specific Data
Synchronization and Critical Sections
Race Conditions
Mutexes
Mutex Deadlocks
SYSTEMS PROGRAMMING LABORATORY V - Threads I
Examples&Exercises:
Semaphores for Threads
Linux Thread Implementation
Processes Vs. Threads
Interprocess Communication
Shared Memory
Fast Local Communication
The Memory Model
Allocation
Attachment and Detachment
Controlling and Deallocating Shared Memory
Processes Semaphores
Allocation and Deallocation
Initializing Semaphores
Wait and Post Operations
Mapped Memory
Mapping an Ordinary File
Pipes
Communication Between Parent and Child Processes
Redirecting the Standard Input, Output, and Error Streams
FIFOs
SYSTEMS PROGRAMMING LABORATORY VI - Threads II & IPC
Examples&Exercises:
Sockets
Socket Concepts
System Calls
Servers
Local Sockets
An Example Using Local Namespace Sockets
Internet-Domain Sockets
Devices
Device Types
Device Numbers
Device Entries
The /dev Directory
Accessing Devices by Opening Files
Hardware Devices
Special Devices
/dev/null
/dev/zero
/dev/full
Random Number Devices
Loopback Devices
ioctl
SYSTEMS PROGRAMMING LABORATORY VI - IPC II & Devices
Examples&Exercises:
Device Drivers
The Role of the Device Driver
Splitting the Kernel
Loadable Modules
Classes of Devices and Modules
Character devices
Block devices
Network interfaces
Building and Running Modules
The Hello World Module
Kernel Modules Versus Applications
Concurrency in the Kernel
A Few Other Details
Compiling and Loading
Compiling Modules
Loading and Unloading Modules
The Kernel Symbol Table
SYSTEMS PROGRAMMING LABORATORY VIII - Device Drivers
Examples&Exercises:
Linux System Calls
Using strace
access: Testing File Permissions
fcntl: Locks and Other File Operations
fsync: Flushing Disk Buffers
getrlimit and setrlimit: Resource Limits
getrusage: Process Statistics
The mlock Family: Locking Physical Memory
mprotect: Setting Memory Permissions
readlink: Reading Symbolic Links
sysinfo: Obtaining System Statistics
uname
Inline Assembly Code
When to Use Assembly Code
Simple Inline Assembly
Converting an asm to Assembly Instructions
Example
SYSTEMS PROGRAMMING LABORATORY IX - Linux System Calls & Inline Assembly Code
Examples&Exercises:
The /proc File System
Extracting Information from /proc
Process Information
/proc/self
Process Argument List
Process Environment
Process Executable
Process File Descriptors
Process Memory Statistics
Hardware Information
Kernel Information
Drives, Mounts, and File Systems
System Statistics
Secure Programming
Types of Applications
Users and Groups
Process User IDs and Process Group IDs
File System Permissions
Security Hole: Programs Without Execute Permissions
Sticky Bits
Real and Effective IDs
Setuid Programs
More Security Holes
Buffer Overruns
Race Conditions in /tmp
Using system or popen
SYSTEMS PROGRAMMING LABORATORY X - The /proc File System & Secure Programming
Examples&Exercises:
Programming the User Interface
Terminal Control the Hard Way
Controlling Terminals
Using the Terminal Interface
Changing Terminal Modes
Using terminfo
Screen Manipulation with ncurses
About Windows
Illustrating ncurses Initialization and Termination
Input and Output
X Window Programming
The Xlib API
A Sample Xlib Program
The X Toolkit API
Creating Graphical Interfaces
KDE and Qt
The Software Levels
About Qt
About KDE
Events Happen
The Names of Things
Creating and Displaying a Window
Hello Qt
Hello KDE
References:
vita
About this document ...
Cem Ozdogan 2007-05-16