I investigated the use of a branchless absolute value function. This techniques alleviates register pressure at the expense of increasing branch mispredictions. The first implementation is for a 386 architecture, where eax holds the value to operate on:
It requires some creative thinking to understand exactly why this technique works. The cdq instruction is a sign extension instruction that extends register eax into edx:eax. The xor immediately following can be thought of as a selective invert; that is, the number is ones-complemented, but only if it is negative. The final sub instruction, somewhat paradoxically, adds one to the result if the number is negative, thereby performing a twos-complement. With some effort, one can see that the number remains unchanged if it is originally positive.
For clarity, cdq can be replaced with:
mov edx, eax
sar edx, 31
Both these implementations, of course, clobber register edx. In architectures where register pressure is high, such as the x86, this behavior may be undesirable.
As a result, the WATCOM and x86 gcc compilers use the classical implementation of (x < 0) ? -x : x. Indeed, this is demonstrated in the following x86 generated code:
mov eax, +4[esp]
test eax, eax
The branch misprediction penalty is acceptable. Similarly, the use of registers in a RISC architecture is relatively inexpensive; the first implementation is therefore preferred. The gist is this: don’t try to outwit the compiler. It’s smarter than you are.
Our group made a fair amount of progress on our senior design DCSP project. After some dyslexia on my part, the network settings were correctly configured and the Fedora machine is now on the network, albeit firewalled outside of campus. I also obtained keys to the control laboratory, and turned in some necessary paperwork to obtain card access to the two other senior design labs.
Recitation covered binary number systems and its representations, bitwise and logical operators, the C preprocessor, and standard UNIX streams. I also briefly discussed optimization with respect to various bitshifting tricks and the problems associated with prematurely optimizing code. Students should be familiar with input and output using fgets and fprintf, and basic interation for the upcoming lab next week. After the TA meeting, I formulated several potential exam questions, which I’ll forward on to Bill on Monday.
Farhana and I had a nice lunch at the Emory Doc Chey’s Noodle House in the afternoon, and had a good time. But the highlight of the day was definitely attending the blog meetup in the evening at Dupree’s pub and bar on Monroe. Most of my friends know that I’m not a very outgoing person, so I was a bit apprehensive about my first meetup, especially with a group of effectively random people with nothing more than a common interest in blogging. It turns out that I had nothing to worry about.
The group was very friendly and energetic, and there was never a dull moment in the conversation. Our common love for blogging provided a solid foundation that ultimately led to a variety of fascinating discussions and topics, including spam filtering, industry outsourcing, arcade emulation, the days of the BBS, foreign languages, and of course, news for nerds. The breadth and interests of bloggers present in the Atlanta meeting was simply astounding:
Tom Carr was interested in learning about the whole blog phenomena. He’s an active member on the The WELL, a non-anonymous online gathering place. I remember The WELL in its older form as a BBS in my youth, but had no idea that it’s still around. Though The WELL continues to have an active community, I think I’ll stick with USENET.
Mark Lusher runs MDL Consulting, a small business that specializes in computer and network support. He dabbles with a little bit of everything.
Michael Earls and I got along quite well because of our common interests in programming. He’s a big fan of Microsoft .NET and other Microsoft technologies, such as WinFS, metadata, and Microsoft Exchange. Being a Linux guru myself, it’s a great to be able to have an intelligent discussion with those on the other side of the fence. He’s a cool guy and I hope that we keep in touch.
Laurie Thompson-Earls is a first grade elementary school teacher. Her blog is particularly interesting because it’s not about technology, politics, or teenage melodrama. A refreshing change for the blog community.
Kelly is a retired college professor who maintains a political blog. He’s the kind of guy who is quite intelligent and easy to get along with.
Michael has an excellent summary of the May 2004 Blog Meetup along with his perspective on the cast of characters. Check it out. I’m greatly looking forward to the next meetup.
Stopped by the Office of Human Resources before class to turn in my hiring paperwork for the summer semester. We officially began work on our senior design project; I’ve set up a wiki page (ece4006) for it containing the project details. In short, the goal is to write graphical control software that utilizes Linux and GTK to interface with an IOtech DAQBoard/2000. The Comedi project develops open-source drivers, tools, and libraries for data acquisition which may come in handy. In particular, comedilib provides a user-space library to interface with Comedi devices.
I seem to have the worst luck with cars and wheels. The rear right tire of the Pontiac Bonneville seems to have mysteriously gone out, and since it isn’t insured by Big 10 Tires, I decided to try Discount Tire Company instead. They had excellent service and a friendly staff to boot. Still, this affair occupied most of my morning and early afternoon.
For whatever reason, I decided to experiment with an X11 server for elmo. After much research, I discovered Exodus, a commercial application that only runs on Mac OS 9.0 and above. I also stumbled upon a free alternative, MicroImages MI/X, though they no longer provide or support an X server for any Apple Macintosh system. Fortunately, their software can still be downloaded at the Mac OS Archives. It actually seems to work, though there are a few stability issues to contend with.
A frustrating full-day affair trying to get Mac OS 8.6, Linux, and Windows 2000 machines to network together. After spending several hours extracting archives for Mac OS 8.6 using Windows 2000, I realized that StuffIt Expander for Windows drops the resource fork. I therefore left for the Georgia Tech library to use their Power Mac G4 systems and burn the StuffIt archives using Roxio Toast 6 Titanium, available on every alternate machine in the library multimedia cluster.
I returned to the apartment after a few hours to install Mac OS 8.6 on the Power Mac 7200, which has officially been named elmo. The installation process was amazingly simple, once I discovered the Mac OS 8.6 installation manual. It did take a while to get used to all the Macintosh quirks. In the process, I also discovered Adobe Reader alternatives and MacSSH. After a failed attempt at networking elmo with the Samba server on chronos using Dave 5.0, I attempted to work in opposite direction, instead using netatalk on chronos to emulate a Macintosh AppleTalk server. It worked like a charm, with zero extra configuration on my part.
The remainder of the night was, of course, spent browsing the Macintosh Garden and playing long lost games from my youth.
I’ve noticed recently that a lot of comic books are being distributed in cdr and cdz formats. Though these are basically nothing more than rar or zip archives, they contain additional information about the orientation of each page for comic book viewers. Two of these viewers are CDisplay for Microsoft Windows and Comical for both Linux and OS X. They both have their share of bugs but overall tend to work fairly well. I also filled out a job application or two, and watched both Mean Girls and Monster at some point during the day.
Had lunch with Jon Razza before my interview with Liaison in the afternoon. It went as well as it could have, I suppose. Though their website is fully buzzword compliant, the small business is essentially an integrator for real-time message passing between businesses (B2B) using J2EE and XML in conjunction with other proprietary technologies, such as webMethods. These tools are then utilitized to ultimately form a common Data Exchange Protocol (DXP), and provide an alternative to Electronic Data Interchange (EDI, ASC X12), an older B2B electronic commerce technology from the 1970s and 1980s.
I met with Juan, Sanjay, Luke, and David to have dinner at Don Pablo’s before heading to the AMC Parkway to see Troy. Good stuff.
I’ll officially be working on Linux control software (DCSP) this semester as my major design project with Juan Mojica and Ryan Spanier. I’ll know more details about the actual project at the start of next week. Picked up my re-hire paperwork for Languages and Translation, and taught recitation in the afternoon on basic UNIX with a short introduction to C. Had a relatively long TA meeting in the late evening. Despite having very little course work, it felt like a long day.
Updated the Debian packages on both freya and chronos. Juan, Sanjay, David, Goetzinger and I had lunch at Ru Sans on Piedmont, a sushi bar with buffet that concentrates on an affordable Japanese menu that runs between eight and twelve dollars per person. It is located on the intersection of Piedmont and Monroe. I also talked to the academic advising office in the early afternoon and received a permit for the afternoon section of senior design.
I didn’t realize that Pair had a DB Resource Usage Policy relating to the number of active connections as well as running processes. I should investigate the various caching options that smarty provides at some point in the near future.