Re: Seeking event loop concurrent solution to challenge problem

"Karp, Alan H" <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <A0BE9926384D0940BBAD4B60190CB29A6A9173488A@GVW0433EXB.americas.hpqcorp.net>
ihab wrote:
> 
> A lot of us are fans of shared-nothing event loop concurrency, so we
> thought about using HTML5's "workers" as our starting point. However,
> it seems that using these requires a bunch of boilerplate, some of
> which may be automated, and some of which may not. I'd love to see
> someone code the solution in E, say, and we could backtrack from
> there.
>
Tyler has some JavaScript examples at http://waterken.sourceforge.net/#tour, such as the Bang Tutorial.

________________________
Alan Karp
Principal Scientist
Virus Safe Computing Initiative
Hewlett-Packard Laboratories
1501 Page Mill Road
Palo Alto, CA 94304
(650) 857-3967, fax (650) 857-7029
http://www.hpl.hp.com/personal/Alan_Karp


> -----Original Message-----
> From: [email protected] [mailto:[email protected]
> os.org] On Behalf Of [email protected]
> Sent: Wednesday, September 23, 2009 9:27 PM
> To: Discussion of E and other capability languages
> Cc: Kris Zyp
> Subject: [e-lang] Seeking event loop concurrent solution to challenge
> problem
> 
> Hi folks,
> 
> The CommonJS group seeks to build a "common" (i.e., not just Web
> pages) platform of JavaScript. In this thread, we asked ourselves what
> to do about concurrency:
> 
> http://groups.google.com/group/commonjs/browse_thread/thread/fa20fc6a36
> 49b3a
> 
> A lot of us are fans of shared-nothing event loop concurrency, so we
> thought about using HTML5's "workers" as our starting point. However,
> it seems that using these requires a bunch of boilerplate, some of
> which may be automated, and some of which may not. I'd love to see
> someone code the solution in E, say, and we could backtrack from
> there.
> 
> Problem: A multi threaded Web server that serves up a hit count for a
> single page.
> 
> Kris Zyp's shared memory solution, from the email thread, is:
> 
> var hits = 0;
> var lock = new (require("concurrency")).Lock(); // This just loads a
> module
> function incrementAndGetHits(){
>    lock.lock();
>    hits++;
>    lock.unlock();
>    return hits;
> }
> exports.app = function(env) { // Exported function that worker threads
> run
>    return {
>        status:200,
>        headers:{"content-type":"text/plain"},
>        body: "This page has been hit " + incrementAndGetHits() + "
> times";
>    };
> }
> 
> Given that E was essentially built for shared-nothing event loop
> concurrency, what does it look like in E?
> 
> Ihab
> 
> --
> Ihab A.B. Awad, Palo Alto, CA
> _______________________________________________
> e-lang mailing list
> [email protected]
> http://www.eros-os.org/mailman/listinfo/e-lang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.