STM on Android

56 views
Skip to first unread message

zhou...@163.com

unread,
Jan 8, 2018, 4:26:12 AM1/8/18
to Frege Programming Language
I've tryed SillyClock on android and works but when I proceed to more complex transaction involving both writeTVar and orElse, the App crashed because putIfAbsent was not implemented, so I replace java.util.Map to java.util.ConcurrentHashMap and it works again




Dierk König

unread,
Jan 8, 2018, 5:11:33 AM1/8/18
to frege-program...@googlegroups.com
Ok, thanks a lot!
I have to look more closely into this, esp wrt contention 
and effect on performance. 

Cool to see Frege STM on Android!

all the best
Dierk

sent from:mobile 
--
You received this message because you are subscribed to the Google Groups "Frege Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to frege-programming-l...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

V

unread,
Jul 8, 2019, 3:20:28 PM7/8/19
to Frege Programming Language
The log must be ordered to make the Two Phase Locking work correctly. The method putIfAbsent should be rebuild in the TransactionLog locally to make it downwards compatible with older Java library versions.

V

unread,
Jul 8, 2019, 3:37:46 PM7/8/19
to Frege Programming Language
In more detail:
As far as I know, ConcurrentHashMap does not make any statement about the order of the elements. Two Phase Locking relies on the order of locks to avoid dead locks. Thus, if you have many concurrent processes on the same variables and you use a non ordered map for log, you may experience dead locks. Furthermore, if you use ConcurrentHashMap, you have overhead for synchronization, as the TransactionLog does not need to be synchronized because it is thread local. The methods of the TransactionLog will never be called concurrently.

Sorry for the long delay and the first sketchy answer.
Reply all
Reply to author
Forward
0 new messages