Archive for February, 2010

Superbugs

Increasing antibiotic resistance in bacteria is a nice demonstration of:

  • The speed and effectiveness of evolutionary change.
  • The Law of Unintended Consequences
  • The danger of hospitals

Antibiotics are in effect poisons that don’t happen to affect humans, typically because they interfere with bacterial cell walls that our cells don’t have. It doesn’t take long in human terms for bacteria to develop resistance to antibiotics, though presumably it does take quite a while in bacteria terms. With regard to selection under extreme pressure from antibiotic poisons, bacteria have an advantage over more complex animals: they can evolve faster because they can exchange new genetic material directly rather than only passing it on to their children. This is isomorphic to cultural evolution in h humans: the way that a good idea can spread quickly through a human population.

The unintended consequences I see are three-fold. First, when the first antibiotics were used (i.e., penicillin) they were considered to be miracle drugs. People didn’t realize initially that miracles have a limited lifespan depending on how heavily you use them, and there are many penicillin resistant bacteria these days. Second, antibiotics were eventually spread through society in the form of soaps and creams. This turned out to be almost wholly counter-productive, in that it exposed bacteria to low levels of antibiotics, making it easier for them to evolve resistance before they were poisoned. Third, the industrial food system relies on antibiotics to keep animals alive and more-or-less well even though they live in exceedingly unhealthy conditions (packed in tightly, covered with feces, etc.). This has also greatly increased bacterial exposure to antibiotics, increasing resistance, thus unwittingly exchanging safer and cheaper food for increased danger in other areas of life.

The benefit of hospitals is that you can put experts and expensive equipment in one place where they can efficiently work to help people. The danger of hospitals is that you put all the sick people in the same place, which gives infections a steady supply of people who are weakened and less able to fight off infections. In effect hospitals become sanctuaries for infections. Two hundred years ago a hospital was not a place for healing; it was a place for dying. Modern medicine has changed that to an extraordinary degree. But antibiotic resistant bacteria remind us that is a hospital is a place you should go only when you have no other choice. Doctors making house calls is inefficient and expensive, but it would almost certainly be healthier for people who are not too sick to be cared for at home.

Comments (1)

Synthetic Food

In the modern industrial food system, a cow is a chemical factory which converts corn into beef or milk. This is inefficient and unsafe in several different ways. Cows can not be maintained in sterile environments, so E. coli and other bacteria from their feces can contaminate the meat. Cows evolved to eat grass, so feeding them corn, while cheaper and more efficient, significantly increases bacteria count. Moving cows from feedlot to slaughter house, and moving beef from slaughter house to market, is inefficient.

Now that we have industrialized the food chain, there is increasing study of synthetic life. There is even a Registry of Biological Parts intended to make it easier to design your own life forms. These mostly work as modifications of existing life forms. There are, for example, people working on making bacteria which can efficiently produce diesel fuel; it apparently works in small quantities but there are still scaling issues.

Different people are working on what seems to be called in vitro meat: flesh which has never been part of an actual animal. This is generally done by culturing muscle cells.

In view of these efforts, it seems ridiculous to use something as complex and inefficient as a cow to produce beef. How long will it be until we have fully synthetic meat products? (This will of course raise a host of interesting health issues, but I think it’s safe to predict that none of them will be addressed until and unless the product is already popular.)

For people concerned about the increasing industrialization of food, synthetic meat will only make matters worse. However, as a vegetarian, I think the only valid choices are synthetic meat or no meat. So I would be happy to see increasing work in these fields, and I’m confident that they will become not only less cruel, but cheaper, than dealing with real cows.

Comments (2)

Thread Sanitizer

I recently ran the gold linker under Thread Sanitizer. It’s a nice plugin for Valgrind which looks for race conditions in multi-threaded programs. To describe it briefly, it builds Happens-Before relationships based on mutex operations and warns when it notices a write and a read/write to the same memory location without a Happens-Before relationship. This approach can yield false positives to be sure, but it does a very nice job of identifying real problems.

It was able to identify one real bug in gold, one problem that led to less efficient link time, and several cases where several threads would set a shared memory location to the same value. The latter cases are not a problem on x86 architectures, though they could be on other processors. In order to get clean Thread Sanitizer results in the future, I fixed all of the cases so that I could get a clean run of gold, at least with the default settings.

