Tuesday, May 21, 2013

Linux System Programming, 2ed

I'm pleased to announce the release of the second edition of Linux System Programming, my guide to system programming on Linux.

Linux System Programming 2ed, cover

I updated the entire book to reflect new interfaces and behavior in the latest versions of the Linux kernel, glibc, and gcc—3.9, 2.17, and 4.8, respectively—as well as giving the text a universal overhaul with even more examples and interesting anecdotes.

What I am most excited about, however, is an all-new chapter on threading. I cover the basics of Pthreads, of course, but the meat of the chapter is a discussion on threading design and patterns in Linux. Should you use event-driven or thread-per-connection as your threading model? How does Linux's threading solutions scale? What are the costs of and alternatives to threading? How can you mitigate the risk of races? And other such fun topics.

Chapters: Introduction & Essential Concepts, File I/O, Buffered I/O, Advanced File I/O, Process Management, Advanced Process Management, Threading, File & Directory Management, Memory Management, Signals, Time.

The paperback format of the book ships on June 4th. Preorder your copy today:

The ebook version is available today:

Wednesday, April 25, 2012

University of Florida CISE: Now More Than Ever

By now you've likely heard the proposal that the University of Florida plans to drastically restructure its Computer Science department, CISE.

While the details are not as provocative a picture as the Forbes article paints, the proposal is still bad for the university and its students (read the actual proposal). Also, as an alumnus, the proposal is, frankly, embarrassing.

At a time when the United States needs more STEM graduates than ever, universities ought be doubling down on their Computer Science programs. I encourage you to write to the university. Even if unaffiliated with Florida, this restructuring sets a bad precedent for other institutions.

Today, I sent this email:

President Machen & Dean Abernathy,

I am writing to express my concern with the proposed changes to CISE. Contra more provocative coverage, I understand that the department is to undergo restructure and not outright elimination. I also understand the significant budgetary pressures facing Florida. Nonetheless, the proposed changes to CISE are wrong for the university and wrong for its students. Moreover, they set an ill precedent for other institutions at a time when the world needs not fewer, but more, CS graduates.

The proposed restructuring will irremediably harm the ability of Florida to attract top-caliber CS instructors, researchers, and students. The elimination of graduate and research programs will result in the loss of existing top faculty and place current students, who enrolled in graduate programs in good faith, in an unfortunate and precarious situation.

I am an engineer at Google and sit on a Hiring Committee, responsible for hiring decisions across my office. I am also an engineering manager. While we look for smart, driven individuals of varied and many backgrounds, this proposal will assuredly hurt Florida graduates beginning their careers. Universities with strong software--that is, CS--curricula and deep research programs matriculate students best equipped to excel in today's technology companies--or start the companies of tomorrow.

When the largest, most successful companies in the world are software companies clamoring for more and better engineers, Florida should increase, not decrease, its investment in Computer Science.

I understand these budget cuts were imposed upon you. I wish they were not. Important decisions are rarely easy, but you must revert this proposal.

Yours sincerely,

Robert Love
Staff Software Engineer, Google
BA Math & BS CS, UF '04

Update: Hours after my email becomes the focus of his day, President Machen issued this statement to the university community regarding the budget:

Engineering Dean Abernathy has agreed to set aside the previously announced proposal as the department chairmen of CISE and ECE continue to flesh out details of a new proposal in consultation with students, faculty, staff, alumni and industry partners. The college has no plans to close any departments.

The budgetary issues facing our states and public universities are not over. Nor do I believe that the threat to Florida's CISE department is past. Nonetheless, this is an important victory, a crucial step worthy of celebration.

Tuesday, February 28, 2012

Google+

This being 2012, I'm not blogging much. I apologize.

I have, however, been playing around on Google+. It offers an opportunity to do longer form posts—more akin to a blog—than, say, Twitter. I am enjoying it; perhaps you will too.

Follow Robert Love on Google+.

Tuesday, May 17, 2011

Paris in Diorama

A week in Paris in the Spring. Pour être jeune et dans l'amour. I made some dioramas:


Passerelle Debilly, Paris, France


Palais de Chaillot, Paris, France


Champ de Mars and École Militaire, Paris, France

See also my dioramas from around Spain.

Friday, October 1, 2010

Kindle 3 Kernel

I really dig the Kindle 3. The small improvements add up to a significant improvement in usability. As my friend Chris put it, "as soon as I turned it on I realized I did the right thing."

For the curious, I got ahold of the Kindle 3's source code and generated a patch against 2.6.26 (I did the same for the Kindle 1's kernel).

The patch is big and noisy, but here's what stands out: Ingo's RT kernel, which converts most spinlocks to priority-inheriting mutexes, removing most regions of non-preemption in the kernel; ARM architecture updates; driver for the Atheros AR6002 802.11a/b/g device; driver for the Freescale MC13783 voltage regulator; driver for E Ink; driver for the Asahi-Kasei AK4647 audio device; lots more.

From the source, the Kindle is still code named Fiona internally.

Anyone spot anything neat I am missing?

Thursday, September 9, 2010

Google Instant

Google Instant, which we announced yesterday, is at its best after you have used it for a bit, and allowed the interactive experience to refine and improve how you search.

But, for me, the simplest sell is searching for the weather. Last week, you might have searched for weather 02116 (and a decade ago, you'd have watched the evening news). Today, you hit w:

Try it out on google.com.

Tuesday, July 27, 2010

Spain in Diorama

So I got married.

For our honeymoon, we rented a sporty convertible and took off on a road trip around Spain. Three weeks, 3485 kilometers, fifteen Michelin stars.

I built these "dioramas" of places we visited.

Granada in Diorama
Granada in Diorama

San Sebastián in Diorama
San Sebastián in Diorama

Barcelona in Diorama
Barcelona in Diorama

Igeldo in Diorama
Igeldo in Diorama

Hopefully the marriage will stick.

Thursday, July 22, 2010

Linux Kernel Development, Third Edition

Cover of Linux Kernel Development, Third Edition

I'll mention this only once, promise.

The third edition of my best-selling Linux kernel primer, Linux Kernel Development, is now shipping. The publisher is Addison-Wesley and you can find the book in better local and online booksellers.

What's new? Lots. The text is clarified, reworked, and reorganized. The material is fully updated and now based on the 2.6.34 kernel. I also note if and how the 2.6.32 kernel differs, as that release is a "long-term stable" version and thus likely relevant to many readers.

New material includes treatment of the Completely Fair Scheduler, an analysis of the flusher threads component to page writeback, and a chapter devoted to kernel data structures.

Whether you already own an earlier edition, whether you are a kernel developer or just curious how it all works, Linux Kernel Development is an excellent addition to your bookshelf. But don't take my word for it. From one of the many five-star Amazon reviews (this one of the second edition):

The content is one part why this book is great, but I think bigger points go to Robert Love's delivery. His style is casual yet not willy nilly. A subject like the kernel is both dense and minutia-filled and in turn is so much easier to grasp when it's not presented in a dry academic style. The way I would characterize this book—it's as if you're older brother took you aside and taught you how to hack the mainframe.

And:

I have been doing Linux kernel/system level development on and off since 1999. This is the book that I think should be owned by any Linux newbie who wants [to get into] kernel hacking. Even if people do not directly do Linux kernel development, it is a good book complementary to any serious operating systems course in college—it helps gain a better idea of how and why.

Buy it from Amazon.

Buy it from Barnes & Noble.

Buy it from the publisher.

Wednesday, April 28, 2010

Micro Four Thirds

Wanting a lighter kit than the Canon 5D Mark II for my honeymoon, I recently jumped on the Micro Four Thirds bandwagon with a purchase of the Olympus E-PL1 and Panasonic 20mm pancake lens.

This crazy sunset is my first shot:

Sunset over Boston's Back Bay
Sunset over Boston's Back Bay

Shot in JPEG, not RAW, and oversharpened a bit, but the image quality is quite good. What's with the grey sky and bright red sunlight?

Thursday, April 8, 2010

iPhone OS 4 and Multitasking

What follows is a first-look at the just-announced multitasking features in the next iPhone OS. It is solely my opinion.

As I predicted in my previous post on the iPad & iPhone and multitasking, Apple is adding multitasking-like support to iPhone OS 4. And as I wildly speculated, that support is largely (although not completely) in the form of background services. Let's take an initial look.

First, as I wrote in my previous post, both the iPad and iPhone support multitasking today. At the system level, many processes run concurrently, and Apple-provided applications are allowed to multitask. What we are discussing here when we say "multitasking" is specifically the ability for third-party applications to multitask.

Second, this is a very early look at what Apple announced at today's event, which is still going on as I type this. Thus, cut me some slack. Developers should consult more detailed documents, which ought to crop up over the next few days and weeks.

What did Apple announce? A lot of spin, actually, but also two simple features. These features do not allow third-party applications to multitask. That is, on iPhone OS 4, as with now, only one applications runs at a time. What these new features do enable is functionality that fulfills many of the same use cases as multitasking. Let's look at them:

Services. Apple is adding a set of service APIs that allow background processes access to a subset of the device's functionality. Such services have access to, at least, notifications, geolocation, deferred computation, VoIP, and media playback. Having a service API limits the ability of background applications to run errant and destroy battery, but that is not a primary concern. As I stated in my previous post, the real concern with multitasking on an embedded, swapless device is memory consumption. Battery life is a straw man. So how do services solve the memory consumption problem? Alone, as described in the event, they don't. But iPhone OS will continue to kill applications that leave the foreground. Thus, applications will need to be refactored to provide a background component that only uses the new Service APIs. Without the risk of unbounded multitasking, memory pressure is greatly relieved.

Serialization. This was tacked onto the end of the discussion of the new services API, as if it was another service. But it is not. Described as "fast app switching" during the event, this is essentially a serialization API. When apps exit, they may choose to save their state to the backing store. When they restart, they reload this state. iPhone OS provides a simple object serializer today, called NSCoder. It is unclear if Apple is just pushing for better use of this class, or if they are adding additional APIs to make serialization both easier and more powerful. Either way, this will make it appear as if applications are actually multitasking—even though they are not—by allowing them to recover their exact state on restart.

So what about these solutions is "gonna be the best?" Nothing. In fact, what was announced is not even multitasking. Moreover, the new functionality isn't anything that other platforms don't offer today. Android, for example, provides excellent support for both of these features via Services and Bundles, respectively. The new iPhone APIs are not novel. But, despite the spin, that isn't what matters. All that matters is the user. If these APIs are sufficiently robust, they will benefit the user by enabling developers to make better apps.

One difference between Android and iPad & iPhone is that Android does not kill applications on task switch. The iPad & iPhone will continue to do so. Thus, in some sense, Android has a third solution to application multitasking: We allow apps to actually multitask until the system experiences memory pressure, at which point our OOM killer is able to kill applications in least-recently-used order. Then, our serialization solution kicks in, making their reload transparent to the user.