Popular conceit about learning programming languages

Dennis Lee Bieber wlfraed at ix.netcom.com
Mon Nov 25 14:06:12 EST 2002


Donn Cave fed this fish to the penguins on Sunday 24 November 2002 
08:49 pm:

> Quoth Pascal Costanza <costanza at web.de>:
> |
> | Message passing means that there are several entities that
> | communicate by sending messages between them. The main points are
> | that these entities are autonomous and that there is no central
> | "main" program that controls the behavior of these entitities.
> 
> But that's somewhat circular.  Message passing means that there are
> entities that pass messages, eh?  But what would a message be,
> precisely? What are the semantics of passing, for the sender and the
> recipient?
> How is it different from calling a subroutine?  Is multi-threaded
> execution necessary for this model?  If there is no main program,
> where does the program begin?  Can Python programs be written this
> way, and if so how would you tell the difference?
>
        Pure message passing tends to imply threading at the minimum (and 
fully separate processes at the extreme -- AmigaOS was one such).

        I don't think P.C. said there wasn't a main that initiated the system, 
but that the main didn't control the processing once started. Main 
could have been a shell script starting five or six programs as 
background tasks, and the tasks then use IPC to pass messages.

        A Python program written for this scheme, in purest form, probably 
creates n-Queues (one for each of the n-entities), then starts each of 
the entities as a distinct thread; after which the main program just 
waits for everyone to complete. Message passing would be handled by the 
sender process putting an entry onto the destination's Queue (to 
identify the source, I'd expect the message format to be a tuple of 
(return-thread's Queue, message data) ).

        The main difference, in my mind, is that subroutine/method calls are 
synchronous -- the caller is frozen until the method completes and 
returns. Message passing allows both to continue.
 

-- 
 > ============================================================== <
 >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at dm.net     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page: http://www.beastie.dm.net/         <
 >            Home Page: http://www.dm.net/~wulfraed/             <




More information about the Python-list mailing list