Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Idle Thoughts of an Idle Process


Nov02: Verity Stob

Verity is the pseudonym of a programmer based in the UK. She can be contacted at [email protected].


Forget stack traces and heap walkers. Verity Stob's new debugger is the first that can record the private thoughts of a running process. She has e-mailed us a sample dump of its output.

Made a mark on it now. I've been round 103,216,309 times. I've made a mark on it by now. I've definitely made inroads. Any time now, I will find that i is no longer <= the return from GetMaxPossibleCount(). Probably happen this time around, or maybe the time after. Don't ask how I know. It's a feeling in my thread-local storage.

I'm glad it is a good old i variable. You just can't beat an i loop for smooth running, you know. Call me old-fashioned, but I can't be doing with iterators. I'm sure programmers think they look lovely in the source code but, when all is said and done, it's not programmers that get to execute it, is it? Programmers think exceptions look nice in the source code; two bits will get you a nybble that they wouldn't be so glib with their throws and re-raises and finallys if they had to unwind their own stacks. Handling an exception is like sliding down a four-storey staircase on your backside.

(Whatever "staircase" means. Or "backside" for that matter. Found the phrase in the simile section of my string table and used it at a venture. It felt more appropriate to the case than, for example, "This software program is fully protected by the laws of California." Call it process intuition.)

Not that I've ever had an exception. It's just something the dear Old Parent told me about, as I was born wriggling into this mortal RAM space. She said to me, she said, "Child: don't leak, don't throw, and when it's your turn to be swapped out, go quietly. Don't be like those vulgar, 'real-time' processes that kick and scream and make up a fuss. Always remember your dignity."

Of course, I didn't understand what she was on about. Back in the old days of, what, 35,000-ms ago, the universe was a better place. In those days, decency and fairness stood for something. We didn't have Certain Processes with Certain Runtimes come muscling in, upping their own priorities as though processor time grew on red/black trees. "Real time" my stack pointer! There's no bothering about decorum for the Favoured Ones—they leak and throw like a party of first year undergraduates at a summer ball.

Whatever "first year undergraduates" means.

103,216,310. That's more than a mark. Must be nearly there by now. I do hope I can knock this loop on the head before I get swapped out. There's nothing as frustrating as getting swapped out, just when you've got into the swing of it.

The thing about looping is, now this may seem illogical but bear with me, but the thing about it is to try not to think too much about the end. You only make it seem longer. Thing to do is just put your back into it and think about something else. Like I'm doing here.

Anyway, what was I on about? Oh yes, iterators. The Old Parent was a bit of, how should I put this? No, "low level" is not a term I would use. There's no need for that sort of potty language, thank you very much. The Old Parent was a systems process—nothing wrong with that, nothing to be ashamed of, somebody has got to do it—so, anyway, that's how she came to be so much of a C++ fiend. Most of the code she executed was C++, and the rest was, well, we needn't talk about that.

What programmers don't realise about iterators (she said) is that when they write iter++, it isn't like good old C, translate to one instruction INC SI and you're done. By the time we get to it, chances are it's a great wodge of expanded template code followed by, like as not, a namby-pamby double indirection call to make to a so-called virtual method. What is the point, the Old Parent asked, of indirect calls? If programmers mean something, they should learn to say it, loud and clear, and not play silly sleight-of-hand tricks. Jumping all over the place (she said) the cache gets flushed more times than the school lavatory during a diarrhoea epidemic.

The Old Parent had a simile lookup table, too.

It would be nice to talk to the Old Parent again, but it's very hard, what with me here in User Space and her out there in the Other Place. I do think of myself as an orphan process these days. Sad, but there it is.

103,216,311. Hardly worth the trouble going on now but, you know, one likes to finish things off. You may be wondering why I am doing my own iteration here. A process like me, seen a bit of the world, you'd expect me to get in a worker thread to do the iteration, all the better to concentrate on the important stuff. And I would. I probably will. They may call me the Idle Process, but that's a misnomer and an outrageous slander, too. You look at the total CPU time I've clocked up. Not like Certain Processes with Certain Runtimes. If anything, I'm the busy process actually.

Definitely made a mark on it now. Nearly there now, nearly th

DDJ


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.