Lecture 1 - Intro To Systems Programming Flashcards

1
Q

What is systems proramming?

A

Activity of writing computer system software that will be used as a platform for other software. i.e. there is a layer of abstraction

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

Examples of system software…

A

Drivers , OS , compilers

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

What is the software that is contrasted with system software?

A

Application software

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

What are the performance constraints usually imposed on system software?

A
  • fast execution time
  • low memory consumption
  • low energy usage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What do systems programming languages provide?

A

More fine grained control over the execution of programs

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

What are the two examples of system programming languages?

A

C and C++

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

What are the 4 programmig paradigms?

A

imperative
structured
object-oriented
functional

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

What is imperative programming?

A

Computations are sequences of statements that change program state

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

What is structred programming?

A

Structured programming organises programs with subroutines and structured control
flow constructs

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

What is object-oriented programming?

A

Object-oriented programming organises programs into objects that contain data and
encapsulate behaviou

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

What is functional programming?

A

In functional programming programs are mathematical functions and avoid explicit
change of state

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

What is the Python statement that gets the size of variable in memory?

A

sys.getsizeof(variable)

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

What is the C statement that gets the size of a variable in memory?

A

sizeof(variable)

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

Why should we use C for systems programming?

A

Has a high level of control, which allows strong reasoning about the program’s performance and execution behaviour

  • we can be more confident about the program overhead
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What must we do to a C program to execute it?

A

Compile it

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

What does the compiler do?

A

Translates source code to machine code via a number of steps.

17
Q

How to compile a C program using clang?

A

clang source.c -o name

18
Q

What happens when attempting to compile?

A
  1. Preprocessor expands macros
  2. Source code is parsed and turned into intermediate code
    3.machine-specific assembly code is generated
    4.machinecode is generated in an object file
    5.The linker combines multiple object files into an executable, if required
19
Q

How to generate the result of the preprocessor stage?

A

clang source.c -E -o name.e

20
Q

How to generate the result of the intermediate representation stage?

A

clang source.c -emit-llvm -S -o source.llvm

21
Q

How to generate the assembly code?

A

clang source.c -S -o source.s

22
Q

How to generate the machine code?

A

clang source.c -c -o source.o

23
Q

What does the linker do?

A

Linker combines one or more object files into a single executable. It does so by checking if all functions have machine code available, if not and it cannot be found it throws up an error.