Question

Dear Community members, I am going through computer architecture course at coursera.org The course presents the idea that an application translates into executing instructions on the microprocessor. Extending this idea, i want to know how an application such as word processor or as simple as emacs gets executed.

I mean what happens when you start the application, start to type, delete a word or a line, save and quit the application.

Is it possible to see what instructions get executed when the program is launched, in the typing mode, etc. How to see each instruction execution, its operands, memory and cache access?

If the question seems incomplete, please add the missing pieces to make it more interesting.

Thank you

Was it helpful?

Solution

We think of operations as "move the cursor one letter", "scroll to the next line", or "input the letter 'a'". The computer is MUCH simpler. It works in pure math and calls to load and store data in registers or memory. So "move the cursor" is really a long, long chain of:

  • get mem/reg location X
  • add some value to it, update original location
  • repeat....
  • now that all of the arguments are ready, invoke system call to update the screen

A simple thing is to look at what it takes to convert from C language code into ASM then into machine speak. Remember, even assembly is higher level than the 0's and 1's that actual drive the machine.

Translate the following into whatever ASM they are using for the class:

int result = 1;
int i;

for (i = 100; i > 0; i++)
{
    result *= i;
}

printf("%d\n", result);

Yes this is silly code. But look at the amount of code needed just to recreate that in ASM. Now, track down the machine code definitions for that ASM and translate the ASM into the binary. This gets monotonous really quickly. But, once you understand how it works you understand how VMWare works and how every computing device works.

OTHER TIPS

I don't know if the specific coursera course is enough for what you want. But an executable file, to simplify, is a set of instrutions for your physical processor on your PC for example. Machine code(assembly) for each function in the program is defined, and you can see it along with the memory it accesses in various debuggers while running. It's very interesting and i should suggest you that if you're already familiar with at least one programming language to continue to "Compilers" before attempting to study assembly straightaway. Coursera has a relative lesson https://www.coursera.org/course/compilers which seems interesting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top