Extenuating Circumstances is a weblog by Dan Hon

  • Blogroll

  • Posted
    26 July 2007 @ 1pm

    Tagged
    apple, iphone, osx, rtos

    OS X and the iPhone

    This is quite possibly 2lmc bait, but I’m trying to work out exactly what it is that Apple’s done to get OS X running on the iPhone, other than the usual re-compile/Marklar-esque port to ARM. My understanding is that for at least the phone-y/radio-y bits of a mobile you’d need some sort of RTOS and while my reading has pointed to the fact that OS X is possibly a soft RTOS (drop video frames, etc.), I’m not exactly sure what else Apple might have had to tweak to get a phone running on the thing in the first place.

    Other questions: For example, is Palm OS an RTOS? OS X has clearly got some low-latency parts (all that mucking about with AudioUnits, etc.) , and perhaps the phone bits have been stuck in at the XNU level (do the radio drivers etc need to be any more integrated than just I/O Kit?)

    The parts that I have seen include a rather dubious conversation in the #iphone / iphone dev-wiki IRC channel with some person wittering on about the iPhone’s OS being radically different from OS X, and in turn being told in rather certain terms that that didn’t appear to the case at all.


    4 Comments

    Posted by
    Rowan
    26 July 2007 @ 5pm

    I’m pretty interested in this as well… and I haven’t found much on it yet!

    RoughlyDrafted (who I’m not a big fan of) have a few articles on the subject, the most informative of which is perhaps http://www.roughlydrafted.com/RD/RDM.Tech.Q3.07/4F7A7875-05C6-4018-AD86-6DC5A410D108.html . That suggests that kexts have been cut down hugely and some support has been moved directly into the kernel - this may help on the RToS front. On the other hand http://www.roughlydrafted.com/RD/RDM.Tech.Q3.07/3B84E3A4-A6F6-4EA1-A48E-149BE29AB107.html almost suggests that it’s all handled as per normal - and why not, if you can grab some of Leopard’s finer-grained threading and priority stuff?

    One other thing that I found interesting about the iPhone was some early reviews and discussions on the interface. It sounded as if the current interface task - scrolling, dragging, etc - is given such a high priority within the UI drawing that some tasks (like updating what’s underneath??) are postponed in order to keep the frontmost action more fluid…? So dragging around a row (don’t ask me, I haven’t even seen one of these things) might not redraw or reshuffle other rows if the object is being dragged too fast, in order to keep the actual dragging itself more fluid. I thought that was quite an interesting departure from Aqua’s larger focus on “true” display over updating fluidly.


    Posted by
    Brian Enigma
    26 July 2007 @ 10pm

    I can’t talk about BSD/Darwin/OS X with any real specifics or certainty because I just don’t have the experience and knowledge, but there are some really great variants of the Linux kernel that are officially considered RTOS (MontaVista Linux, LynixWorks, uClinux, to name a few.) Whether or not the embedded OS X kernel is or is not an RTOS may be a moot point, depending on what chips they use. For instance, I use an embedded RTOS Linux for a particular project, but because of the way the hardware is architected, there is very little in kernelspace (and even less in userspace) that requires strict adherence to the “realtime” part of RTOS.

    If they’re using the right radio/radiomodem chips, then the chip itself takes care of all of the realtime needs and the kernel drivers simply push data in and out of registers and service higher-level interrupts. If not, they may have an FPGA or similar chip (possibly even embedded in their ARM chip–pretty common these days) to abstract the realtime components into higher-order registers and interrupts. VHDL and Verilog equations run on FPGA/CPLD chips, are absolutely realtime by definition, and act as a great buffer between needy hardware and a (relatively speaking) “slow” OS.

    I guess I can’t use the “I am not a lawyer…” line because I *am* a firmware engineer, but I am not an Apple engineer and have done little more on an iPhone than poke the screen with greasy fingers, so it is possible that I know not of what I speak.


    Posted by
    Michael
    27 July 2007 @ 12am

    There isn’t just ARM processor on the iPhone. In recent tear-downs, they have found at least three ARM processors (there may be more). I’m sure OS X is only running on one of the main processors, and the other two are used for stuff like DSP, startup, health/power monitoring. The main processor does not need to be real-time. I would guess that they don’t use an OS at all when dealing with the real-time components.

    http://newsletter.eetimes.com/cgi-bin4/DM/y/hBAbE0JlkK70FrK0FMsG0EK


    Posted by
    danny
    27 July 2007 @ 9am

    Yeah, I think the real-time stuff would be handled by the radio (it’s the same with OpenMoko, which is a good lesson in how these things work for those of us who don’t really know modern phones).

    I was surprised playing with a iPhone for the first time that it isn’t *that* responsive. I mean, the UI is fast enough that it does feels tactile, but there’s definitely some lag when you’re doing stuff like pinch-zooming or even typing.


    Leave a Comment

    Peeves links for 2007-07-27