[Q] Characteristics of different Inter Process Communication mechanism on Mac?

  • Hello.

    I became curious about IPC mechanisms on the Mac platform.

    Well.. there are at least 4 different type of IPC mechanism as far as I
    know.

    1. AppleEvent
    2. NSDistributedNotification
    3. Remote Messaging
    4. Conventional IPC mechanisms based on socket/pipe/shared memory

    I guess the method 4 is the basis of others.
    Although Apple pushes the AppleEvent for scriptable application, you can
    also use the mechanism for a simple IPC purpose, right? As far as I
    know, the AppleEvent was introduced as an IPC mechanism for the System 7.

    NS(Distributed)Notification mechanism seems to be widely used for
    Cocoa/Objective-C programmers nowadays. Like the AppleEvent, I guess it
    is processed through a central queue.
    Probably there are pros and cons because of the fact.

    Remote messaging enables IPC based on objects. So, you can use remote
    objects like the way they are a local object. This mechanism seems to
    offer simple way of inter-process communication by hiding underlying
    mechanism like the one described as 4.

    However, are there any special use cases where one method is preferred
    to others?
    Oh.. yeah.. for more subtle control of your own code, remote messaging
    can be the best choice.

    I welcome any answer or discussion. I guess this is very interesting topic.
  • On 07/09/07, JongAm Park <joshua_park2006-applelist...> wrote:
    > Hello.
    >
    > I became curious about IPC mechanisms on the Mac platform.
    >
    > Well.. there are at least 4 different type of IPC mechanism as far as I
    > know.
    >
    > 1. AppleEvent
    > 2. NSDistributedNotification
    > 3. Remote Messaging

    I believe the correct term you're looking for is "Distributed Objects".

    > 4. Conventional IPC mechanisms based on socket/pipe/shared memory

    5. Mach IPC

    > I guess the method 4 is the basis of others.
    > Although Apple pushes the AppleEvent for scriptable application, you can
    > also use the mechanism for a simple IPC purpose, right? As far as I
    > know, the AppleEvent was introduced as an IPC mechanism for the System 7.
    >
    > NS(Distributed)Notification mechanism seems to be widely used for
    > Cocoa/Objective-C programmers nowadays. Like the AppleEvent, I guess it
    > is processed through a central queue.
    > Probably there are pros and cons because of the fact.

    NSDistributedNotification has a lot of restrictions - it's basically
    one-way, it has a fairly high overhead (it's processing through a
    central queue in a server), you have to serialise everything to a
    property list. But it's very easy and straightforward for simple
    event-like notifications between apps.

    > However, are there any special use cases where one method is preferred
    > to others?

    I don't really know that it's possible to draw any massive
    conclusions. Distributed Notifications and DO have a higher overhead
    (and DO requires you to use Foundation), AppleEvents are useful for
    scripting and legacy Carbon code but probably unnecessarily fiddly
    compared to "modern" alternatives, sockets and pipes are compatible
    with other operating systems, and Mach messaging can be very fast and
    flexible.

    It really depends on what technologies your processes are implemented
    in, what they need to be compatible with, how often you'll be sending
    messages, how much data you want to shift between them, etc.

    -- Finlay
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today