knowledge-kitchen / course-notes

Computing Terminology

What is a computer?

Processor/microprocessor/central processing unit (CPU)

Clockspeed

Source code

Machine code

1101101010011010

Assembling

Example of assembly language

Example

The following is an example of a simple program in both assembly language and its equivalent in native machine code for an x86-64 processor:

Assembly Code (x86-64, AT&T syntax):

mov    $60, %rax    # syscall: exit
mov    $42, %rdi    # exit code 42
syscall             # invoke syscall

Each of the instructions corresponds to the specific numeric sequence indicated in the machine code equivalent below.

Equivalent Machine Code (hexadecimal):

b8 3c 00 00 00    # mov $60, %rax
bf 2a 00 00 00    # mov $42, %rdi
0f 05             # syscall

The machine code instructions are represented in hexadecimal number form, not binary, for better readability.

This program, when assembled and run, will exit with code 42.

Compiling

Interpreting

The reality of compiling vs interpreting

Implementations

Many real world high-level programming language implementations use one or both of compiling and interpreting. Here are a few examples:

C:

Shell scripts:

Java:

Python:

Bytecode

Java bytecode

This paradigm is now common in more modern programming languages like Python, Ruby, and even PHP

Java source code to byte code

Documentation

Documenting code is important for readability and maintenance of that code. Most languages have common conventions for how developers leave notes and document their code.

Python

Java