Final Flashcards

1
Q

Linking that happens when a program is running or starting to run

A

Dynamic linking

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

Where do global constants and variables go?

A

In the AR for the main block

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

These are examples of what?

  • Ready
  • Running
  • Waiting
  • Suspended
  • End
  • Abend
A

Process States

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

Process state:

On stand by until I/O finishes

A

Waiting

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

What are the main sections of an object file?

A

header, text (code), data, relocation, debugging info

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

puts the OS in memory and starts running it

A

Boot(strap) loader

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

Allows the IR to specify a call target (address) that will be determined later

A

label

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

Assemblers relieve the tedium of machine code by:

A
  • translating names to locations
  • translating mnemonics to opcodes
  • translating decimal to binary
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Process state:

Finished execution

A

End

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

Why does a PCB contain the BP, SP, and PC?

A

If we need to stop the process, need this information recorded, so can restart it

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

+ simple to implement
+ good performance
- complex code and hard to maingain
- any crash crashes entire OS

A

Monolithic OS

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

What must an assembler do if a computer architecture has jumps to absolute addresses?

A

Translate jumps relative to PC to absolute addresses

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

How many passes would a linker need?

A

two: one to lay out the code (and build a symbol table), and another to fill in addresses

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

Records information from static analysis, including attributes of names used.

A

Intermediate Representation (IR)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  • Stores local variables
  • gives each recursive call its own locals
A

Activation Records (ARs)

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

Pushes the static link (the BP value) on the stack, then it pushes the old value of BP on the stack (the dynamic link), then it pushes the return address (old PC) on the stack

A

CAL

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

If some variables were dynamically scoped, how would they be addressed?

A

Use the old BP as the dynamic link, and look back through the dynamic links

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

An area of program text where declarations are effective and in which duplicate declarations are prohibited.

A

Scope

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

What mode does an interrupt execute in?

A

kernel (supervisory) mode

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

code that is called (run) in response to an interrupt occurring

A

Interrupt handler

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

In assembly language, names are abstractions of

A

data locations and addresses in program space

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

What addresses would need to be relocated and would need to be marked as such?

A

labels (jump targets), data names (for globals)

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

What should be the mode when the system is booted?

A

Start in system (kernel) mode, to initialize the hardware, including trap tables.

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

OS organization scheme with layers, but with the kernel as small as possible. Non-essential components become (user space) apps

A

Micro-Kernel OS

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

must be explicitly programmed with many machine instructions and explicit use of temporary storage

A

Assembly language expressions

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

puts together object files, resolving symbolic addresses (of data and subroutines)

A

linker

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

OS organization scheme in which the kernel has a set of basic services, other services added as dynamic modules. Each module has defined API, but any module can call any other module.

A

Modular OS

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

What type of interrupt cooresponds to these examples?

  • division by zero
  • arithmetic overflow
A

Trap

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

Starts a program at a random offset in memory for security purposes.

A

Address Space Layout Randomization (ASLR)

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

An area of memory assigned by the OS to a process

A

Process Address Space

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

In C, when the function main returns, what is it returning to?

A

The OS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q
  • is active (running or waiting to run)
  • has its own memory
  • has various permissions
A

Process

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

Does a programmer of a higher-level language need to know how the machine’s instructions work?

A

No, but helpful

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

An array of starting addresses for interrupt handlers

A

Trap table or interrupt vector

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

How are interrupts implemented at the hardware level?

A
  1. Instructions are added to signal interrupt events
  2. At the end of each fetch-execute cycle, the CPU checks for interrupt events
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

A (privileged) register containing:

  • interrupt flags
  • process mode (user or privileged)
  • PC
  • condition code(s)
  • interrupt masks (which ones are disabled)
A

Program Status Word (PSW)

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

During which pass of the assembler does the following happen?

  • check that all labels are defined
  • generate machine code
A

Second pass

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

Ways to organize an OS

A
  • Monolithic
  • Layered
  • Micro-kernel
  • Modular
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

A unit of parallel execution in a process

A

thread

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q
  • shares address space
  • has its own stack and locals
A

thread

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

Locking

A

A locked resource can only be accessed by the lock’s owner

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

What syntactic features start scopes in C?

A

files, functions, and curly braces

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

If we have a computer with virtual memory, do we still need relocating loaders?

A

Yes, if we want to use address space layout randomization (ASLR) to start the program at a random offset.

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

puts program’s text and data into specific memory locations

A

Absolute loader

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

Process state:

Wating to run on the CPU

A

Ready

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

No distinctions, boundaries between user and OS programs, all can directly use the BIOS drivers.

A

Monolithic OS

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

Saves the running process’s state and jumps to appropriate code depending on type of encountered interrupt

A

Interrupt handler

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

What kind of information is needed from a name’s use in order to generate code?

A

Its lexical address

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

Is linking necessary for execution?

A

No, but it saves coding time!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q
  • Records structure of programs
  • provides placeholders for attributes needed for code generation
A

Parser

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

An area of code in which a thread (or process) accesses a shared resource (e.g., a variable)

A

Critical section

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

A data structure that an OS uses to manage processes

