UNIX系统编程(英文版)

UNIX系统编程(英文版)
作 者: 罗宾斯 罗宾斯
出版社: 人民邮电出版社
丛编项: 典藏原版书苑
版权说明: 本书为公共版权或经版权方授权,请支持正版图书
标 签: UNIX
ISBN 出版时间 包装 开本 页数 字数
未知 暂无 暂无 未知 0 暂无

作者简介

  本书提供作译者介绍Kay A.RObbins和Steven RObbins均获麻省理工学院博士学位。他们目前在得克萨斯大学圣安东尼奥分校的计算机科学系任教。...

内容简介

本书是UNIX系统编程的经典教材,是基于最新UNIX标准的参考书,对UNIX编程本质进行了清晰透彻的介绍。本书完全覆盖文件、信号、信号量、POSIX线程以及客户端一服务器通信等内容,对通信、并发和多线程问题进行了深入研究,并对信号和并发等复杂的概念进行了全面深入的解释。本书还包含了关于Web、UDP以及服务器性能等方面的更新内容,这些内容已经在实际教学中得到了广泛验证。书中还提供了大量的实例、练习、可重用的代码以及用于网络通信程序的简化库。.本书从一些代码片段开始介绍如何使用系统调用,阐述了如何设计出完善的UNIX系统软件,从而帮助读者提高技术水平。不管是使用Linux、Solaris、Mac OS X还是基于POSIX的系统的读者,都可以从本书中学习如何设计并实现可靠的UNIX软件。本书给出了对UNIX编程本质清晰透彻的介绍。本书从一些代码片段开始介绍如何使用系统调用,阐述了如何设计出完善的UNIX系统软件,从而帮助读者提高技术水平。..本书对通信、并发和多线程问题进行了深入研究,并对信号和并发等复杂的概念进行了全面。明晰的解释。书中还提供了大量的实例。练习、可重用的代码以及用子网络通信程序的简化库。本书是基子最新UNIX标准的参考书,完全覆盖文件。信号、信号量。POSIX线程以及客户端—服务器通信等内容。本书还包含了关于Web、UDP以及服务器性能等方面的更新内容。这些内容已经在实际教学中得到了广泛验证。...

图书目录

Contents

I Fundamentals

1 Technology’s Impact on Programs

1.1 Terminology of Change

1.2 Time and Speed

1.3 Multiprogramming and Time Sharing

1.4 Concurrency at the Application Level

1.5 Security and Fault Tolerance

1.6 Buffer Overflows for Breaking and Entering

1.7 UNIX Standards

1.8 Additional Reading

2 Programs,Processes and Threads

2.1 How a Program Becomes a Process

2.2 Threads and Thread of Execution

2.3 Layout of a Program Image

2.4 Library Function Calls

2.5 Function Return Values and Errors

2.6 Argument Arrays

2.7 Thread-Safe Functions

2.8 Use of Static Variables

2.9 Structure of Static Objects

2.10 Process Environment

2.11 Process Termination

2.12 Exercise:An env Utility

2.13 Exercise:Message Logging

2.14 Additional Reading

3 Processes in UNIX

3.1 Process Identification

3.2 Process State

3.3 UNIX Process Creation and fork

3.4 The wait Function

3.5 The exec Function

3.6 Background Processes and Daeons

3.7 Critical Sections

3.8 Exercise:Process Chains

3.9 Exercise:Process Fans

3.10 Additional Reading

4 UNIX I /O

4.1 Device Terminology

4.2 Reading and Writing

4.3 Opening and Closing Files

4.4 The select Function

4.5 The poll Function

4.6 File Representation

4.7 Filters and Redirection

4.8 File Control

4.9 Exercise:Atomis Logging

4.10 Exercise:A cat Utility

4.11 Additional Reading

5 Files and Directories

5.1 UNIX File System Navigation

5.2 Directory Access

5.3 UNIX File System Implementation

5.4 Hand Links and Symbolic Links

5.5 Exercise:The which Command

5.6 Exercise: Biffing

5.7 Exercise:News biff

5.8 Exercise:Traversing Directories

5.9 Additional Reading

6 UNIX Special Files

6.1 Pipes

6.2 Pipelines

6.3 FIFOs

6.4 Pipes and the Client-Server Model

6.5 Terminal Control

6.6 Audio Device

6.7 Exercise:Audio

6.8 Exercise:Barriers

6.9 Exercise:The stty Command

6.10 Exercyse:Client-Server Revisited

6.11 Additional Reading

7 Project:The Token Ring

7.1 Ring Topology

7.2 Ring Formation

7.3 Ring Exploration

7.4 Simple Communication

7.5 Mutual Exclusion with Tokens

7.6 Mutual Exclusion by Voting

7.7 Leader Election on an Anonymous Ring

7.8 Token Ring for Communication

7.9 Pipelined Preprocessor

7.10 Parallel Ring Algorithms

7.11 Flexible Ring

7.12 Additional Reading

II Asynchronous Events

8 Signals

8.1 Basic Signal Concepts

8.2 Generating Signals

8.3 Manipulating Signal Masks and Signal Sets

8.4 Catching and Ignoring Signals—sigaction

8.5 Waiting for Signals—pause,sigsuspend and sigwait

8.6 Handling Signals:Errors and Async-signal Safety

8.7 Program Control with siglongjmp and sigsetjmp

8.8 Programming with AsynchronousI/O

8.9 Exercise:Dumping Statistics

8.10 Exercise:Spooling a Slow Device

8.11 Additional Reading

9 Times and Timers

9.1 POSIX Times

9.2 Sleep Functions

9.3 POSIX:XSI Interval Timers

9.4 Realtime Signals

9.5 POSIX:TMR Interval Timers

9.6 Timer Drift,Overruns and Absolute Time

9.7 Additional Reading

10 Project:Virtual Timers

10.1 Project Overview

10.2 Simple Timers

10.3 Setting One of Five Single Timers

10.4 Using Multiple Timers

10.5 A Robust Implementation of Multiple Timers

10.6 POSIX:TMR T imer Implementation

10.7 Mycron,a Small Cron Facility

10.8 Additional Reading

11 Project:Cracking Shells

11.1 Building a Simple Shell

11.2 Redirection

11.3 Pipelines

11.4 Signal Handling in the Foreground

11.5 Process Groups,Sessions and Controlling Terminals

11.6 Background Processes in ush

11.7 Job Control

11.8 JobControl for ush

11.9 Additional Reading

III Concurrency

12 POSIX Threads

12.1 A Motivating Problem:Monitoring File Descriptors

12.2 Use of Threads to Monitor Multiple File Descriptors

12.3 Thread Management

12.4 Thread Safety

12.5 User Threads versus Kernel Threads

12.6 Thread Attributes

12.7 Exercise:Paralel File Copy

12.8 Additional Reading

13 Thread Synchronization

13.1 POSIX Synchronization Functions

13.2 Mutex Locks

13.3 At-Most-Once and At-Least-Once-Execution

13.4 Condition Variables

13.5 Signal Handling and Threads

13.6 Readers and Writers

13.7 A strerror_r Implementation

13.8 Deadlocks and Other Pesky Problems

13.9 Exercise:Multiple Barriers

13.10 Additional Reading

14 Critical Sections and Semaphores

14.1 Dealing with Critical Sections

14.2 Semaphores

14.3 POSIX:SEM Unnamed Semaphores

14.4 POSIX:SEM Semaphore Operations

14.5 POSIX:SEM Named Semaphores

14.6 Exercise:License Manager

14.7 Additional Reading

15 POSIX IPC

15.1 POSIX:XSI Interprocess Communication

15.2 POSIX:XSI Semaphore Sets

15.3 POSIX:XSI Shared Memory

15.4 POSIX:XSI Message Queues

15.5 Exercise:POSIX Unnamed Semaphores

15.6 Exercise:POSIX Named Semaphores

15.7 Exercise:Implementing Pipes with Shared Memory

15.8 Exercise:Implementing Pipes with Message Queues

15.9 Additional Reading

16 Project:Producer Consumer Synchronization

