[fpc-pascal] Actor Model implementation in Pascal

Jorge Aldo G. de F. Junior jagfj80 at gmail.com
Sun Mar 13 22:30:44 CET 2011


yes, its a kind of message passing.

but mine is in native pascal and i have no intention of making
bindings for other languages...

its wayyy simpler than mpich too. you just pass TObjects back and
forth from threads.

(I understand that TCustomMessage is way too restrictive, so i am
planing to develop a kind of interface based model, so you can pass
arbitrary objects around).

it simplyfies thread programming a lot, at a cost of a little overhead.

the switchboard (the thing that routes messages between threads) is
itself a class factory, so your threads can start/stop other threads
(called 'actors" in this context) and send message to them.

the default actor implementation is event based, where the class name
of the object received triggers an dispatchstr... but i am looking for
other ways to deal with message receiving.

if you dont like this model you can override TActorThread.Execute and
do business your own way...

As it is a simple implementation in native pascal, theres no concept
of security or whatever.

later i can add blowfish encryption to the TCP/IP part of the thing
and message authentication using SHA1

(TCP/IP streaming of messages across machines, for this little library
"Pascal-Actor-Model", is the reason behind so many questions i've sent
to this mailing list about multi-threading, blowfish and SHA1
encryption...)

2011/3/13 Sven Barth <pascaldragon at googlemail.com>:
> Am 13.03.2011 22:08, schrieb Jorge Aldo G. de F. Junior:
>>
>> This is my attempt at implementing an actor model in freepascal
>>
>
> Never heard of "actor model" yet, but I'll read about it ^^
>
>> http://code.google.com/p/pascal-actor-model/
>>
>> This is an very early code. Any help is appreciated.
>>
>> Every communication between thread is done by using messages (wich are
>> itself objects).
>>
>> I am improving the current code a bit so this EXACTLY release maybe
>> dont compiles.
>>
>> If you want to compile the test code, simply create dummy
>> procedure/functions for anything that the compiler complains about not
>> being implemented.
>>
>> The base code works, i am just trying to implement a form of
>> message/object streaming to allow threads to communicate across TCP/IP
>> and not just by using the internal switchboard queues.
>
> Do you mean something like this? http://wiki.lazarus.freepascal.org/MPICH
>
> Regards,
> Sven
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list