Chapter 1 - Part 1 Flashcards

1
Q

What does the preprocessor do in C and what does it output?

A

The preprocessor modifies the original C program and outputs ASCII text.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the assembler stage do in a C program, and what does it output.

A

The assembler stage translates the assembly code into machine language instructions. It is output in a binary format, called a relocatable object program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the compilation stage do in a C program, and what format does it output?

A

The compilation stage converts the C code into assembly language and outputs the generated code as text (usually with a .s extension).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the linking stage do in a C program?

A

Linking merges other object files referenced by the C program, and outputs an executable file (in machine language binary), which is ready to be loaded into memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you convert hex to binary using the bc command line tool?

A

echo ‘obase=2;ibase=16; A’ | bc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

First stage of C compilation + clang command

A

Preprocesser: clang -E hello.c > hello.i

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Second stage of C compilation + clang command

A

Compiler: clang -S hello.c

$ hello.s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Third stage of C compilation + clang command

A

Assembler: clang -c hello.c

$ hello.o

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Fourth stage of C compilation + clang command

A

Linker: clang hello.c

$ a.out

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How large is a word?

A

Words refer to a fixed size of bytes, but have no fixed size. Most modern machines use either 4 bytes (32 bits) or 8 bytes (64 bits).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Name 4 standard I/O devices.

A

Keyboard, mouse, display, disk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

For I/O devices, what’s the difference between a controller and an adapter.

A

A controller is soldered into the motherboard, an adapter plugs into motherboard slot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does DRAM stand for?

A

Dynamic random access memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a word-sized storage device in the CPU called?

A

register

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the program counter in a CPU.

A

The program counter contains the address of a register holding the next machine language instruction it will execute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does ALU stand for in a processor?

A

arithmetic logic unit

17
Q

What is a ‘register file’?

A

A register file is a storage device that consists of multiple registers with unique names.

18
Q

What does the ‘load’ machine operation do?

A

Copies data from main memory and stores it in a register, overwriting whatever was previously there.

19
Q

What does an ‘operate’ operation do?

A

Copies the contents of two registers to the ALU, performs an arithmetic operation on the two registers, and stores the result in a new register, overwriting what was there.

20
Q

What does a ‘store’ operation do.

A

Copies a word from a register to the main memory, overwriting what was there.

21
Q

What does a ‘jump’ operation do?

A

Gets a word from the instruction, and copies it to the program counter.

22
Q

What’s the difference between a machines instruction set architecture and its microarchitecture?

A

The ISA is an abstraction over the microarchitecture. The ISA describes what each instruction will do, and the microarchitecture handles the actual implementation.

23
Q

Approximately how much faster can a processor read code from a registry file than main memory?

A

~ 100x

24
Q

What does SRAM stand for, and what is it used for on the hardware level?

A

Static random access memory. It is used to create caches that are smaller than the main memory, but faster and closer to the CPU. These are usually called L1, L2, and L3 caches, and their sizes get larger as the go up in levels.

25
Q

What does the term locality mean with respect to memory

A

Locality refers to the tendency for programs to access data and code in localized regions.