Friday 22 July 2022

Embarrassing #2: Threads

The next story of embarrassment is one of my own, after my experience in my degree I literally specialized in the Borland implementation of the C++ compiler, and the Turbo Pascal one before it.  Java was new on the scene, and so my first job was to go port old Pascal programs into C++ all using C++ Builder.

At a trade show I was poached by the head of finance of another first, not a rival, a completely other market sector, but she wanted me to work for her... I therefore did.  And this meant a physical house move in the process.

This woman being the head of finance would be important later down the line, as she had an idea where I would sit in the business and I duly showed up.  In actual fact I showed up so early I entered the property without permission through an open door and caused a bit of a stir because I was all alone; and could have been anyone not just a new employee.

So I began work and the data processing they wanted was incredibly slow.  This was the era of the Pentium III being king, and my machine was a 400Hmz machine, not a slouch for that year.  But still it was very slow, you had to take a feed of data from IO and process it live; not all of it could fit into memory; so you often had the process spinning waiting on the disks.

I delivered the first iteration just like this, a single inline 1:1 just get her done.  It was horrifically slow.  My embarrassment?  I didn't even understand why it was slow, the manager looked at me; sternly, this kid he didn't really want, and pointed me to "BeginThread".

There wasn't any internet access, no stack overflow, you had to learn by the seat of your pants.  So I cracked open the windows headers for threading in Windows 95 (I forget the SDK version) and start to look at starting a thread.  I had to read about MFC too and a bunch of other stuff in this Microsoft compiler which was not in Borland's; or was different.

I don't think the engineering manager understood I could do all this in Borland, just not in Microsoft.

With these old eyes I look back at this episode and I laugh when kids today complain about std::thread, lambda's, Futures, Async dispatch.  You guys do not know how lucky you are!

And I was embarrassed by not knowing this stuff, worse still was going home to my machine at home, and not being able to follow any of this up, I could read about things, make notes, but not implement any of it; for my machine at home I only had the Borland stuff (and a pretty penny I paid - unbeknownst to me they would soon give away C++ Builder on PC Magazine cover discs).

Ultimately today, to me, this is a lesson in the history of compiler differences between vendors, but at the time I was mortified.  I promised myself I'd never fall behind or out of step like that again, and I've so far achieved it.  Though I had to admit to being off the boil with C++20 right now.

No comments:

Post a Comment