os:timestamp() uses mutex lock

Jonas Falkevik <>
Thu Jan 21 18:35:51 CET 2010


Using erlang:now() for taking time stamps is slowing things down if  
you try to do it in parallell due to the guarantee of uniqueness hence  
a mutex lock and serialization of the execution.

But what if you don't need the uniqueness and would like to trade it  
to be able to run things in parallell and with smaller overhead?

In R12 you would need to implement a new BIF.

In R13 with the introduction of NIF's it is easy to implement and  
deploy your own modified now().

But in R13 the function os:timestamp() seems to have been introduced  
as well, which does not have the uniqueness but still the mutex lock.
What is the need of the mutex lock in this function?

Any other way?




More information about the erlang-questions mailing list