?

Log in

No account? Create an account

August 15th, 2002

hoodied

10 Tips on Writing the Living Web (A List Apart)

10 Tips on Writing the Living Web could be titled How to turn your LiveJournal into a real weblog. I'm delighted I know so many LiveJournals that don't fall prey to the listed problems, but sometimes I think "real weblogs" have to depend on better content instead of community features.

Not that I'm a shining example of any of these tips, either.

hoodied

winget, day 16: fribblewotzed flux capacitor

winget could fetch files just fine unless I tried to have it get two at once--that is, tried to call the wget code in two threads concurrently--so, I guessed I had a critical section I wasn't aware of, because I wasn't being fully aware of what was being done in the data segment. (Yes, I moved from 251 Intro to OS to 260 Assembly/Intro to Architecture.) Turns out that was right.

This morning I discussed it with Ink, so I could actually understand what's in a C program's data segment. Global variables are. Variables declared in a function are dynamically allocated on the stack, but since they're basically global variables with their scope lexically limited by the compiler, a function's static variables (you know, the ones that keep state between invocations of the function?) are in the data segment. The surprise that I didn't realize all day (not that I was working on it all day) was that the private variables in a function that is itself static are in the data segment too. Seems obvious, but hey: if it weren't, I wouldn't've thought of it.

And, at least, that's how it acts empirically: if I unstatic the static functions that get called by the thread, I get exciting, new errors instead of the old ones. (Namely a failed assert, since it's checking that a global variable is still initialized to NULL when the last thread already used it.) If I'm misunderstanding what's going on, hopefully someone will disabuse me.

Anyway, this brings me finally into the realm of modifying wget code instead of just hooking into it with new code. That doesn't have any license ramifications since I was already going to link my code with wget's, but still.