multiply matrices using erlang and mnesia
Fri Oct 21 10:08:53 CEST 2005
On 21/10/05, Chris Campbell <cyberdanx@REDACTED> wrote:
> Putting work up is easy. The trick is to get work out to the workers
> (really, letting them know a job has arrived) and let the process that
> posted the work know it's done. What's the best way to go about this
> using mnesia? It has pattern matching, which allows picking the
> correct entries but I'm not sure how to let the workers know about the
> job short of polling the db periodically for new jobs.
If you make sure jobs are inserted in an ordered set then you can have
a dedicated process taking the first job out of the table and spawning
a worker process. One of the items in the table can be the process id
of the process which needs the result.
Once the table is empty, you can either the poll the table
periodically or subscribe to mnesia table events.
More information about the erlang-questions