June 12, 2002 Spout

Karma

While I definitely do have faith that there is a higher power in the universe (although I haven’t yet decided if the universe is a good place to be or if it’s just a simulation solving some higher level non-deterministic finite state automata), I’m not a religious man. If fact, I consider myself a completely recovered Catholic (I’ve been clean and sober for more than a decade and I never feel the need to go back for another hit off the body of Christ) [1].

Likewise, I’m not a superstitious man. I understand that going under a ladder may cause pain if something drops on me, but not for some other mystical reason. Similarly, breaking mirrors could cut you, but only the most serious of cuts could last for 7 years.

Still and all, I do believe in karma, otherwise stated as “what goes around, comes around.” It’s happened many times in my life that a lot of bad luck eventually yields to a lot of good luck. Likewise, when you do bad, bad comes back at you and when you do good, good comes back. Of course, these phenomenon can be explained by statistics and human nature respectively, but I prefer to think of a giant celestial scoreboard that I can affect by doing good for people. Or, and this happened just today, if I do something to cause harm, even if there’s nothing I can do to make it up to the person involved, I often find myself feeling better if I do something good for someone completely different. Oh, wait, maybe I am superstitious… Still, I find it a comforting way to run my life, so I’m going to stick with it. : )

[1] I’ve known practicing Catholics that are offended by the idea that Catholicism is a disease to be recovered from. Sorry.

June 11, 2002

Windows Developer News RSS Feed

Are you into RSS? The link is the WDN RSS feed, which I use to report news on this site and in the world for Windows developers.
June 11, 2002 .NET

Adding Ref-Counting to Rotor

“Microsoft has granted Sells Brothers, Inc. a research grant to add ref-counting to Rotor and to study the performance effects. There’s been a lot of speculation about just how we’re planning to add ref-counting to Rotor.”

June 11, 2002

Powers of Ten

“View the Milky Way at 10 million light years from the Earth. Then move through space towards the Earth in successive orders of magnitude until you reach a tall oak tree just outside the buildings of the National High Magnetic Field Laboratory in Tallahassee, Florida. After that, begin to move from the actual size of a leaf into a microscopic world that reveals leaf cell walls, the cell nucleus, chromatin, DNA and finally, into the subatomic universe of electrons and protons.”

June 11, 2002 .NET

A compiler-writer’s guide to C#

“Plan:

  • Give overview of language from point of view of compiler writer
  • Code generation for CLR is trival, so we’ll focus on type checking
  • Specification is 410 pages, almost no formal methods, and frustratingly verbosely written
  • We’ll boil much of it down to five parts”
June 11, 2002 Spout

Adding Ref-Counting to Rotor

Microsoft has granted Sells Brothers, Inc. a research grant to add ref-counting to Rotor and to study the performance effects. The proposal that lead to that grant is available here. There’s been a lot of speculation about just how we’re planning to add ref-counting to Rotor. Here are the highlights:

  • It’s not just “me,” it’s “we.” I’ve already have very useful input from several folks, including Jason Whittington, Ted Neward, Ian Griffiths, Serge Lidin, Craig Andera and Bill Conroy. Also, Chris Tavares will be spending most of July doing the actual implementation. If anyone else wants to dig in, feel free! I’m happy for the help and anyone that provides insight will get credit.
     
  • The goal of adding ref-counting to Rotor is to measure the performance effects of a deterministic finalization-like model that we gave up when moving from COM/C++/VB6 to .NET. I say “DF-like” because we’re not getting DF, because the price of determinism is that sometimes an object is never finalized, e.g. cycles. We can do better.
     
  • We will not be replacing the existing GC’s ref-tracking. It does a fabulous job managing memory and managing cycles and we won’t touch that.
     
  • The ref-counting implementation’s sole job will be to call an object’s finalizer ASAP. Note that this is in no way “deterministic.” Plain ref-counting is deterministic in that it calls an object’s finalizer just as soon as there were no more outstanding object references. Cycles meant that this would never happen (deterministically). A hybrid ref-counting/ref-tracking system improves “never” to “eventually” in the case of a cycle and maintains the ref-counting’s guarantee for ASAP in their absence.
     
  • Even objects that don’t have finalizers will need ref-counts, as they maintain references to objects that have finalizers (and so on).
     
  • Value types will not need reference counts, but when they go out of scope, there will need to be a Release on any object references the value objects contain.
     
  • When the GC kicks in and finally breaks a cycle, it would be nice to release all objects held by the cyclic objects so that they could return to normal ref-counting determinism. However, since we’ve already blown determinism by being in a cycle, this seems unlikely to be very helpful. Also, by skipping this we can keep all of our changes in the JITter and out of the GC, which simplifies the initial implementation.
     
  • We’d plan on adding ref-counting at the runtime level in the JITter so that all languages gain the benefits w/o updating the compilers (or mandating anything special in any language). The real work is figuring out which IL instructions require AddRef/Release calls and getting those calls into the instruction stream. Because of this, we’re not likely to be able to handle tail calls (at least, initially). Anyone with advise in this area would be welcomed with open arms.
     
  • We plan on working nicely with existing IDispose-based code. Since our ref-counting is all about calling the finalizer, if the ref-count gets to zero and there is no finalizer to call, no finalizer will be called. That means that Dispose implementations that call GC.SuppressFinalize will not cause any problems with the ref-counter. Of course, the goal is that the IDisposable.Dispose protocol is not necessary at all.
     
  • As a potential optimization, I have found a nice place to store a 7-bit ref-count in the existing space allocated to every object, so there will be no space overhead, only CPU overhead. However, this narrows the number of objects per  process with synch blocks and/or hash values from 134 million to 1 million. It also narrows the number of referencing objects from the traditional 4 billion to 127. Anecdotally, 127 seems like enough, but it will necessitate the need to abandon ref-counting on any object that reaches 127 extent references. Since most data structures where more than 127 references could happen are parent-child, e.g. every child in a tree with a reference to the root, and this indicates a cycle that can’t be handled by the ref-counting anyway, turning these objects over to the ref-tracking portion of the algorithm seems reasonable. However, we won’t know ’til we look how many object references an object is going to have, so we’ll track maximum reference counts during our tests to see if this optimization makes sense at all.
June 10, 2002 Tools

Genghis — 0.2 Release

Thanks to all of the *very* active contributors, Genghis has doubled in size! This update includes:

  • an automated nant build
  • a framework for nunit tests
  • an almost complete .NET implementation of SimplePad
  • an imagelist combo box
  • a preferences and window position serializer
  • an MRU sample
  • a custom state treeview class for doing tri-state checkboxes
  • an update to ListViewSorter to make it declarative
  • an expanded trace class for common tracing operations
  • various other bug fixes

There’s plenty more to see and do, so check out Genghis if you’re building WinForms applications.

June 9, 2002 .NET

Pragmatic ADO.NET, Chapter 6: Typed DataSets

“In Chapter 5, I extolled the virtues of setting up your DataSets like in-memory databases. Unfortunately I asked you to write quite a bit of code to do all the work. I was only teasing you. This chapter will show you how to use Typed DataSets to make that job a lot easier while at the same time creating type-safety at compilation time.”


← Newer Entries Older Entries →