The real bug that it found was a typical multi-threaded bug: the code looked fine, but it had a well-hidden error. Gold uses a workqueue of tasks to execute, with a pool of worker threads. Many of the tasks are run using a blocker token. The blocker token is set to the number of tasks that precede it. As each task completes, it decrements the blocker count. When the count goes to zero, the next set of tasks can start. This is a simple way to parallelize linker operations, in which one set of operations (e.g., process the symbol tables) must be run before the next set (e.g., process the relocations) can begin. Naturally I paid close attention to the blocker behaviour when a task completed, and there were no problems there. The problem arose in setting the blocker count when the tasks started. The code was doing a loop of “increment the blocker count” and then “queue the task.” What I forgot was that the process of queuing the task actually lets another thread in the pool start working on it immediately. When the task completed, it decremented the blocker count with a lock. But if the task completed fast enough, the initial code was still running the loop queuing up new tasks, and thus incrementing the blocker count. I didn’t think that I needed to lock the increment, since I wasn’t expecting any task to actually complete before I started all of the tasks. A dumb mistake—just the kind of mistake one makes in multi-threaded programming.

Gold is written in C++. In Go I would of course have each task communicate its completion on a channel. The locking would be handled by the runtime, and there would be no chance for me to make the same sort of error. If you write multi-threaded code, and you can’t use Go, you should definitely check out Thread Sanitizer.

Comments (4)

Biophilia

E.O. Wilson’s notion of biophilia, which is slightly different from closely related to the newer idea of evolutionary psychology, posits that humans can not be healthy without some access to the natural world. The argument basically amounts to saying that we have evolved in a world which is not completely under human control, and we are not happy unless we are, at least to some extent, in such a world today.

I think the basic argument is likely true for most people. There was an interesting experiment which seemed to show that people next to a window onto an outside nature scene were under less stress than people next to a television screen showing the same image (I can’t find a link, but Journal of Evolutionary Psychology by PH Kahn). I think that many of us look for something to exist outside ourselves, and nature can play that role.

Some people use that as an argument for preserving the environment: we should preserve the environment to keep ourselves healthy (this is in some ways a variant on the idea that we should save the rainforest because we can find new pharmaceutical drugs there). Unfortunately, while I’m definitely in favor of preserving the environment, I think this argument fails. I think that technology can provide us the health benefits of access to the natural world, by hiding the sources of the technology. I think that a sophisticated robot dog can provide all the psychological benefits of a real dog, and more. With a good design we can get the unpredictability, the sense of a different mind and a different world operating. I think those are the things we need. I don’t think they have to actually come from nature.

Comments

iPad

It’s taken me a while to understand the point of the iPad. I can type on a keyboard faster than I can press keys on a screen, so the iPad would not be useful for me as a computer. And it wouldn’t fit in my pocket, so I wouldn’t carry around the way I carry my phone.

I think I get it now, though. The point of the iPad is to read books, watch videos, and play games. For that, it is looks quite convenient. I can carry it easily from room to room, I can prop it up while I’m eating, I can hold it up while I’m in bed (I assume it’s not too heavy for that). That is, the iPad is not a computer and it’s not a phone: it’s a media consumption device. It’s only real competition at the moment are the various e-book readers, which tend to be limited to just reading books. The first version of the iPad apparently won’t have a camera, and I don’t know whether it has a microphone, but I’m sure that future versions will have both, and that they will be a good way to do video chat.

With that understanding, the complaints I’ve seen about Apple’s tight control over the app store are kind of irrelevant. I don’t want to run arbitrary programs on my books, and I won’t want to run them on an iPad either. When I want to run programs, I’ll use a computer. The app store will be mainly an alternative way to publish information–authors will be able to sell directly to you, rather than going through a publisher.

More troubling are the complaints about Apple’s tight controls over content distribution. If other companies emulate Apple and Amazon, then we are taking another big step toward tight control over copyrighted content and the elimination of some fair use rights. When my only copy of a book is on my Kindle or my iPad, I can’t easily lend it to my friend. When publishers stop making physical books, libraries will become far less useful.

I’ve written before about how copyright will vanish. The iPad points to a way to bring it back: to build copyright controls into the architecture of how people read books. This is the kind of thing Lessig talked about in Code and Other Laws of Cyberspace. Building tight copyright control into a general purpose computer is really really hard. Building it into a closed system like the iPad is much simpler. I’m sure that enterprising people will crack the iPad’s controls, but it remains an open question whether they can crack the controls while still letting the iPad continue to access the various stores that will provide content.

Whether these are reasonable concerns depends entirely on how well the iPad does. I have no plans to buy one myself—I wouldn’t buy one even if I didn’t have these concerns. That is quite different from the iPhone, which I did buy a couple of months after it came out, though I’ve switched to a different phone since. I can’t predict how well the iPad will do; if it is very successful, then we’ll really have to worry about copyright issues in the future.

Comments

« Previous entries Next Page » Next Page »