News: 1607947626

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Top tip from the original Task Manager taskmaster: Don't put your phone number on that debug message box

(2020/12/14)


Retired Microsoft engineer Dave Plummer has continued his series of Windows insights with a rummage around historical Task Manager source code.

Plummer talked about his role in the creation of Task Manager [1]earlier this year and has posted a series of videos on the subject on his [2]YouTube channel over recent days, culminating in today's probing of the source code (via Visual Studio Code on Mac).

Famously a hobby project that caught the eye of Windows NT supremo Dave Cutler and added to the source tree, Task Manager was, according to Plummer, "the only time in my entire Windows career that I had the opportunity to create a new main() for an application in the product."

Plummer recalled a desperate attempt to track down a near-impossible-to-recreate CPU totalling bug that led him to add, and then forget about, an assertion that popped up his home telephone number whenever usage came to more than 100 per cent. The assertion was removed when the bug was fixed, but not before it found its way into the beta.

And the bug? It wasn't the kernel. It couldn't be the kernel.

It was the kernel.

Plummer revealed that at first Cutler had him put the "technical and nerdy" Task Manager at the very top of the Start Menu, "which was basically received as a big middle finger by the Windows 95 shell designers" who had the mission of simplifying the PC experience. It was later shifted to the more reasonable System Tools.

Plummer also took viewers on a tour of the C++ source code behind the scenes (or at least as it was around the time of his retirement, in the era of Windows XP and Server 2003).

Sadly, while Microsoft gave permission for Plummer to show portions of the source on YouTube, the 22,000 or so lines of code have yet to trouble a public GitHub repo à la [3]DOS or [4]File Manager . There is, after all, every chance that large chunks of it may still be lurking within the live product (although the Windows 10 Task Manager is a very different beast visually to that of Plummer's era).

Microsoft might also need to clean up the comments a bit; Plummer highlighted one section where his 20-plus-years-ago self had annotated the code with: // Yes, I could use virtual destructors, but I could also poke

// myself in the eye with a sharp stick. Either way, you wouldn't

// be able to see what's going on

The Register asked Plummer if there was anything else he came across that made him wince. "My original code assumed you would never have more than 32 CPUs," he replied. "In a world where simply having two CPUs was exotic and super expensive, I guess 32 seemed beyond reality to me in 1995. My own desktop 3970X would break it today!"

As for tips for his younger self – because let's face it; looking at one's own code from decades past can be traumatic in the extreme – Plummer told us: "Using the name Dave in so many of the function names seems a little odd now. It's not something I do now!"

Plummer directed kudos towards the current incarnation, telling us he was impressed with how it has "maintained that original vision of being compact, fast, and reliable," but remained proud of the resilience of his early code: "If you corrupt its registry data, it can effectively uninstall and reinstall itself silently behind the scenes to repair itself. If system resources aren't available, it does without. Most applications are content to, at most, validate that their assumptions are true. Task Manager adjusts and adapts to the reality of the situation, which is a step beyond."

His tour of the Task Manager source [5]can be found here , and the previous parts (along with time-absorbing gems such as [6]poking around in the innards of Atari's Tempest ) are on the engineer's [7]Dave's Garage channel. ®

Get our [8]Tech Resources



[1] https://www.theregister.com/2020/05/26/task_manager_confession/

[2] https://www.youtube.com/channel/UCNzszbnvQeFzObW0ghk0Ckw

[3] https://www.theregister.com/2018/10/01/microsoft_msdos_source_on_github/

[4] https://www.theregister.com/2018/04/09/windows_file_manager_back_from_the_dead

[5] https://youtu.be/CyJw2MumgTQ

[6] https://www.youtube.com/watch?v=BjsVSEbXDOM

[7] https://www.youtube.com/channel/UCNzszbnvQeFzObW0ghk0Ckw

[8] https://whitepapers.theregister.com/

Wolfclaw

Shame Microsoft now employ brain dead monkeys to do most of their coding and would scream if they didn't have megabytes of memory to waste.

A Non e-mouse

I suspect TaskManager is smaller & lighter as it has to work so close to the kernel. I bet most applications use much higher level abstractions which add all the bloat.

Anonymous Coward

"...work so close to the kernel..."

Surely it just queries the kernel via a well known API, so in theory anyone could write a task manager.

Korev

The pre-borg Sysinternals wrote the excellent Process Explorer, does any one know what that uses?

A virtual pint for the Sysinternals Tools developers -->

brain dead monkeys

Anonymous Coward

Teams.

Potemkine!

Wow! So there was a time when people were able to manage memory by themselves, without having to rely on a garbage collector? That's amazing!

// Yes, I could use virtual destructors, but I could also poke

// myself in the eye with a sharp stick. Either way, you wouldn't

// be able to see what's going on

I totally agree with that.

Ellipsis

Of course, if Dave did poke himself in the eye with a sharp stick, he wouldn’t be able to see what’s going on, either…

I do remember once running Spy++ at the same time as Task Manager, and being mildly surprised that ‘DavesFrameClass’ had made it into production code…

Source code

MarkET

The early versions of the Windows 3.1 DDK included an entry point named "OnlyBozosGetHere" along with "whatTF".

Process Monitor..

Anonymous Coward

..which replaced filemon and appmon are Task Manager on steroids

Still prefer original task manager

Captain Scarlet

As old machines easily consume 10% cpu resources just to display the new version

Dave's gone

druck

"If you corrupt its registry data, it can effectively uninstall and reinstall itself silently behind the scenes to repair itself. If system resources aren't available, it does without. Most applications are content to, at most, validate that their assumptions are true. Task Manager adjusts and adapts to the reality of the situation, which is a step beyond."

Dave was obviously long gone by the time of Windows 8.1, where it removes it's registry entries while running, so if shutdown unexpectedly (which is expected often), it starts backup having lost all the user settings.

Re: Dave's gone

Blackjack

To be fair, changing user settings is a way to crash Windows, or at least has been in any version of Windows I have ever used.

Default has the advantage that you know is most likely to work.

A sheet of paper crossed my desk the other day and as I read it,
realization of a basic truth came over me. So simple! So obvious we couldn't
see it. John Knivlen, Chairman of Polamar Repeater Club, an amateur radio
group, had discovered how IC circuits work. He says that smoke is the thing
that makes ICs work because every time you let the smoke out of an IC circuit,
it stops working. He claims to have verified this with thorough testing.
I was flabbergasted! Of course! Smoke makes all things electrical
work. Remember the last time smoke escaped from your Lucas voltage regulator
Didn't it quit working? I sat and smiled like an idiot as more of the truth
dawned. It's the wiring harness that carries the smoke from one device to
another in your Mini, MG or Jag. And when the harness springs a leak, it lets
the smoke out of everything at once, and then nothing works. The starter
motor requires large quantities of smoke to operate properly, and that's why
the wire going to it is so large.
Feeling very smug, I continued to expand my hypothesis. Why are Lucas
electronics more likely to leak than say Bosch? Hmmm... Aha!!! Lucas is
British, and all things British leak! British convertible tops leak water,
British engines leak oil, British displacer units leak hydrostatic fluid, and
I might add Brititsh tires leak air, and the British defense unit leaks
secrets... so naturally British electronics leak smoke.
-- Jack Banton, PCC Automotive Electrical School

[Ummm ... IC circuits? Integrated circuit circuits?]