Archive for May, 2007|Monthly archive page
text and cool
“Caps lock is CRUISE control for cool. ” – Matt Sayler
My coworker David relayed this fantastic quote from a friend of his written while chatting in IRC. I read it with a bit of sarcasm however you might not. I find it is poking fun of people who scream all the time using uppercase in chat rooms or email. The idea that it’s cruise control for something that, well, really isn’t cool is great. Well said Mr. Sayler.
coffee and golf
While getting on the elevator to head out for a quick nap (I love naps), my boss three times removed joined me on the office with an office manager. They were heading out for coffee. I made the observation, and I think this is right, that walk to get coffee is replacing the corporate golf meeting. Maybe not in duration, but definitely a lot of networking and office politicing takes place during those trips to the local coffee shop (not Starbucks–use delocator.net to find something better!).
Sadly, I don’t drink coffee. Chai, most assuredly, but not coffee. Yuck. Coffee ice cream however…
mock your boss
Random thought: National Dress Like Your Boss Day
A national event to make fun of your boss. If it ever come true, you heard it here first!
Improv Comedy Class
At last night’s improv comedy class started out slow, neg’ing and asking a question during the question and response lines. But then I think I warmed up. I was:
- a matador practicing in a vegetable garden.
- a midget artist struggling with using math in his art.
- a man watching his relationship fall apart because he’s caring for his mentally failing grandfather.
- the bat cave’s cleaning woman consoling batman’s daughter (“My noise is all stuffed up”, “let’s use the batkit.”).
and a fun time was had by all…
Nerd Humor
My colleague said something that cracked me up, perfect for this blog.
Said in the voice of the young star of “Sixth Sense”:
“I can VNC dead machines..”
The nerds out there are laughing, the rest of you..I’m sorry…explaining it loses the humor.
Compilers, Programming languages
Compilers are beautiful things. OK, I’ve said it and driven off 2 of the 3 readers I have. Thanks Liam for staying on, I owe you a beer.
I met with my new boss’s boss on Friday for a get to know you section and she asked what I like in computer science. That would be compilers. My Master’s thesis, at UNH, was “CUB: C* UnBugger”. It was a debugger for UNH-C*, a multithreaded implementation of Thinking Machines C*. It was fascinating. It combined many interesting operating system elements (/proc, threads, process suspension, sockets) with programming languages (symbol tables (thanks Keith), run-time stack, embedding of symbol table information into executable, multithreaded runtime represented as single threaded).
So, you might not be surprised when I say: compilers is one of the most important classes a computer science major can take. I believe it is a necessity for a complete computer science education. Yes I realize I’m biased, but follow me here. Understanding how a compiler works makes you a better programmer. If you understand the stages of compilation–lexical analysis, semantic analysis, conversion into an AST, code optimization and finally code generation, you can understand the advanced features that are appearing modern programming languages. For instance virtual functions. Do you understand how they work under the hood and why, when optimizing for performance why they are so expensive? They come with a price. Or perhaps what the linking phase is? Do you understand what’s going on when the linker spits out an error because it’s missing a symbol? Thank you Professor Phil Hatcher for introducing these concepts to me in CS611 in my second semester of my freshman year in college. It’s a fundamental like this introduced early in my computer science education that allowed my mind to expand early to more complex concepts–virtual function tables and later in life Microsoft’s implementation of generics in C#. Possibly those fundamental concepts made the understanding and adoption of delegates in C# (which I miss so much in java BTW) so easy for me to grasp and use in interesting ways.
Also, learning about the internals of compilers illustrates the transition of theory to practice. It begins with the problem of parsing–how to examine a sequence characters and associate meaning to them. The theory of parsing lead to the writing of lex and yacc (and their later forms flex and bison). The beauty of lex isn’t completely appreciated, I believe, until plugged into yacc. With understanding of yacc, one can see how languages work. I remember once getting into an argument with someone that one should first write the lex code and then yacc–my foolish youth when I valued more the look and feel of a language over semantics. I didn’t even realize that the look and feel of the language was still to a certain extent up in the air if only the grammar was known. Anyway, there are some languages that don’t fit into the lex/yacc model (I believe python can’t use lex/yacc because of python’s sensitivity to whitespace, which I approve of BTW). But nonetheless, languages that can be parsed and converted into an AST are still very common and I doubt will be going away anytime soon.
After the creation of the AST (abstract syntax tree), code optimization comes into play. Beauty. These are things a programmer might try to do for them self. Factorization. Peep hole optimization. With an understanding of the optimization phase, you’ll realize writing readable code is more important. Leave it up to the compiler to optimize the little stuff. That said a Duff’s device is a beautiful thing. A compiler might not be able to optimize verbose but equivalent code to match the code generated by the Duff’s device.
Instruction scheduling to better optimize the processors pipeline (well, that might be more of a code generation phase). Goin’ meta on some code’s ass makes the compiler writer a better programmer.
pRoot->GenCode();
Ah! Beautiful. This is where the student should pay attention. What’s going on under the hood? How is a loop in C implemented? For the first pass, assuming the machine has a large number of registers and just dumping the assembly is instructional unto itself. But, when trying to optimize register usage and converting it into a graph coloring problem is further proof of one of my previous statements: compilers is a beautiful illustration of theory to practice. Yes, one could argue this is the reverse, practice back to theory, let’s ignore that for a moment, or, in fact not (mid-sentence change of heart). In compilers one moves back and forth between theory and the down-n-dirty. Here we examine USE-DEF chains to determine the overlap of register lifetimes and convert that into a graph coloring problem. Each node in the graph represents the life time of a register and the arcs between the nodes show what registers are active when other register are active. The colors used to fill the nodes represent a particular register. Minimizing the colors used to cover the graph minimizes the registers used to execute the program. I can’t recall exactly what sloppy register use could lead to, perhaps slower executing programs because some registers might be faster than others and undoubtedly because of hardware cost there are not many of these, but it surely is a good thing to minimize register usage.
Instruction scheduling is also a very interesting problem. If you are generating assembly code (my assumption), then what is the optimal order to execute the instructions that keeps the pipeline full? I’m not as familiar with this but it’s an interesting problem which is grounded, again, in the practical.
Live it. Love it. Compilers.
Comments (1)
Comments (2)
Comments (1)