Re: Some thoughts on threading

2005-12-14 Thread Ron Blaschke
On Mon, 12 Dec 2005 12:18:47 +1300, Sam Vilain wrote:
 On Thu, 2005-12-08 at 17:16 +0100, Ron Blaschke wrote:
 The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software.
 [1] He starts with The biggest sea change in software development since
 the OO revolution is knocking at the door, and its name is Concurrency.
 
 Perhaps have a read of:

 http://svn.openfoundry.org/pugs/docs/AES/S17draft.pod

Interesting read, thanks.


Just some braindump.  How about async calls and future.

sub f is async returns future {
# your favorite expensive operations here
return $something;
}

my $x = f();
# some more expensive operations here
# this part executes concurrently
# with f() ...

# ... until the future is read for
# the first time; this will block until
# the value is available
say($x);

Ron



Ron


Re: Some thoughts on threading

2005-12-11 Thread Sam Vilain
On Thu, 2005-12-08 at 17:16 +0100, Ron Blaschke wrote:
 The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software.
 [1] He starts with The biggest sea change in software development since
 the OO revolution is knocking at the door, and its name is Concurrency.

Perhaps have a read of:

http://svn.openfoundry.org/pugs/docs/AES/S17draft.pod

Two non-traditional methods of concurrency are discussed;

  * atomic blocks - an atomic { } guard around a block that, assuming
the block performs no I/O, will guarantee atomic
success or failure of the block.

  * co-routines - essentially co-operative multitasking between
  'blocking' threads that actually switch tasks when
  they block (or yield).

There is also some stuff there on other types of timesharing and
multiprocessing - Threads, Processes and Multiplexing (like Ruby).

Sam.