16.1 The Producer-Consumer roblem

16.2 B ounded Buffer Protected by Mutex Locks

16.3 Buffer Implementation with Semaphores

16.4 Introduction to a Simple Producer-Consumer Problem

16.5 Bounded Buffer Implementation Using Condition Variables

16.6 Buffers with Done Conditions

16.7 Parallel File Copy

16.8 Threaded Print Server

16.9 Additional Reading

17 Project:The Not Too Parallel Virtual Machine

17.1 PVM History, Terminology,and Architecture

17.2 The Not Too Parallel Virtual Machine

17.3 NTPVM Project Overview

17.4 I/O and Testing of Dispatcher

17.5 Single Task with No Input

17.6 Sequential Tasks

17.7 Concurrent Tasks

17.8 Packet Communication,Broadcast and Barriers

17.9 Termination and Signals

17.10 Ordered Message Delivery

17.11 Additional Reading

IV Communication

18 Connection-Oriented Communication

18.1 The Client-Server Modle

18.2 Communication Channels

18.3 Connection-Oriented Server Strategies

18.4 Universal Internet Communication Interface(UICI)

18.5 UICI Imlementations of Different Server Strategies

18.6 UICI Clients

18.7 Socket Implementatiln of UICI

18.8 Host Names and IP Addresses

18.9 Thread-Safe UICI

18.10 Exercise:Ping Server

18.11 Exercise:Transmission of Audio

18.12 Additional Reading

19 Project:WWW Redirection

19.1 The World Wide Web

19.2 Uniform Resource Locators(URLs)

19.3 http Primer

19.4 Web Communication Patterns

19.5 Pass-through Monitoring of Single Connections

19.6 Tunnel Server Implementation

19.7 Server Driver for Testing

19.8 HTTP Header Parsing

19.9 Simple Proxy Server

19.10 Proxy Monitor

19.11 Proxy Cache

19.12 Gateways as Portals

19.13 Gateway for Load Balancing

19.14 Postmortem

19.15 Additional Reading

20 Connectionless Communication and Multicasst

20.1 Introduction to Connectionless Communication

20.2 Simplifie Interface for Connectionless Communication

20.3 Simple-Request Protocols

20.4 Request-Reply Protocols

20.5 Request-Reply with Timeouts and Retries

20.6 Request-Reply-Acknowledge Protocols

20.7 Implementation of UICI UDP

20.8 Comparison of UDP and TCP

20.9 Multicast

20.10 Exercise:UDP Port Server

20.11 Exercise:Stateless File Server

20.12 Additional Reading

21 Project:Internet Radio

21.1 Project Overview

21.2 Audio Device Simulation

21.3 UDP Implementation with One Program and One Receiver

21.4 UDP Implementation with Multiple Programs and Receivers

21.5 UDP Implementation of Radio Broadcasts

21.6 Multicast Implementation of Radio Broadcasts

21.7 TCP Implementation Differences

21.8 Receiving Streaming Audio Through a Browser

21.9 Additional Reading

22 Project: Server Performance

22.1 Server Performance Costs

22.2 Server Architectures

22.3 Roject Overview

22.4 Single-Client Driver

22.5 Multiple-Client Driver

22.6 Thread-per-request and Process- per-request Implementations

22.7 Thread-worker-pool Strategy

22.8 Thread-worker Pool with Bounded Buffer

22.9 Process-worker Pool

22.10 Influence of Disk I/O

22.11 Performance Studies

22.12 Report Writing

22.13 Additional Reading

Appendices

A UNIX Fundamentals

A.1 Manual Pages

A.2 Compilation

A.3 Makefiles

A.4 Debugging Aids

A.5 Identifiers,Storage Classes and Linkage Classes

A.6 Additional Reading

B Restart Library

C UICI Implementation

C.1 Connection-Oriented UICI TCP Implementation

C.2 Name Resolution Implementations

C.3 Connectionless UICI UDP Implementation

D Logging Functions

D.1 Local Atomic Logging

D.2 Remote Logging

E POSIX Extensions

Bibiography

Program Index

Inedx