ebdrup
| Forum | Thread | Replies | Latest activity |
|---|---|---|---|
| Coffeehouse | Silverlight on C9 | 71 | Oct 05, 2007 at 1:02 AM |
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
| Forum | Thread | Replies | Latest activity |
|---|---|---|---|
| Coffeehouse | Silverlight on C9 | 71 | Oct 05, 2007 at 1:02 AM |
Programming in the Age of Concurrency: Software Transactional Memory
Sep 11, 2006 at 4:46 AMI can see how STM could have some performance implications, I mean if the atomic blocks get large ther is a lot of bookkeeping about what memory has been read and written. I can also see there is a lot of room for smart soultions in reducing the amount of bookkeping nessesary. But I love the power of the concept of transactional memory.
I'm wondering, couldn't STM have been implemented by you inserting the locks nessesary or probably better, a combination of locks where they would be smart and not deadlock and reevaluating where that would be deemed smart. I mean it's easy to think up scenarioes where there would be performance problems with reevaluating and you need a lot of good heuristics to ensure good performance in most cases. If you let the compiler insert the locks nessesary you can have it analyze for deadlocks at least in some cases and you eliminate the problem of having to keep a global order of locks that you talk about in the video.
Why did you opt for reevaluating instead of inserting locks. (guess the answer is composability)
Programming in the Age of Concurrency: Software Transactional Memory
Sep 07, 2006 at 6:27 AMSuppose I have a cache of some calculation, that I calculate in a lock with double checking to be thread safe, like this:
private static readonly Dictionary<Type, int[]> _typeInts = new Dictionary<Type, int[]>();
public int[] TypeInts
{
get
{
Type thisType = this.GetType();
if (!_typeInts.ContainsKey(thisType))
{
lock (_typeInts)
{
if (!_typeInts.ContainsKey(thisType))
{
_typeInts[thisType] = <<calculate int[]>>;
}
}
}
return _typeInts[thisType];
}
}
Would I be able to replace this with:
private static readonly Dictionary<Type, int[]> _typeInts = new Dictionary<Type, int[]>();
public int[] TypeInts
{
get
{
atomic
{
Type thisType = this.GetType();
if (!_typeInts.ContainsKey(thisType))
{
_typeInts[thisType] = <<calculate int[]>>;
}
}
return _typeInts[thisType];
}
}
my intuition says it should work if I do all looking up and updating of the _typeInts inside an atomic block.
But suppose the ContainsKey is run and another thread interrupts before the int[] is calculated. The other thread runs the same atomic operation to completion, would the first atomic opration retry because some state it read was updated or would it throw an exception when trying to insert a duplicate key?
ADO.NET Entity Framework: What. How. Why.
Jul 24, 2006 at 5:27 AMI would really like to see more on how you create the actual Entity mappings, when will the beta be availabel for download and when will this ship?
Joe Stegman - Developing rich user interfaces with Windows Forms
Sep 19, 2004 at 8:29 AM