Who’s living in what apartment?

It’s the COM apartment models. They’re related to the threads that make use of COM objects. What happens is that when you initialize COM for a specific thread you declare that it’s either Apartment Threaded (AKA Single Threaded Apartment) or Multi Threaded.
When you use the Apartment threading model, it means that the COM object is isolated within the thread that created it. The most important piece of information about this model is that you should never use that object in another thread – it causes brokenness.
When you use the multi-threading model, what you’re pretty much saying is that I’m probably going to use this COM object in several threads. The way it works is that a multi threaded model, then the context is shared within the process.
The model you support also puts extra complications on you, the creator of the object. COM objects with a declared MT support must use some synchronization to protect shared information within the object, otherwise you’ll suffer from data corruption due to threads walking over the data. You don’t have any of these considerations in a Single threaded model – you’re guaranteed safe and sane interactions.
Additionally, when you’re in COM land, remember never just WaitFor*, but instead MsgWaitFor* things. This also applies to using DDE. This is because the Apartment model uses windows messages under the hood.

[Listening to: TWiT 38: MacWorld Expo – Leo Laporte and the TWiTs – this WEEK in TECH (1:19:01)]

suspend/resume under linux on Dell 500m

The laptop does suspend and resume to disk, but I have issues with the video card – I use the 855resolution program to allow the video card to set the native 1400×1050 resolution of the screen. When I resume once X kicks in and can’t set the video mode correctly I am booted back to a login screen.
I put in an entry in the powersaved post resume from suspend2disk script, and it correctly repatches the video mode before the X server tries to reinitialize the video. The problem is that I need to use the powersave command to shut it down correctly.
I took the alternate route and installed the software suspend2 patch. It provides a cleaner interface to hibernation (the hibernate command); it compresses the file; it supports using a file on disk instead of the swap partition; you can encrypt the hibernation file. It will unmount the windows paritions when I suspend, remounting them when I resume (corruption issues avoided) and runs the 855resolution command before X kicks in. All in all a nicer way to deal with hibernation.
I still haven’t got suspend to ram working. Standby works, though.
Now all I need is to get 855resolution working on Solaris and most of my complaints will just vanish into the distance.

Image file execution options (or how to replace taskmgr.exe)

Well, tricked out with the new procexp.exe, I wondered how it did it’s magic ‘replace the task manager’ option. It turns out that this magic is from the Image File Execution Options registry key entries. There’s a blog entry which describes this feature. process explorer sets itself up as the debugger application for taskmgr.exe, when you try to launch taskmgr, it launches procexp first as it’s debugger, which then doesn’t launch taskmgr.

Valid windows file names

I keep forgetting this when I decide to accidentally create files with names that turn out to be undeletable under windows. What makes a valid Windows file name? is a blog entry on Brian Dewey’s blog and it reminds me that using the \\?\ feature bypasses the MAX_PATH check for a file name’s length when trying to manipulate it (or delete it). I’ve accidentally created files with long names a few times, and been unable to delete them. Thankfully I’ve created a little application that allows me to do this now.

Buy one for Mid January (Xbox 360s in Tralee)

I wandered into the store yesterday and they have sold out of Xboxes. Now they have a sign up telling people that they can pay for the box now, and expect it in mid January. Well, I would just love to see the face of some snotty little kid on Christmas day, expecitng and Xbox and getting a card saying: ‘iou in mid January’.
Liver liver on the wall, who’s the swollenest of them all.

New Xboxes for sale in Tralee

Considering al the insanity that followed the launch in the USA with people having to get the next generation console it is refreshing to note that there are Xbox consoles for sale in the Smyths toy shop in Manor West in Tralee. Of course, I’m not going to buy one. I did buy a television on Sunday – the smell of fried capacitors on the old one convinced me that it needed to be replaced.

Shock horror! hyperthreading not perfection in a box!

Yawn, an article on zdnet news tells us that hyperthreading isn’t all that for overloaded servers. All I have to say is duh! that’s not what it’s intended for. Mind you the benchmark was:

Ocks then detailed testing which showed this behaviour where a system thread — in this case one cleaning out blocks of disk cache memory — is running at the same time as worker threads. “With Intel HT technology, logical processors share L1 & L2 caches. As you would guess [this] behaviour can potentially trash L1 & L2 caches,” he said.

It looks like all this information came from a blog posting from a SQL server bod in Microsoft. Hyperthreading was never intended to be a replacement for multiple processors. It is evident from the examples cited that the systems in question were not designed with a two-tier processor model in mind, it treats both processors as if they were actual separate processors, and as such makes utterly bone-headed decisions in scheduling that cause massive performance degredation.
That and the fact that there is a thread that churns through vast amounts of memory deciding to store certain database pages out to disk. Ouch! That sounds a tad slow and broken.
Considering the blog entry and the two comments at the end, I’d have to say that yes, indeed, treating a multi-threaded processor like multiple processors is a bad thing to do.