Print

Print


One of Erlang's real stengths is its approach to concurrent
programming.[1][2]
It differs from threaded programing - the more common approach - in
several ways. From the programmers point-of-view, Erlang's approach is
just easier to write and debug.

[1] http://www.erlang.org/course/concurrent_programming.html
[2]
http://www.computer.org/portal/site/dsonline/menuitem.9ed3d9924aeb0dcd82
ccc6716bbe36ec/index.jsp?&pName=dso_level1&path=dsonline/2007/10&file=w5
tow.xml&xsl=article.xsl&;jsessionid=H5f2QTzQWh2zMWy36pYGytVqvVDQLjKF2mYn
RhSTpwPs4qyY1JWh!1418919023

-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of
Eric Lease Morgan
Sent: Monday, February 18, 2008 1:43 PM
To: [log in to unmask]
Subject: [CODE4LIB] many processes, one result

How do I write a computer program that spawns many processes but returns
one result?

I suppose the classic example of my query is the federated search. Get
user input. Send it to many remote indexes. Wait. Combine results.
Return. In this scenario when one of the remote indexes is slow things
grind to a halt.

I have a more modern example. Suppose I want to take advantage of many
Web Services. One might be spell checker. Another might be a thesaurus.
Another might be an index. Another might be a user lookup function.
Given this environment, where each Web Service will return different
sets of streams, how do I query each of them simultaneously and then
aggregate the result? I don't want to so this sequentially. I want to
fork them all at once and wait for their return before a specific time
out. In Perl I can use the system command to fork a process, but I must
wait for it to return. There is another Perl command allowing me to fork
a process and keep going but I don't remember what it is. Neither one of
these solutions seem feasible. Is the idea of threading in Java suppose
to be able to address this problem?

--
Eric Lease Morgan
University Libraries of Notre Dame

(574) 631-8604