Re: [fpc-pascal] Actor Model implementation in Pascal

2011-03-14 Thread Sven Barth
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
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Consumer producer unit (donation to fcl)

2011-03-14 Thread David Mears

On 03/01/2011 01:50 PM, Jorge Aldo G. de F. Junior wrote:

i have implemented a small consumer x producer unit (ie: threads that
produce or consume tobjects)

it is thread safe (based around a tthreadsafequeue with signalling -
the thread can sleep/wait arbitrary timeout time while its queue is
empty waiting for the producer)

is it interesting for the fcl ?


I can't speak for the list in general, but I would find it useful, at least.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Consumer producer unit (donation to fcl)

2011-03-14 Thread Felipe Monteiro de Carvalho
Another option is adding it to the Lazarus-ccr. You can create a wiki
page for this in the Lazarus wiki and add it somewhere in the
lazarus-ccr subversion.

-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal