With the publication of ‘Advanced UNIX Programming‘, Second Edition, Marc Rochkind takes a look at what has changed in the 20 years since he wrote the first edition.
With the publication of ‘Advanced UNIX Programming‘, Second Edition, Marc Rochkind takes a look at what has changed in the 20 years since he wrote the first edition.
As a lowly CS undergraduate who recently bought Stevens’ “Advanced Programming for the UNIX Environment” (probably the #1 rival book to this one), this introductory chapter was very interesting indeed. In fact, I didn’t realize that this book was receiving a second edition update or I would have considered purchasing it instead of Stevens’ (which is already 10 years old).
Anyway, I think it’s important for undergrads to learn C so they understand lower level stuff like memory management and such. That it’s the lingua franca of open source helps as well. So though projects may exist for Java to make UNIX system calls, it’s better to just learn C, I think.
The beauty of UNIX (though, I don’t think it was planned that way), is that it is so easy to interface to any given language, that it can serve as the low-level substrate that is essential to any high-level language. You don’t need to program at the lowest levels (though you should probably know how), to appreciate the elegance of the layered design that UNIX engenders.
Another interesting read is “The Art of UNIX Programming” By Eric S. Raymond (ESR).
You can check it out at the following location:
http://www.faqs.org/docs/artu/
Also you can read alot of more interesting papers by ESR’s at his homepage:
http://www.catb.org/~esr/
Somethings habbits are hard to break.
thanks for the post jack, looks like I have some reading to do now
All of Steven’s books are The reference for Unix programming, even if they are 10 years old. It’s like the Knuth series: you can’t go far without using them at least once in you’re career.
I’d rather not. It’s ESR.
that unix today is generally same as 20 yrs ago.
and sad. i remember by the end of 80s (say 1990) we feel we were on the verge of arrival of “the new os”. from the mid-70s unix served as great os development testbed, allowing try and test many ideas, push the envelope.
by that time many technologies proved itself (threads, async kernel, metadata fs, object apis, pervasive networking, etc). – all thanx to unix !
and it seemed for some time during 90s that “the next os” _will_ arrive. remember amiga, next, plan9, mach, be…
but the world is cruel – “the next os” turned out to be unix circa-end-of-70s with all 25 years worth of unix development dumped into it (er… ported – including “ed” 😉
well, at least we got uber toy for hackers (old meaning of the word “hacker” – pls see dictionary)
From the article:
(…) but many projects use Java instead, and I’ve never met a programmer who didn’t prefer it over C++.
Interesting – I could almost say the reverse.
I concur.
I don’t perfer Java to C++ because I have no control over Java. I don’t like being helpless, I’d rather have control over the factors of production.
I don’t perfer Java to C++ because I have no control over Java. I don’t like being helpless, I’d rather have control over the factors of production.
Nice buzzwords, but what do you mean exactly?
Unix is still around because it became an open standard and decades of development made it very solid. The thing is, it’s not that good, it’s inflexible and lacks modularity due it’s monolithic nature and primitive hardware abstraction. All these things led to the developement of plan9 (by the same people that developed unix), unfortunately OSes don’t get popular on their technical merits.
The thing about C++, is that it’s so extensible that each project ends up being created in a sub-dialect of the language almost (e.g. compare C++ apps written with Qt’s non-visual components with C++ apps developed using the STL and Boost). It’s not the most readable of languages and can be a bit clunky in some respects (e.g. using operator() to support primitive types, operator[](int i) to support indexed properties, copy constructors, pass by value semantics, etc.)
That said, I kinda feel like Java got a bit too concerned with the perfect language idealogy and ended up burdening the programmer with a lot of bureacracy (like the whole of J2EE!). Which is why my project for the Summer is to get cracking with C#!
UNIX hasn’t changed, and that is good for compatibility, both backwards and between different UNIces. But that does not mean it’s a good system. I still think the Unix-Haters Handbook is interesting and very funny:
http://research.microsoft.com/~daniel/unix-haters.html
Might be written by someone who now works at Microsoft, but he didn’t when he wrote the book, and many things are simply true:
– UNIX has no equivalent of NetWare’s salvage/purge system
– The file sendmail.cf is horrible
– Applications can’t find out the exact command-line arguments the user typed
– (N)Curses is only an add-on
– X Windows is only an add-on and you still need the command line every now and then
– When a NFS server shuts down, clients that have NFS mounted from it freeze
– No central place for documentation (KDE help, HOWTO’s, /usr/share/doc, info-pages, manpages)
– …
– And last but not least: UNIX isn’t good, but other products are even worse
Well, UNIX has changed, a little. Core dumps have their PID appended, Windows and MacOS have become just as slow as X-Windows, UNIX now has some kind of journaling in general, and some other things. NCurses is a shared library, just like Xt and so on.
The base remains the same however.
For me only one thing has changed: today computers are now fast enough to make Unix almost usable… Now we only need to wait another 20 years to have a fast Unix, or switch to a non-Unix OS
“- UNIX has no equivalent of NetWare’s salvage/purge system”
Still not?
“- The file sendmail.cf is horrible”
I agree and wouldn’t recommend Sendmail anyway. Qmail is child’s play to configure (even with LDAP support). Hint: Sendmail is _NOT_ UNIX!
“- X Windows is only an add-on and you still need the command line every now and then”
Currently debunked. Untrue on IRIX imo, untrue in any user-friendly end-user Linux distribution, but i’d recommend learning CLI though.
“- When a NFS server shuts down, clients that have NFS mounted from it freeze”
Currently debunked. No problem with this at all (NFSv3 and NFSv4), it is _fixed_. With NFSv3 one can unmount a NFS share which isn’t available with -f option. It _was_ a problem though.
“- No central place for documentation (KDE help, HOWTO’s, /usr/share/doc, info-pages, manpages)”
Agreed. (And agreed with more.)
Daan, you do realize the book is out of date, right?
Sure, it is out of date, and many of the problems described are solved by now. But there are certainly flaws that remain, and modern UNIX versions have their own strange behaviours.
For example, if you change the shell of “root” on Solaris, the root account becomes disabled. The only way to solve this is a complete reinstall.
And for your example: on this computer I have NetBSD 2.0 beta, and I tried umount -f, and it didn’t work, even though I shutdown the other PC (Linux 2.4, kernel NFS) with the normal shutdown procedure.
There are indeed UNIX versions on which you don’t need the command line anymore, like Linspire, Solaris and IRIX. But a) their tools are non-standard, b) not everything can be done from the tools, c) some of these tools are useless.
As an example of c), let’s take Solaris. To change my shell, I need to login as root and use the bloated, slow Solaris Management Console. Then “su -c ‘vi /etc/passwd'” is a lot quicker and handier.
You can’t break into a UNIX system anymore by setuid floppies and the like, but UNIX and Linux are still programmed in C, and the UHH already pointed at the possibility of buffer overflow exploits, and look at the most common source of recent security flaws…
And about the filesystem: UNIX still has a) no unified system of Access Control Lists and b) no file versioning, two things NetWare already had 10 years ago, namely as a) trustee rights and b) salvage/purge.
”
You can’t break into a UNIX system anymore by setuid floppies and the like, but UNIX and Linux are still programmed in C, and the UHH already pointed at the possibility of buffer overflow exploits, and look at the most common source of recent security flaws…
”
every operating system (almost) is written in c. whats the difference.