LWN.net Logo

Don't forget the classic

Don't forget the classic

Posted Dec 6, 2007 16:55 UTC (Thu) by vmole (guest, #111)
Parent article: Book review: Linux System Programming

While not Linux specific, and missing some of the shiny new stuff such as epoll(), you can't go wrong with Richard Stevens's _Advanced Programming in the Unix Environment_. Good examples, often comparing subtle differences in the way things are called, consideration of race conditions and re-entrancy, and, at the end, four good-sized example projects tying it all together. And despite the title, it's quite suitable for the beginning Unix/Linux/Posix programmer, although it does more-or-less assume knowledge of C. But even if you're a Python programmer, APUE provides excellent discussion of how Unix works, and you won't regret the time spent.

Of course, that's true of *any* Richard Stevens book.


(Log in to post comments)

Don't forget the classic

Posted Dec 6, 2007 17:57 UTC (Thu) by nix (subscriber, #2304) [Link]

It also horrifies the newbie with indications of just how *bad* things 
were before POSIX standardized away much of the SysV/BSD gulf. The 
chapters on signal handling and terminal I/O may as well be divided into 
completely separate pieces, SysV and BSD differed so much. (In both cases 
SysV basically won. Thankfully it didn't win in all areas. I wish SysVIPC 
had never existed, ick.)

Don't forget the classic

Posted Dec 6, 2007 22:55 UTC (Thu) by vmole (guest, #111) [Link]

I wish SysVIPC had never existed, ick.

Ick? Ick? If "ick" satisfactorily expresses your opinion of SysV IPC, then you clearly haven't suffered enough :-). I *could* use the words that come into my mind, but then Corbett would have to delete this comment.

For those who haven't had the pleasure, among the problems is that the namespace is completely independent of the normal Unix namespace (files), and there's no way to programatically query it. Also, the associated resources were limited, and they didn't automatically close when all the programs using one exited uncleanly (like file descriptors do). And by "limited" I mean on the order of 16 or 32. System wide. Also, while you could list the in-use resource (ipcs), there was pretty much no way to find out who had created or was using a particular id. Imagine the fun.

Don't forget the classic

Posted Dec 7, 2007 0:47 UTC (Fri) by nix (subscriber, #2304) [Link]

There's more fun. While SysV message queues can fill up because, well, 
they're full (they have a bounded maximum size), they can also fill up 
because *other* queues have filled up to the point where the system won't 
allow any more messages into any queues. Most Unixes have ridiculously low 
limits (64 messages or 64Kb across all queues is not unusual) so it is 
utterly trivial to produce horrible deadlocks with this system.

(Of course they don't work with select(). That would be *useful*.)

(I would have used stronger language than `ick', too, but I didn't want to 
get the bills for setting a thousand people's computers on fire.)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds