Francis Devereux

July 17, 2008

OS X Tip: Finding All PowerPC Applications

Filed under: Operating Systems — frankoid @ 6:50 pm

I recently upgraded from a PowerBook to a MacBook Pro, and used Migration Assistant to copy the applications from the PowerBook to the MBP.  I wanted to find out which installed applications were PowerPC-only so I could look for updated Universal versions.
My first thought was to write an application to find them (I’m learning OS X programming at the moment and it also seemed like a good exercise).  After I got my app working I discovered that I didn’t need to write it: the built-in System Profiler has a list of applications and their architectures.  Oh well, writing the app was a good exercise and I learnt about an interesting undocumented function: _LSCopyAllApplicationURLs.
Anyway, here’s how to find your PowerPC-only apps with System Profiler:

  • Open System Profiler (Apple menu->About This Mac, then click on More Info…)
  • Click on Software->Applications in the tree in the left hand side of the System Profiler window
  • Click on the Kind column heading in the applications table, then scroll down to find the applications whose kind is PowerPC
Advertisements

May 21, 2008

A Memory Management Idea

Filed under: Operating Systems — frankoid @ 11:53 am

There is often a trade-off between speed and memory usage.  For example, when a web browser loads a new page, it can do a number of things with the old page, including:

  • nothing (throw it away)
  • cache the files that it downloaded from the server
  • cache the fully rendered version of the page

The first of these options uses the least memory and the last one (probably) uses the most.  Unfortunately, the first option also makes going back to the old page the slowest (because the browser must get the files for the page from the server again and render them again).  Now, the browser on my Nokia N95 seems use the first option.  This makes sense, because mobile phones don’t have very much RAM and don’t have virtual memory, so if the N95’s web browser cached pages in RAM then there wouldn’t be much RAM left form other applications to use.

The Idea

My idea is that when the OS notices that free RAM is low it could make a call to applications to say “please free some RAM”.  Then apps could merrily use RAM without having to worry about that causing problems for other apps.  If memory started to get tight the OS would ask the apps to free up some RAM and they could discard their caches.

Of course, there wouldn’t be much point in allocating some memory for a cache only to be told to free it up again straight away, so their should also be a way to allocate memory that would fail if there wasn’t plenty free – an “malloc if possible” OS call.

This idea would not only be useful on devices without virtual memory, like phones.  It would also be useful on desktop computers; for example the OS could ask apps to free up RAM before it started to page to disk.

Potential Problems

Memory management is already a difficult problem, especially in a virtual memory environment; it is difficult for the OS to determine what to keep in RAM and what to page to disc (or throw away, in the case of disc caches).  This idea would make things even more complicated.

There could be some interesting reentrancy issues too.  For example, an application could be asked to free RAM as a result of it requesting RAM itself.

I wonder whether this idea has ever been implemented?  If you’ve come across a system that implements this idea I’d be very interested to hear about it…

Create a free website or blog at WordPress.com.