Wednesday, March 3, 2010

What's in a name?

I was doing a little reading up on the System.Threading.Tasks namespace, and threading changes in general in .Net 4.0, and got a little bit confused by this.  He says of ThreadPool.QueueUserWorkItem(), and I'll quote here:

The FIFO order is not something that is documented or guaranteed, but my personal guess is that too many applications rely on it, so I don’t see it changing any time soon.
Not documented?  Not guaranteed?  Are you kidding me?  It's called a Queue.  Queue means FIFO.  If it behaved any other way they'd be buried in bug reports.  My personal guess is that even the best of us can get confused and miss basic principles.  Not to insult the Moth, there is a ton of good information regarding parallelism on his blog, and I certainly recommend it.

Collection, Dictionary, Cluster, Glob, Bag, Bucket, whatever - define those structures however you want.  Those words are rooted in neckbeard yap.  Queue, priority queue, and stack have rigid mathematical definitions and cannot behave any other way.  At least, not without cheesing me off. 

No comments: