[fpc-pascal] Actor Model implementation in Pascal

Sven Barth pascaldragon at googlemail.com
Mon Mar 14 09:54:46 CET 2011


Yes, that sounds indeed interesting (well... most multithreading things 
do ^^), but...

Am 13.03.2011 22:59, schrieb Jorge Aldo G. de F. Junior:
> the actor model can accelerate tasks that would be dealt with in
> singlethreaded fashion...
>
> lets suppose that your program needs to read 8 files at the same time,
> pre-process them, and use their data.
>
> you can write an actor that opens the file and pre-process it
>
> in your main thread (the program itself, wich is a thread of sorts,
> even if not being a TThread) you start 8 of those actors and sit in a
> loop waiting for then to produce a message.

... do you mean active waiting here?

>
> your 8 actor instances will, each one, pre-process the data to you.
>
> if your end-user happens to have a multi-core processor, the end
> result is that your 8 actors will finish faster than if you used only
> one thread to deal with each one of the 8 files...
>
> what i mean is that, under current processor technology, the actor
> model is a way to simplify the usage of threads, without the
> complexities of locks, semaphores and the like.
>
> you just pass messages around, wich, in the case of my little library,
> are just plain tobject descendents...
>

Regards,
Sven



More information about the fpc-pascal mailing list