CS241 Lecture Notes - Lecture 1: Nibble
Sequential Program
- In a sequence
- Not doing mutliple things in parallel (not at the same time)
- A single threaded program
Goal
- Understand how sequential programs work
- How is this program running?
- Describe the relationship between high level programming languages and machine level
data representation
This course talks about different abstractions.
Computers understand machine language which is binary and can be tedious to write so...
We abstract over it assembly language and use tool to translate between them.
Assembly is also tedious so we write some higher level of abstraction (like C, C++, Java, Racket –
all higher-level languages).
We can translate from high level to assembly (compiler) and then to machine (assembler) or we
can go directly from high level to machine (compiler).
You will get to write programs that read programs and output programs.
Data Representations
How is data actually represented in a machine?
- bit: smallest representation of data (a single digit in binary - 0/1)
- byte: a sequence of 8 bits
- word: it is machine specific/dependent (size depends on machine), a sequence of bits (in
this course it'll be mostly 32 bits or 4 bytes)
- nibble: half a byte or 4 bits
example string - 1000011 - What could this mean?
- -3 (signed binary)
- one million eleven (decimal representation)
- 67 (unsigned binary)
- -61 (2's complement number - another signed binary form)
- C (ASCII upper case c)
- garbage
Decimal Representation (powers of 10)
1000011 - 1x10^6 + 1x10^1 + 1x10^0
Binary Representation (powers of 2 - unsigned)
1000011 - 1x2^6 + 1x2^1 + 1x2^0 = 67
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
Not doing mutliple things in parallel (not at the same time) Describe the relationship between high level programming languages and machine level data representation. Computers understand machine language which is binary and can be tedious to write so We abstract over it assembly language and use tool to translate between them. Assembly is also tedious so we write some higher level of abstraction (like c, c++, java, racket all higher-level languages). We can translate from high level to assembly (compiler) and then to machine (assembler) or we can go directly from high level to machine (compiler). You will get to write programs that read programs and output programs. Bit: smallest representation of data (a single digit in binary - 0/1) Word: it is machine specific/dependent (size depends on machine), a sequence of bits (in this course it"ll be mostly 32 bits or 4 bytes) 61 (2"s complement number - another signed binary form)