44 comments

[ 2.5 ms ] story [ 98.7 ms ] thread
"FIRST EDITION: June, 2001"

I wonder how much of it is still relevant; if memory serves, the kernel advanced through at least 4 major versions since then.

It's talking about the user mode application development. The Linux system API doesn't change much. May be the newer stuff like io_uring appears recently.

I have the Advanced Unix Programming book. From looking at the copyright, it first started from 1985. It talks about programming on io/file/process/ipc/signal/device/terminal/security/permission/etc. It's still relevant today.

> The Linux system API doesn't change much

really? they added epoll, aio (they later added io_uring as a better aio), ebpf. Real threads were added with clone(2). Routing changed from ipchains to iptables. They added all the stuff needed for containers: cgroups, namespaces and what else - the Linux system API saw lots of action.

Look here: lots of additions came since Linux 2.2 https://man7.org/linux/man-pages/man2/syscalls.2.html

They even added sysfs, as procfs is now regarded as 'old and cluttered'

Also lots of changes in glibc.

The old Linux system api has not been changed much. It’s still pretty much the same. The new addition doesn’t obsolete the old stuff. That’s why the book is still relevant.
You are correct. A good but perhaps small example which bit me this week is inotify; I could not build this tool https://github.com/mikesart/inotify-info on CentOS 7 (at work) because it's only on version 3.x of the kernel and is missing the statx(2) system call which was added in 4.11. The rate of change may be slow, but the kernel is a huge thing, so it's not entirely surprising these situations arise.
That’s all in the process of changing now, isn’t it? I would imagine the days of the kernel granting access to things like your microphone or email or photos using static user and file permissions are pretty much coming to an end.
The part about /proc contains things such as /proc/pci or /proc/ide that don't exist anymore (it's not a stable interface like /sys).
Skimming through the text, the section on devices needs an update (IDE ain't really a thing anymore), and there's several places where the examples or prose could use updating to refer to modern systems. Appendix A (on other development tools) is... hilariously out of date. Doesn't even mention valgrind, although it's understandable that it wouldn't mention ASAN or perf (invented years after the book came out).

As for missing stuff, the I/O stuff doesn't even reach select, much less epoll or io_uring (which any modern "advanced" Linux programming really should cover). And you'd also likely need to cover cgroups and namespaces (the building blocks for containers, if not just containers themselves). It probably would be worth covering bpf and seccomp as well.

But then again, from my first skim, this book doesn't merit the adjective "Advanced" in the first place, even in the timeframe it was first written. There's not even much discussion of Linux-specific features (as opposed to things found in POSIX) that I would have assumed a book titled "Linux Programming" written in 2001 would have covered.

> Do not use a download accelerator to download these files.

Man. Nostalgia.

I have vague memories of this term. What were those?
(comment deleted)
A http/ftp download application that split files in multiple chunks to circumvent file-level download speed cap on server side.
Software that circumvents rate-limiting. Axel (still available in Archlinux repos at least) can be told to use some number of connections, it'll figure out the size of what you want to download, divide it into the number of connections you want, and start the connections in parallel, each getting a different chunk. Works when the rate limiting is per connection.

Other rate-limiting strategies like slowing down a connection over time would need other "acceleration" strategies like restarting the connection when it slows down, continuing from where the previous left off.

Another possible option that isn't about circumventing rate-limiting but just speeding up downloads can be to download different chunks from different mirrors, to spread the uplink burden. Axel can be provided multiple URLs for this.

I used to use a download manager because it allowed me to pause a download, turn off my PC, and continue the next day, which made sense in the days of 56k.
In the past (and even today) some servers didn’t enable tcp window scaling, which limited you to a couple of megabit in say a 100ms distance download, not because of any conscious blocking, but because you couldn’t have more than 64kbytes in flight at any one time.

This was mostly fixed a mover 20 years ago when window scaling became default, but companies like signiant actually had demos where they deliberately turned off window scaling to show how their proprietary file transfer formats were so much faster.

Little is known about the tools used by The First Ones.
In addition to what other people said, they allowed you to resume downloads.

Even if you weren't on dial-up, sometimes downloads would just... pause. Like you'd get to 23% and just wouldn't get any more data from the server. With these programs you could make progress by restarting the download, and it would pick up largely where it left off.

I would love to see something like this but for recent kernels, and with notes on compatibility in other OSes
(comment deleted)
Purchased a copy of this recently. Definitely recommend, although I'm curious how out of date people think the content is, and how a second edition would improve things.
Fully agree, this is a great book.

Also need a 2nd edition of "Professional Linux Kernel Architecture" by Wolgang Mauerer.

> Also need a 2nd edition of "Professional Linux Kernel Architecture" by Wolgang Mauerer.

I had not heard of this book at all. How does it compare with Robert Love's Linux Kernel Development?

I've not read Love's book, but Maurer's is about 3 times as many pages. I feel like it was the perfect companion book to TLPI since it covers many of the same things but in kernel space.
I haven't programmed in C for a long time but know the basics from college. Can I still work thru this material?
yes, depending on your motivation level. which probably is true for everything under the sun.
I tried to write a linked list a while back and it took me like 3 hours. I was wondering if the recommendation would be brush up C first. Although, like you said, with enough motivation it'll just fold into the above curriculum
I would brush up as I go because the motivation would be this book itself.
I bet you could rewrite it in under an hour now. Programming in general is a lot like hacky sack. If you don't do it that often, it seems difficult, but you get a few kicks in. The more you do it, the easier it is.
The book is called "Advanced Linux Programming" and starts with a chapter that does a Hello World in C. Somehow, I feel like there's a bit of a disconnect.
Don't you get it though?

Advanced Linux Programming is just C programming!

Joke aside, you are right 'Hello World' does seem disconnected from 'Advanced'

Definitely not advanced in the sense of, "at the highest level in this topic." Publishers do ask for titles like this, though.

I guess it's advanced in the sense of "not beginner". A typical beginner book might start with ls, cp, and nano and get to hello world around the midpoint.

This book is 22 years old.
I found the section on inline assembly useful. Not much coverage about it in general.