at Jungerl: proc_reg, a flexible process registration utility
Ulf Wiger (AL/EAB)
Thu Jul 8 16:36:16 CEST 2004
I've written a small utility (an application) called proc_reg and committed it to Jungerl.
It allows for registration of (local) processes using any erlang term.
Furthermore, each process can register under several names.
The program requires OTP R9C-2 (it uses ets:insert_new/2)
The code is fast:
- proc_reg:reg/2 takes ca 35 usec on my slow 400 MHz UltraSPARC
(the register BIF takes ~10),
- proc_reg:unreg/1 takes ca 40 usec (~10)
- proc_reg:send/2 takes roughly as long as the registered send BIF
(most likely a few microsecs longer)
Semantically, I've tried to make it as similar and predictable as the BIFs, and it is designed to be fault-tolerant.
It also scales well. There might be some noticeable slowdown with hundreds of registered names per process.
Finally, I've added a test suite. If you want to play with the code, I recommend downloading the test server and using the test suites.
Comments are welcome.
More information about the erlang-questions