Archive for August, 2006

Whining about the MacBook

Monday, August 28th, 2006

When the MacBook Pro came out, there were various reports about a “whine” that could be heard. I was kind of confused what this meant, and before buying my MacBook, I went to a store to do some investigating. The MacBook was not audible over the ambient store noise, but the MacBook Pro was if I put my head close to the case.

The noise people were talking about was a relatively faint high-pitched noise that reminded me of the 286 my parents had when I was a kid. To more clearly hear the PC speaker beeps, my father installed an external speaker jack to the rear of the case and plugged an external speaker sitting on the desk into it. As an extra “feature”, there was now audible the same faint, very high frequency noise. The noise modulated with the activity of the computer, and I soon learned how to tell if the computer was idle just from the kind of noise it was making. (I don’t know if the sound bothered my father, though. I think playing with too many electric guitar amps and attending too many loud concerts in his youth might have diminished his high frequency hearing.)

Well, just recently I’ve been working in a very quiet cube farm, unlike my apartment, which is noisy from the computer equipment, and my desk at the university which under a loud ventillation duct. Now I can finally hear a similar noise in my MacBook. I never did figure out precisely what was the cause of the noise in the 286 (RAM activity, external bus?), but the sound is the same on the MacBook. I can tell from experimenting that the sound is anti-correlated with CPU activity. An idle machine makes noise, but a busy one does not (until the fans turn on). That’s a little surprising too me, but the noise instantly becomes inaudible if I start doing something a little CPU intensive. Similarly, if I use the processor control to disable one of the cores, the noise also disappears as the load on the remaining core goes up.

Now that I can recognize it, the sound is kind of annoying in the environments in which it is audible. The anti-correlation with CPU activity does make me wonder if Apple could possibly eliminate it with some sort of firmware or kernel patch to change the idle behavior of the CPU. Disabling one of the cores manually when not needed is a very effective, but awkward, solution. It unfortunately has the side effect I mentioned earlier of shortening the battery life slightly.

MacBook: Review

Saturday, August 19th, 2006

For easy access, here’s all my MacBook review posts:

In summary: Reasonable price if you buy upgrades at Newegg/Fry’s, damn fast, a little warm, and be careful with the battery usage.

MacBook: Batteries, Power and Heat

Saturday, August 19th, 2006

The question of power consumption and the heat profile on the MacBook is a fairly complicated one, so I’ve saved it for last. Clearly, this is the limiting factor for these computers, even more than size or weight. It’s somewhat similar to the problem in state-of-the-art fighter jets: the airframe could handle very high acceleration maneuvers, but that would render the pilot unconscious. The analogous problem in laptops is to make a fast machine that gets more than 30 minutes of battery life and won’t burn a hole through your desk (or pants).

Battery capacities increase much more slowly than CPU power consumption. The 12″ iBook battery holds 4400 mAh of charge, and the MacBook battery holds 5200 mAh of charge. However, the MacBook battery now has to feed a dual core CPU, brighter screen, and a 5400 RPM hard drive. As a result, the amount of time you get on one charge can vary by a factor of 3. Just watching the “time left” estimate in the menu bar, I’ve seen things like:

  • 1:45 - 100% load on both CPUs, i.e. “make -j2″ or running Handbrake.
  • 2:30 to 3:00 - Watching a DVD or H.264 movie in VLC
  • 4:30 - Writing this blog post with the screen turned to 80% brightness
  • 5:30 - Sitting in a meeting with my screen at min brightness and only occassionally using it to check the agenda.

I have not done rigorous full-discharge tests in any of these scenarios, so I don’t know how accurate these estimates are. I did calibrate my battery sensor as per Apple’s instructions, so these numbers probably aren’t too far off.

The MacBook and MacBook Pro come with lithium polymer batteries, which are more durable variants of the lithium ion batteries used on the iBook (and most other laptops). Hopefully, this will make them slightly less likely to explode, but the total capacity still degrades quite significantly with use. My battery has had 52 charge cycles and is now at 96% of its original capacity. You can monitor (and even record) your battery capacity with coconutBattery, which now works on the MacBook series of laptops.

You might be wondering what power management options you have, and it turns out there are even fewer knobs than before:

  • Time until computer sleep
  • Time until display sleep
  • Put the hard disks to sleep when possible?
  • Dim display before sleep

The processor speed option from the G3/G4 (which let you select Reduced, Automatic, or Highest) is gone. Based upon the previous load tests, it seems that the Intel Core processor is always in Automatic mode, dynamically adjusting its power usage according to the CPU usage. In general that seems to be best, however it was nice on the G4 to be able to set Reduced to ensure maximum runtime. On the MacBook, your best strategy for extending your battery life (after using the few options available in the Energy Saver window) is to take a look at your load using top. Killing unnecessary processes that are using CPU will directly help the power situation. For example, I discovered that idle virtual machines in Parallels can still use 25% CPU, and inexplicably, Parallels seems to use about 5-7% CPU even when the virtual machine is suspended. (This may be a sampling error in top, though.)

If you install the CHUD package in Xcode, you can also put a processor control into your menu bar that lets you disable one of the two cores on the fly. I naively thought that disabling a core might let me reduce power usage, but in fact it had a small negative effect on battery life. Switching a core off just moves the load onto the other core, which tends to make the laptop run a little hotter and use the fans more. Splitting the load over more cores seems to be the most power efficient approach.

Amazingly, Apple was able to keep the power adapter on the MacBook (unlike the MacBook Pro) to exactly the same size as the iBook adapter. At least, this seems amazing until you try recharging your laptop under high load. The power adapter can’t supply enough current to charge the battery at the fastest speed if you are also running the laptop at maximum load. So if you need to charge your battery in a hurry (like in an airport), keep your CPU usage to a minimum.

Finally, there is the heat question. Without a doubt, the G4 iBook gave me unrealistic expectations. It was very cool and the fan almost never ran, but that was because the CPU was so underpowered. The MacBook is definitely a little warmer and uses the fan more in normal usage. (Recently there was a firmware update to change the fan behavior to make it stop cycling on and off when the laptop temperature hovered around the fan’s turn-on threshold.) If you max out both cores, the fans will come on full blast and sound like a handheld vacuum cleaner. In this situation, it is pretty uncomfortable to keep the MacBook on your lap, and you will probably need a desk. Otherwise, it isn’t so bad, but definitely not as good as the G4.

So in summary: Intel is pretty clever about their power management, but on average you’ll get about as much battery life as on a G4 iBook. The variability depending on load will be much greater, so watch your pants when you kick on that parallel code build!

MacBook: The Apple Remote and Front Row

Thursday, August 3rd, 2006

I’ll admit that initially I thought the IR remote that Apple includes with all of its Intel machines was a silly gimmick. Perhaps I could be convinced that it made sense for the Mac mini, which looks like it was made to go under a TV. But a laptop?

I take my skepticism back now. The Apple Remote is really quite handy, especially if you use your computer as your entertainment center as well. I have no TV or stereo, so my computer is my DVD player and my music player. The remote lets me kick back (literally) and watch a movie without having to use the mouse or keyboard. It looks like an Apple Shuffle, almost:

Apple Remote

Front Row is the Apple program which receives commands from the remote. Normally, you can only use the remote to turn the volume up and down with the +/- keys. If you press the Menu button, Front Row starts and provides you with a menu of options. The Apple site has a page on Front Row with some animations which show how the interface operates. If you have looked at MythTV, it seems very similar. Big fonts and large shiny eye-candy.

A great program that makes Front Row even more useful is HandBrake. HandBrake is a simple GUI interface which lets you transcode your DVDs into MPEG-4 format. It really is very easy to use, and provides several nice features:

  • A queue which lets you define several jobs and then start running them sequentially. If you are ripping DVDs of a TV series which have several episodes on one disk, this lets you rip and encode each episode to a different video file.
  • Multithreaded encoding - Use both cores to get the video compression done faster. At 1000 kbps with the H.264 codec, I can encode nearly at real-time with both 1.83 GHz cores.
  • Various options for bitrates, cropping subtitles, etc. - I haven’t played too much, but the default 1000 kbps rate is indistinguishable to me from the original DVD, and fits a 2 hr movie in about 1 GB.

With the help of HandBrake, you can easily put many of your DVDs into the movie folder and the watch them fullscreen with Front Row.

Of course, the next thing you’ll want to do is use the remote for other programs. There are a few bindings to other apps, mentioned here. In traditional Apple style (make the common case ridiculously easy, and to hell with the rest), there is no generic way to interface the remote with other programs besides these. However, there are several 3rd party apps (not free, but cheap) which let you do this:

I tried out both briefly, but didn’t really do enough with them to make for a proper review. Both have free trial options, so I suggest you play with them to see what you like.

MacBook: Parallels

Thursday, August 3rd, 2006

As mentioned earlier, my primary reason to upgrade to the MacBook was the huge increase in CPU speed and maximum RAM capacity. The second biggest reason I wanted to upgrade to the MacBook was hope (which was realized) that the switch to Intel CPUs would bring some better virtualization tools to the Mac. In the PPC world, we had Microsoft’s (after they bought Connectix) VirtualPC and QEMU. Both of these products emulated the entire CPU, which made them very, very slow. In the case of VirtualPC, this is because the target audience was Mac users who wanted to run x86 Windows applications, so CPU emulation was necessary.