A

Process Control Block (PCB)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q
  • can share library code among running processes
  • can propagate updates to library code quickly
A

dynamic linking

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

threads that execute by interleaving instructions (sharing a core, timesharing simulating parallelism)

A

Apparent concurrency

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q
  • is a normal library function call
  • saves state
  • executes interrupt instruction
A

System call

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

In higher-level programming languages, statements correspond to…

A

Several machine instructions

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

What does the C code look like for generating code for a PL/0 while statement?

A
[code to evaluate the condition]
JPC 2
JMP [past loop body]
[code for loop body]
JMP [to start of the condition]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

+ easier to maintain, well-defined interface for each layer
+ easier to debug
- designing layers is hard
- passing data through layers can be slow

A

Layered OS

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

What starts a scope in PL/0?

A

Procedure blocks are scopes in PL/0

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

Why are race conditions a problem?

A

they make debugging (exponentially) harder due to state space explosion

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

In higher-level languages, names are abstractions of

A

variables, constants, and procedures

62
Q

Why are identifier uses important?

A

because they are a base case for generating code and that is where the identifier’s attributes are stored

63
Q

Three types of loaders

A
  1. Absolute loader
  2. Bootstrap loader
  3. Relocating loader
64
Q
How would the C declaration
     int i;
be compiled for a stack machine?
A

space would be allocated on the stack, not initialized

65
Q

How to prevent useres from writing over code for interrupt handlers?

A

Cause a trap when user process tries to write into protected memory area

66
Q

How does the trap table get initialized?

A

The OS does it during boot time

67
Q

Types of safe synchronization mechanisms

A

Locking and Monitors

68
Q

Is a program a process?

A

No. A program is not executing

69
Q

are implicitly computed with many machine instructions and implicit use of temporary storage

A

Higher-level programming language expressions

70
Q

Combines object files resolving symbolic names For example, a program and a library.

A

Linker

71
Q

OS goal: give illusion that a process…

A

has the whole computer to itself.

72
Q

Linking that happens before running a program, once and for all

A

Static linking

73
Q

An interrupt that occurs due to a program error or malicous action

A

Trap

74
Q

Identifies parts of instructions that need offset added if the starting address is changed to 0 + offset

A

Relocation data

75
Q

Process state:

Temporarily waiting for the OS

A

Suspended

76
Q

threads that execute simultaneously multiple instructions at the same time (multiple cores, parallelism)

A

True concurrency

77
Q

With static scoping, what does the BP register point to on the stack?

A

the location (at the bottom of the AR) where the procedure’s static link is stored.

78
Q

What does ‘'’INC’’’ do?

A

It allocates space on the stack

79
Q

Does a linker treat user program code differently than library code?

A

Yes, it will statically link user code, but may dynamically link library code

80
Q

Contains:

  • process ID
  • mode (user or system)
  • priority
  • state (running, waiting, etc)
  • code
  • etc.
A

Process Control Block (PCB)

81
Q

Where does the compiled code put the result of an expression (in a stack machine)?

A

on top of the stack!

82
Q

Modern OSs use _ linking for libraries, but compilers often use _ linking for programs

A

dynamic, static

83
Q

OS organization scheme in which each layer can only use 1 layer below it

A

Layered OS

84
Q

How is a constant’s lexical address used to load the constant’s value?

A

If the constant is at lexical address (levels, offset), then the generated code follows levels static links and loads using the offset from the start of that AR’s constant area (past the 3 links)

85
Q

In an OS:

_ cause transitions from one state to another.

A

Interrupts (events)

86
Q

Does the code for a procedure body need to reserve space for the links?

A

No, the CAL instruction does that

87
Q

Code that is run whenever (a certain kind of) interrupt occurs

A

Interrupt handler

88
Q

What does ‘'’LIT n ‘’’ do?

A

It pushes n on the stack

89
Q

Prevents user programs from writing OS area of memory (say address from 0 to 3K)

A

Address Fence

90
Q

Does linking support separate compilation?

A

Yes! The files linked can be from different modules of a program.

91
Q

What information from a name’s use is needed to generate code in PL/0?

A

Its offset from the start of the AR

92
Q

Represents the activity that a process is doing

A

Process state

93
Q

Why don’t you need to use the trap instruction in your own code?

A

Because it’s already written in a library function

94
Q

Why would the OS need to stop a running program?

A

To handle an I/O interrupt, or other asynchronous event

95
Q

Does an assembly language programmer need to know how the machine’s instructions work?

A

Yes

96
Q

Adds an offset to each place identified in the relocation section

A

Relocating loader

97
Q

During which pass of the assembler does the following happen?

  • count instructions
  • determine address of each label
A

First pass

98
Q

A program being run (or that could be run) in an OS.

A

Process

99
Q

Process state:

Using the CPU

A

Running

100
Q

What hardware is needed for I/O interrupts?

A

A flag to indicate an interrupt is waiting.

101
Q

+ OS becomes more portable
+ better security and reliability
- more internal communication in the OS, so worse performance
- design is harder

A

Micro-Kernel OS

102
Q

