Advanced Programming in the UNIX Environment, 3rd Edition

W. Richard Stevens, Stephen A. Rago

出版时间

2013-05-24

ISBN

9780321637734

评分

★★★★★
书籍介绍
For more than twenty years, serious C programmers have relied on one book for practical, in-depth knowledge of the programming interfaces that drive the UNIX and Linux kernels: W. Richard Stevens’ Advanced Programming in the UNIX® Environment . Now, once again, Rich’s colleague Steve Rago has thoroughly updated this classic work. The new third edition supports today’s leading platforms, reflects new technical advances and best practices, and aligns with Version 4 of the Single UNIX Specification. Steve carefully retains the spirit and approach that have made this book so valuable. Building on Rich’s pioneering work, he begins with files, directories, and processes, carefully laying the groundwork for more advanced techniques, such as signal handling and terminal I/O. He also thoroughly covers threads and multithreaded programming, and socket-based IPC. This edition covers more than seventy new interfaces, including POSIX asynchronous I/O, spin locks, barriers, and POSIX semaphores. Most obsolete interfaces have been removed, except for a few that are ubiquitous. Nearly all examples have been tested on four modern platforms: Solaris 10, Mac OS X version 10.6.8 (Darwin 10.8.0), FreeBSD 8.0, and Ubuntu version 12.04 (based on Linux 3.2). As in previous editions, you’ll learn through examples, including more than ten thousand lines of downloadable, ISO C source code. More than four hundred system calls and functions are demonstrated with concise, complete programs that clearly illustrate their usage, arguments, and return values. To tie together what you’ve learned, the book presents several chapter-length case studies, each reflecting contemporary environments. Advanced Programming in the UNIX® Environment has helped generations of programmers write code with exceptional power, performance, and reliability. Now updated for today’s systems, this third edition will be even more valuable.
AI导读
核心看点
  • UNIX环境高级编程经典,深入解析内核接口
  • 涵盖文件、进程、信号处理及网络编程
  • 基于Single UNIX Specification第四版更新
适合谁读
  • 具备C语言基础的系统级开发者
  • 希望深入理解UNIX/Linux内核机制者
  • 需要查阅系统调用细节的资深程序员
读前提醒
  • 建议带着具体问题查阅,避免通读陷入细节
  • 部分API较旧,需结合现代平台实践验证
  • 注意区分标准I/O与不带缓冲I/O的差异
读者共识
  • 经典权威,适合反复查阅而非一次性阅读
  • 内容详尽但略显啰嗦,部分章节编排欠佳
  • 侧重原理讲解,优于国内同类入门教材

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "Parent and the child share a file table entry for every open descriptor."
  • "大多数UNIX调试程序都使用core文件以检查进程终止时的状态。"
  • "将进程的信号屏蔽字设置为由sigmask指向的值。在捕捉到一个信号或发生了一个会终止该进程的信号之前,该进程被挂起。如果捕捉到一个信号而且从该信号处理程序返回,则sigsuspend返回,并且将该进程的信号屏蔽字设置为调用sigsuspend之前的值。"
  • "与应用程序使用文件描述符(fd)访问文件一样,访问套接字也需要使用套接字描述符,其在unix系统中是用文件描述符实现的。 在AF_INET通信域中套接字SOCK_STREAM的默认协议是TCP,SOCK_DGRAM的默认协议是UDP。 不同处理器架构支持不同的字节序,小端(little-endian)freebsd linux on intel pentium,大端(big-endian)mac os on power pc solaris on sun sparc,有些处理器可以配置大端和小端,更加混乱。 TCP/IP 采用大端字节序。对于TCP/IP,地址是使用网络字节序来表示,所以应用程"
  • "由open返回的文件描述符一定是最小的未用描述符数值。这一点被某些应用程序用来在标准输入,标准输出或标准错误输出上打开新的文件。"
  • "其中,atexit的参数是一个函数地址,当调用此函数时无需向它传送任何参数,也不期望它返回一个值。exit以登记这些函数的相反顺序调用它们。同一函数如若登记多次,则也被调用多次。"
  • "如果 name 不是一个合适的常量,则所有这三个函数都会返回 -1,并将 errno 设置为 EINVAL。"
  • "Although sbrk can expand or contract the memory of a process, most versions of malloc and free never decrease their memory size. The space that we free is available for a later allocation, but the freed space is not usually returned to the kernel; that space is kept in the malloc pool."
作者简介
The late W. Richard Stevens was the acclaimed author of UNIX® Network Programming, Volumes 1 and 2, widely recognized as the classic texts in UNIX networking; TCP/IP Illustrated, Volumes 1-3; and the first edition of this book. Stephen A. Rago is the author of UNIX® System V Network Programming (Addison-Wesley, 1993). Rago was one of the Bell Laboratories developers who built UNIX System V Release 4. He served as a technical reviewer for the first edition of Advanced Programming in the UNIX® Environment. Rago currently works as a research staff member in the Storage Systems Group at NEC Laboratories America.
用户评论
这个时间点下真的过气了。照顾多种实现显得过于啰嗦(POSIX自己的锅?),某些章节编排显然不合理(比如I/O Multiplexing放到了network socket之前),内容侧重点不对(以现在要求而言);感觉不如找本针对某个具体platform的
我觉得不好,太啰嗦
值得带着目的读。太精细了,每一个带 at 的函数变体都要交代一遍具体行为,确实帮读者省下了前后互见的时间,但有点详略不当。第一版传承下来的万能菜谱思路让一些章节味同嚼蜡,读者希望得到实现原理,而不是加长加厚的 man 参数列表。各种标志、掩码的介绍可以交给互联网,作者更擅长解说复杂体系。
四星半,半星扣在API太旧。是很经典的系统编程手册,需要反复翻阅。
3rd Edition!经典重现。
就算读过吧
下载
收藏