tag:blogger.com,1999:blog-2744072865491516720.post8337334537840042974..comments2023-05-03T06:35:33.259-04:00Comments on Higher Logics: Software Transactional Memory in Pure C#Sandro Magihttp://www.blogger.com/profile/05446177882449578817noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-2744072865491516720.post-50740197760586174322017-01-08T12:32:36.173-05:002017-01-08T12:32:36.173-05:00It's abstracted away but it'still lock-bas...It's abstracted away but it'still lock-based. Lock-based doesn't mean "you have to use the lock keyword in your code" and it also doesn't mean "there is a lock used somewhere down in the implementation". No. _based_ says it's really at the heart of the whole idea, and that in other words means the same as "pessimistic". <br />At least that's how I read the article and I bet many others do as wellJan Shttps://www.blogger.com/profile/11484355704522016063noreply@blogger.comtag:blogger.com,1999:blog-2744072865491516720.post-65408910793704068052017-01-08T12:04:00.023-05:002017-01-08T12:04:00.023-05:00I did make a small adjustment already, but the mea...I did make a small adjustment already, but the meaning of "alternative to lock-based synchronization" is that you don't have to <em>manually</em> specify the locks to acquire. Pretty much all STMs use some kind of locking or mutual exclusion internally, even the optimistic ones.Sandro Magihttps://www.blogger.com/profile/05446177882449578817noreply@blogger.comtag:blogger.com,1999:blog-2744072865491516720.post-23792716933720054352017-01-08T11:25:48.288-05:002017-01-08T11:25:48.288-05:00All right, I was just referring to the wiki articl...All right, I was just referring to the wiki article, where the second sentence says "It is an alternative to lock-based synchronization".<br />Maybe someone with a good understanding of the topic (hint hint) should fix the article :)Jan Shttps://www.blogger.com/profile/11484355704522016063noreply@blogger.comtag:blogger.com,1999:blog-2744072865491516720.post-22391472116682572452017-01-08T00:27:17.065-05:002017-01-08T00:27:17.065-05:00Software transactional memory does not require any...Software transactional memory does not require any specific implementation strategy. It can be optimistic or pessimistic, and you'll find both in the literature. The most efficient recent STMs are actually pessimistic.<br /><br />As long as program fragments operate on a form of native in-memory data types where access is mediated by transactions, and thus concurrent programs can be safely composed, it qualifies as STM.Sandro Magihttps://www.blogger.com/profile/05446177882449578817noreply@blogger.comtag:blogger.com,1999:blog-2744072865491516720.post-29526986734298309832017-01-07T20:29:15.585-05:002017-01-07T20:29:15.585-05:00Hi Sandro
Not that I'm any expert on the topic...Hi Sandro<br />Not that I'm any expert on the topic, and probably never will be, but it seems to me what you implemented is not what is described on the wiki page.<br />Software transactional memory is supposed to be optimistic, i.e. lock-free with retrying. You do locking and retry when you detect deadlock. That's what I would call pessimistic, i.e. the complete opposite.<br /><br />Regards<br />Jan S.Jan Shttps://www.blogger.com/profile/11484355704522016063noreply@blogger.comtag:blogger.com,1999:blog-2744072865491516720.post-89706629239579674952012-04-13T18:32:33.995-04:002012-04-13T18:32:33.995-04:00Your description of Cloneable is exactly how Sasa....Your description of Cloneable is exactly how Sasa.Dynamics works. I basically expose a static Type<T> class which exposes three delegates: Create of type Func<T>, which creates an empty/default instance of a type, Case of type Action<T, IReducer<T, FieldInfo>>, which dispatches on the type of the object into the IReducer handler, and Reflect also of type Action<T, IReducer<T, FieldInfo>>, which reflects over an object's fields.<br /><br />I'm in the process of porting this code over to an even more general abstraction which I haven't published yet, but the core idea of type safe reflection remains the same. See <a href="http://higherlogics.blogspot.ca/2010/12/sasa-v093-released.html" rel="nofollow">my last Sasa release</a> for the first incarnation of that idea.<br /><br />As for the transactions itself, it looks like you've taken a different approach by allowing multiple concurrent versions of an object. I took the much simpler approach of simply allowing one concurrent version. There are tradeoffs to each.<br /><br />Regarding your Maybe<T>, you can't compare it against null and get a meaningful result. You need to override equality on a nullable Maybe type like I do with my <a href="http://sasa.hg.sourceforge.net/hgweb/sasa/sasa/file/8f849532951f/Sasa/Option.cs" rel="nofollow">Option</a> type (see lines 93-98 and 170-175). If you provide those overloads, then you do: if (x == null) ..., instead of just: if (x.HasValue) ...<br /><br />You also sorely need some comments! ;-)Sandro Magihttps://www.blogger.com/profile/05446177882449578817noreply@blogger.comtag:blogger.com,1999:blog-2744072865491516720.post-20328575290780081262012-04-13T17:45:29.625-04:002012-04-13T17:45:29.625-04:00I worked on something similar. Check this out:
h...I worked on something similar. Check this out: <br /><br />http://blog.jordanterrell.com/post.aspx?id=7ddb58c8-6186-4f05-a506-b1086aae23c5<br /><br />https://github.com/iSynaptic/iSynaptic.CommonsJordanhttps://www.blogger.com/profile/10710054187606257702noreply@blogger.com