Sunday, September 19, 2010

The Little Man's Computer

On Thursday we learned about computers on the lowest (machine) level with Introduction to Computer Science. The lesson started with the assignment to name devices that are computers, and of course they are all around us. It turns out that 90% of all processors that are manufactured today end up in so call embedded devices, from washing machines to cars.

After this introduction we were told how programming code is handled by computers. There are three terms that are important to this process: Compilation, Interpretation and Emulation. With Compilation, so called higher level code (programming code that is easy to understand for humans) is first translated into machine code or low level code. When an application is executed, the machine instantly gets this low level code to work with. With Interpretation, on the other hand, applications are saved in high level code, and when they are executed, the high level code is translated to low level code on-the-fly. The advantage of using this method is that you don't have to compile the high level code for every different architecture you want to use it on, but you can just use one piece of high level code on all architectures, since it will be translated on the moment of execution, specifically for the architecture you use it on. When however Interpretation can not be used, for example, when the high level code is not available to you, you can use Emulation. An emulator translates from machine code suited to one (processor) architecture to machine code suited to a different architecture.

At the end of the lesson we got to try our hands at low level programming ourselves. Using the Little Man's Computer we had to program a couple of simple applications such as adding two numbers. For the last assignment we had to program an application that could divide one number by another number, and the result had to be split into two parts: the "whole" part and the fraction part. While this may sound easy enough, it proved to be quite difficult, because we could only add and subtract, and couldn't multiply or divide. By doing this assignment it became clear to us that using low level code is overly complex, and it is far more convenient to use a high level programming language.

No comments:

Post a Comment