[erlang-questions] Mnesia: select random record

datacompboy <>
Sat Sep 30 14:19:49 CEST 2006

noss wrote:
There is something wrong with threading in your email client I think.
(end of quote)

  I'm use forum interface to that maillist from trapexit.org

noss wrote:
It sounds to me like you want a fair scheduler among unoccupised advisers for each pool of advicer? 
(end of quote)

Correct. All free for now advisers at current moments should have equal chances to pick call. As for me, the way is:
  * count all free advisers (=X)
  * generate integer uniform 
noss wrote:
h record.
When every pool stored in its own table that easy -- just table_info(size), uniform(X), fisrt-next for Ith record (since no way to get Ith record directly).

If all pools in one table (better, since pools are can be created/dropped dynamically), there need to traverse WHOLE table TWICE (i.e. -- full list of all pools).

May be use mnesia_frag, and spread pools over fragments, so every fragment contains several full pools, and add fragments if one of pool grow large?

[quote="noss"]Can you revise this idea to try something different that will accomplish the same?
(end of quote)

Sorry, what do you mean?
--- suicide proc near\n call death\n suicide endp
Post sent from http://www.trapexit.org

More information about the erlang-questions mailing list