Re: S17-concurrency question
Em Seg, 2009-02-16 às 17:28 +1100, Timothy S. Nelson escreveu: Say I wanted to write a POP3 server. I want to receive a username and password from the client. I want things to be interruptable during this, but it's also impossible to sensibly roll things back like they were before the connection was opened. Is this possible with the concurrency model you specified? The things you're describing are from the time when we were assuming STM (Software Transactional Memory) would be used by every implementation of Perl 6. Things have changed a bit in the last months, as STM seems a bit more challenging then it looks at first sight for a language as complex as Perl 6, specially if you think about lazyness. OTOH, the problem POE solves is the lack of a good green threads implementation in perl 5, which I think is not a problem for Perl 6 (I can say that for sure about SMOP, but I'm pretty sure that is also valid for parrot). In that specific area of writing network servers, I've been with a fixed idea about providing autothreading code, so you can write code that looks like 'imperative block-wait programming', but is actually 'async non-blocking programming'. I'll paste my last sketch about it here: my $io = Net::TCP.listen(:hostlocalhost, :port(1234)); $io does IO::Async[EV]; $io.accepts: - $conn { my %headers; my $data; my $waiting_headers = 1; for =$conn - $line { if ($line $waiting_headers) { my ($name, $val) = split(/\s*:\s*/, $line); $headers{$name} = $val; } elsif ($line) { $data ~= $line; } else { $waiting_headers = 0; } } $conn.write(200 OK\n\nSucessfull request\n); }; EV.loop; daniel
Re: S17-concurrency question
On Mon, 16 Feb 2009, Daniel Ruoso wrote: Em Seg, 2009-02-16 às 17:28 +1100, Timothy S. Nelson escreveu: Say I wanted to write a POP3 server. I want to receive a username and password from the client. I want things to be interruptable during this, but it's also impossible to sensibly roll things back like they were before the connection was opened. Is this possible with the concurrency model you specified? The things you're describing are from the time when we were assuming STM (Software Transactional Memory) would be used by every implementation of Perl 6. Things have changed a bit in the last months, as STM seems a bit more challenging then it looks at first sight for a language as complex as Perl 6, specially if you think about lazyness. OTOH, the problem POE solves is the lack of a good green threads implementation in perl 5, which I think is not a problem for Perl 6 (I can say that for sure about SMOP, but I'm pretty sure that is also valid for parrot). I agree that's what it solves, although it has many other capabilities. What I guess I'm interested in seeing is a consistent threads interface which as much as possible (and it may not always be possible) can be used across platforms, whether the backend is OS threads or green threads. In that specific area of writing network servers, I've been with a fixed idea about providing autothreading code, so you can write code that I think you a word out (possibly I've been [playing] with...?) looks like 'imperative block-wait programming', but is actually 'async non-blocking programming'. I'll paste my last sketch about it here: POE looks like it does something very similar. It works with any kind of event loop, though, not just IO. I just discovered POE yesterday, so it still seems very cool to me; we'll see in another month :). :) - | Name: Tim Nelson | Because the Creator is,| | E-mail: wayl...@wayland.id.au| I am | - BEGIN GEEK CODE BLOCK Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+++ PGP-+++ R(+) !tv b++ DI D G+ e++ h! y- -END GEEK CODE BLOCK-
S17-concurrency question
Hi. I have a question for the S17-concurrency people. Say I wanted to write a POP3 server. I want to receive a username and password from the client. I want things to be interruptable during this, but it's also impossible to sensibly roll things back like they were before the connection was opened. Is this possible with the concurrency model you specified? I've been looking at POE ( http://search.cpan.org/~rcaputo/POE-1.003/ ) and have observed that it contains its own simulated concurrency (Sessions, he calls them), and is, it seems to me, well-designed for doing external data transfer as in POP3. He uses an event-driven model. Anyway, I'll be interested to hear about this. :) - | Name: Tim Nelson | Because the Creator is,| | E-mail: wayl...@wayland.id.au| I am | - BEGIN GEEK CODE BLOCK Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+++ PGP-+++ R(+) !tv b++ DI D G+ e++ h! y- -END GEEK CODE BLOCK-