Does ets:select/2 block the VM?

Shawn Pearce spearce@REDACTED
Mon Mar 3 04:27:28 CET 2003


I'm wondering about the implementation of ets:select/2.

If I match against a table with 200k records it takes nearly 1 second to
complete on my system.  I think I'm ok with this performance wise, but
I can't have the ets:select/2 call block the entire emulator, other traffic
still needs to be executed and processed in other processes.

An informal test where I spawn up a background process and have it
use io:format/2 every 10 milliseconds to print a message seems to run
perfectly fine while a 1 second ets:select/2 runs in another process.

I'm assuming thus that the Erlang system authors have thought about this
and have ensured that it doesn't become a problem.  :-)


Also, the documentation is vague as to what happens if the table owner
modifies a protected ets table using insert or delete while other
processes are using ets:select/2 or ets:select/3 (select with
a limit and continuation).  Is it safe to perform this, or does
the reader process have to use ets:safe_fixtable/2 ?

-- 
Shawn.

  A tall, dark stranger will have more fun than you.



More information about the erlang-questions mailing list