Can the “levels outward” part of the lexical address be determined when the variable is declared?

A

No, it depends on the nesting of the use

103
Q

Should signaling an interrupt be a privileged instruction?

A

No, user code might encounter such situations

104
Q

Is the symbol table unchanging (immutable)?

A

No, it is updated as scopes are entered and left

105
Q

Do I/O interrupts need to be handled quickly?

A

Yes, the information may be lost otherwise.

106
Q

An execution equivalent to executing one thread at a time (equivalent in terms of getting the same results / final states)

A

Serial execution

107
Q
How would the C declaration
     void incI() { i += 1; }
be compiled?
A

the body statement would have code generated and a return instruction added to the end, then the code generated would be put somewhere for later use

108
Q

Would it be better for to wait until another to complete rather than giving each process a time slice?

A

No, another process might go into an infinite loop!

109
Q

Statements correspond to one machine instruction in…

A

Assembly Language

110
Q

Translates from assembly language to machine code.

A

Assembler

111
Q

Where are constants and variables stored?

A

On the runtime stack, in the local frame

112
Q

running user processes directly on the CPU, but not permitting them to execute dangerous (privileged) instructions

A

Limited direct execution

113
Q

Should the parser create the lexical address of a name’s use during parsing?

A

No, that needs information that is more readily available during static analysis (from symbol table)

114
Q

What are the four main sections of executable ELF files?

A
  1. Header
  2. Text section
  3. Data section
  4. Relocation section
115
Q

Which linking type is better for computer security

A

dynamic linking

116
Q
  • avoids runtime overhead for linking
  • avoids missing library code problems
  • allows checking of library code before running it
A

static linking

117
Q

A technique that keeps two or more threads (or processes) from executing their critical sections at the same time.

A

Mutual exclusion

118
Q

loads (a loader to load) the operating system (OS)

A

Bootstrap loader

119
Q

How are interrupts implemented at the hardware level?

A
  1. Instructions are added to signal interrupt events
  2. At the end of each fetch-execute cycle, the CPU checks for interrupt events
120
Q
  • Run user programs directly on the CPU for efficiency
  • Don’t allow user programs to execute some instructions and protect some areas of memory
A

Limited Direct Execution

121
Q

How can assembler know the address of the label “ahead”?

JMP ahead     ; forward reference
ahead:            ; label
A

Uses two passes

122
Q

Why not have all calls of a procedure share the same storage?

A

This would break recursion

123
Q

Directly manipulates a (virtual) machine’s state and in which each statement corresponds to one machine instruction

A

Assembly Language

124
Q
  • Makes it easy to run programs.
  • Provides a standard, convenient interface between programs and hardware
  • manages the sharing of computer resources
A

Operating System (OS)

125
Q

In C there are 2 kinds of if-statements with syntax if (Exp) Stmt and if (Exp) Stmt1 else Stmt2 How would these be compiled?

A

Use 2 different kinds of AST

126
Q

Places a program into memory so it can be run

A

Loader

127
Q

How is the code generator written in C?

A

Follows the grammar of the abstract syntax

128
Q

What is a BIOS?

A

Basic I/O System

129
Q

A CPU mode that allows execution of all instructions

A

Privileged mode

130
Q

Occures when two or more threads (or processes) can update (the state of) a shared resource in ways that may produce different final states

A

race condition

131
Q

How to share resources on a computer

A

Enforce polices about sharing at runtime

132
Q

Derives the boundary between OS and users

A

Fence Register

133
Q
How would the C declaration
     const double e = 2.718281828459;
be compiled for a stack machine?
A

Space would be reserved for a double (2 words) and initialized with the given value (use something like a LIT instruction)

134
Q

Records attributes of names used (after finding them)

A

Static analysis

135
Q

put’s a program in memory anywhere there is space

A

Relocating loader

136
Q

Do timer interrupts need to suspend the running process?

A

Yes, otherwise it could go on forever!

137
Q

Can the “offset from start of AR” part of the lexical address be determined when the variable is declared?

A

Yes, that’s the layout within an AR.

138
Q

Where does a program loaded by an absolute loader start execution?

A

At the address specified

139
Q
  • not priviledged, but starts system (kernel) mode
  • runs some specified code based on a (trap) table
A

Interrupt instruction

140
Q

Also called a task

A

Process

141
Q

Somewhat like an AST, but a kind of abstract machine code, with information needed for code generation

A

IR Tree

142
Q

Assemblers generate code assuming the starting address is

A

0

143
Q

An execution is _ iff it always finishes completely or not at all

A

Atomic

144
Q

Process state:

Finished due to error or policy violation

A

Abend

145
Q

Assemblers help with programmer communication with:

A

Comments, labels, decimal numbers

146
Q

Used to check that identifiers are declared, and to check that each name declared is unique in its scope.

A

Symbol table

147
Q

An abstract server, which only one client can run at a time

A

Monitors

148
Q

What would be the output format for an assembler on Unix?

A

ELF

149
Q

users run in “user mode”
OS runs in “kernel mode”

A

Protection via system calls

150
Q

What are the components of a lexical address?

A

(levels, offset)