In my case, I really just wanted to run Linux apps. Yes, there is Fink and gcc and all that for MacOS X, and in most cases that’s sufficient to build native versions of the programs I use. However, one of our analysis tools is a combination of FORTRAN and C++ code linked together, which was nearly impossible to get working correctly on OS X. Apple does not ship GCC with the FORTRAN compiler turned on (?!), and the fink g77 compiler is of course built using a different version of GCC than what Apple used. So when you get to the linking stage, things usually blow up. I tried other things, like building GCC from scratch with C++ and FORTRAN turned on, etc, etc. I got it to work once, and never again.

Tired of fussing with this, I just wanted “Linux in a box”. I own VMWare Workstation 5.5 for Linux, and it has been fantastic for testing code on various distributions. It is amazing to see how fast code can run on a virualizer which does not have to emulate the CPU. No such virtualizer exists for Mac OS X PPC (MOL only works on Linux PPC), but with the switch to x86 CPUs, it was only a matter of time before some virtual machine came to the Mac. I (and everyone else) expected VMWare to be the first to port their product to the Mac. There are rumors that they have test builds of VMWare of Mac OS X, but none have been released to the public. Most likely the Mac market is not big enough for the 800 lbs gorilla of virtualization to move very quickly. I suspect VMWare makes most of their money on the “enterprise” market, so a new desktop product on a marginal platform is not very compelling.

However, that provided a window of opportunity for a smaller company with a virtualization product to jump in and own the market. Parallels makes several virtualization programs which appear to be in the same class as VMWare Workstation. I had never heard of them, but due to their very rapid and very public (at least 5 beta releases) port of their code to the OS X, they are now very well known to Mac users everywhere. Apple even promotes Parallels on their website, a move which prompted David Girard to quip in an Ars Technica review of Parallels that this was “the corporate equivalent of Jesus endorsing your sandals.”

Check that review for some great details on the product. One thing I was surprised not to find was any option to share your network connection with the virtual machine via NAT. VMWare offers three networking options:

  • Host-only: A private network interface is created on the host, and the guest OS can connect to the host via that link.
  • Bridged: The guest OS appears to be directly connected to one of the host’s existing network devices. The guest has access to your entire network this way.
  • NAT: The guest OS is connected via a private interface to the host, but can still access the external network via network address translation. This is the same feature that many broadband routers also provide for sharing a cable modem or DSL connection to several computers.

Bridged networking works reasonably well unless you do not want to expose your virtual machine directly to the big scary Internet. In my case, our university requires a web-based login before granting access to the campus wireless network, and it only allows one machine to be logged in per ID. If I logged in my virtual machine, then the host machine would lose access, and vice versa. NAT easily avoids this restriction.

Apple thankfully solved this problem for us already since OS X comes with a very easy to use NAT feature. All you have to do is configure your virtual machine for Host-only networking, then open up System Preferences and go to Sharing / Internet. Parallels creates a new network device (en2 on my system) which you can then share your Internet connection with. I would still rather Parallels handle this internally, but this fix is sufficient for now.

Another problem was the lack of shared folders to Linux guests. Parallels provides an implementation for sharing to Windows guests (the most common case), but nothing for Linux. Again OS X has enough built-in to compensate for the missing capability if you are willing to tinker. Mac OS X Server comes with a GUI to configuring NFS exports, but it turns out the desktop version of the OS still has the NFS server built in. I would suggest reading this guide for some details on how to export a directory. For the clients option, use “-network 192.168.2.0″ to share a directory only to the en2 interface. (Check with ifconfig if this is the right network for your configuration.) Reboot, and now you can NFS mount directories inside the Linux guest from the host (which will be 192.168.2.1).

Two more programs which are nice to use with Parallels are:

  • PDTweaker - Disables caching of the disk and memory image files for more efficient use of your RAM.
  • VirtueDesktop - A multiple desktop implementation that can be nice if you want to fullscreen your Parallels machine on one desktop and use OS X on the other(s). Nothing quite as sexy as switching from Mac OS X to Linux with the cube animation.

If you do want to use Linux in fullscreen mode on the MacBook, you’ll want to track down a modeline for X to select the unusual 1280×800 resolution:

  Modeline   "1280x800" 83.5 1280 1344 1480 1680 800 801 804 828

Put that in the Monitor section of the xorg.conf and then select the “1280×800″ mode in the Display subsection.

Entries (RSS)