FINAL STUDY Flashcards

1
Q

Four issues of complexity?

A
  1. Emergent Properties
  2. Propagation of Effects
  3. Incommensurate Scaling
  4. Tradeoffs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Emergent Properties
(issue of complexity)

A

Properties that show when combining components

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

Propagation of Effects
(issue of complexity)

A

Problems in one component affect other components

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

Incommensurate Scaling
(issue of complexity)

A

Not all parts of a system scale at the same rate

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

Tradeoffs
(issue of complexity)

A

Sacrifice one thing for more of something else

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

What is a system?

A

A set of interconnected components that has an expected
behavior observed at the interface with its environment.

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

Signs of Complexity?

A
  1. Large number of components
  2. Large number of interconnections
  3. Lots of irregularities (little differences)
  4. Long description (high information content)
  5. Large team of designers, implementers, or maintainers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the sources of system complexity?

A
  1. Interactions of requirements
  2. Increasing efficiency, utilization, or other measure of “goodness”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Interactions of Requirements in terms of complexity?
(source of system complexity)

A

A general-purpose tool that can do X and other things is more complex than
a special-purpose tool that can only do X

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

Increasing efficiency, utilization, or “goodness” in terms of complexity?
(source of system complexity)

A

Additional gains in efficiency will lead to a more complex system

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

What increases complexity?

A
  1. Principle of escalating complexity
  2. Principle of excessive generality
  3. Law of Diminishing Returns
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Principle of escalating complexity?
(increases system complexity)

A

Adding a requirement increases complexity out of proportion

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

Principle of excessive generality?
(increases system complexity)

A

If it’s good for everything, it’s good for nothing (flying car)

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

Law of Diminishing Returns?
(increases system complexity)

A

The more one measure of goodness is improved, the harder it gets to make
the next improvement

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

Ways we can manage complexity?

A
  1. Modularity
  2. Abstraction
  3. Layering
  4. Hierarchy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Modularity

A

Break big things into smaller pieces (aka divide and conquer)

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

Abstraction

A

Break into components at logical points, Treat an individual component as a black box, Benefit from the Robustness principle

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

Layering

A

Build new layer from (already existing) lower layer, Layer may consist of multiple modules (components), Modules in a layer may only interact within the layer or up or down one layer

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

Hierarchy

A

Combine small groups of modules into small subsystems, Combine small subsystems into large subsystems, Combine large subsystems into systems, Limit the visibility of each level of abstraction hierarchy to limit
complexity

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

Robustness Principle

A

Be TOLERANT on inputs, be STRICT on outputs

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

Three main things a system does?

A

Store -> Memory
Compute -> Interpreter
Communicate -> Communication Channels

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

Volatile Memory/ Non-Volatile Memory

A

Volatile Memory is memory that only keeps data while it’s powered

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

Bandwidth (Memory Performance)

A

Units of memory/Units of time

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

Latency (Memory Performance)

A

How long does it take to get a single value from memory

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

What is more important? Low read latency? Low write latency? Why?

A

Read Latency, because we can make it asynchronous, writes are synchronous

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

Programs bound by synchronous writes operate at the speed of write ________.

a. latency
b. bandwidth
c. throughput

A

Write latency

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

Programs bound by asynchronous writes operate at the speed of write
_________.

a. latency
b. bandwidth
c. throughput

A

Write bandwidth

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

Read/Write Coherency

A

The result of a read is the same as the most recent write

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

Read/Write Atomicity

A

The result of a read is as
if the read occurred completely before or completely after every other write

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

What two functions does a communication link use?

A

SEND(link, message_buf)
RECEIVE(link, message_buf)

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

char *s = “abc”;
s = NULL;

what happens?

A

s becomes a null pointer

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

char s[10] = “abc”;
s = NULL;

what happens?

A

ERROR s is not an address

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

int main(void) {
char *s;

}

What is s initialized to?

A

It’s not initialized! Local variables aren’t initialized.

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

char *s;
int main(void) {

}

What is s initialized to?

A

It is initialized to NULL

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

int main(void) {
static char* s;

}

What is s initialized to?

A

It is initialized to NULL.

It has a GLOBAL storage, but LOCAL scope

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

open()

  1. header for function?
  2. header for flags?
  3. what arguments?
  4. success return value(s)?
  5. error return value(s)?
  6. Flag to read/write
  7. Flag to read
  8. Flag to write
  9. Flag to create file
  10. Flag to truncate file
A
  1. <unistd.h>
    </unistd.h>
  2. <fcntl.h>
    </fcntl.h>
  3. open(char* pathname, int flags, mode_t mode)
  4. Success: non-negative int
  5. Error: -1
  6. O_RDWR
  7. O_RDONLY
  8. O_WRONLY
  9. O_CREAT
  10. O_TRUNC
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

read()

  1. header for function?
  2. what arguments?
  3. success return value(s)?
  4. error return value(s)?
A
  1. <unistd.h>
    </unistd.h>
  2. read(int fd, void* buf, size_t n)
  3. Success: num bytes read, can be 0
  4. Error: -1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

write()

  1. header for function?
  2. what arguments?
  3. success return value(s)?
  4. error return value(s)?
A
  1. <unistd.h>
    </unistd.h>
  2. (int fd, void *buf, size_t n)
  3. Success: num bytes written, can be zero
  4. Error: -1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

creat()

  1. arguments
  2. success return values?
  3. error return values?
A
  1. creat(char* name, mode_t mode)
  2. Success: non-negative int
  3. Error: -1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

close()

  1. arguments
  2. success return values?
  3. error return values?
A
  1. close(int fd)
  2. Success: 0
  3. Error: -1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

unlink()

  1. arguments
  2. success return values?
  3. error return values?
A
  1. unlink(char *name)
  2. Success: 0
  3. Error: -1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

lseek()

  1. arguments
  2. success return values?
  3. error return values?
A
  1. lseek(int fd, off_t offset, int origin)
  2. Success: non-negative int
  3. Error: -1

origin:
- SEEK_SET means relative to beginning of file (offset ≥ 0)
- SEEK_CUR means relative to current position
- SEEK_END means relative to end of file (offset ≤ 0)

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

regcomp()

  1. arguments
  2. success return values?
  3. error return values?
A
  1. regcomp(regex_t preg, char regex, int cflags)
  2. Success: 0
  3. Error: error code use regerror() to convert

CFlags:
- REG_EXTENDED - use it
- REG_NEWLINE - [”^” -> “$”]

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

regfree()

  1. arguments
  2. success return value?
  3. error return value?
A
  1. regfree(regex_t *preg)
  2. Success: does not return
  3. Error: does not return
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

regexec()

  1. arguments
  2. success return value?
  3. error return value?
A
  1. regexec(regex_t preg, char string, size_t nmatch, regmatch_t pmatch[], int eflags)
  2. Success: 0
  3. Error: error code convert use regerror()
  • declare pmatch array with nmatch items
  • pmatch[0] always matches whole expression
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

regmatch_t struct

  1. beginning of match
  2. end of match
A
  1. rm_so
  2. rm_eo
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

printf(“%.10s”, string);

how many characters will this print

A

it will print NO MORE than 10 characters

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

max_width = 5;
printf(“%.*s”, max_width, string);

how many characters will this print?

A

it will print NO MORE than 5 characters

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

LAMP Web Server, what does LAMP stand for?

A

Linux
Apache
MySQL
PHP

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

Soft Modularity

A

Dividing code into named modules, functions etc., what we normally do when we code

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

Hard Modularity

A

Divide code and let them communicate only through messages. “Connected by a wire”

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

Marshaling

A

Essentially serialization, Ensuring that the client and server data have the same meaning

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

How does the interpreter(CPU) receive the next instruction, aka what does it access?

A

Instruction Reference

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

How does the interpreter(CPU) interpret an instruction, aka what does it access?

A

Instruction Repertoire and Environment Reference

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

What does the interpreter(CPU) change when it gets an interrupt signal?

A

Instruction Reference and Environment Reference

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

what gets printed out here?

printf(“%5s”, 123456789);

A

12345

57
Q

what gets printed out here?

printf(“%5s”, 123);

A

_ _ 123

_ = space

58
Q

Multiplexing

A

Create multiple virtual objects from one underlying object

59
Q

Aggregation

A

Create one virtual object from multiple underlying objects

60
Q

Emulation

A

Create new type of object from underlying objects

61
Q

Race Condition

A

Behavior of System depends on the timing or order of uncontrollable events, situation where two interacting events occur at the same time

62
Q

Atomicity Violation

A

When an operation should be atomic but it is not

63
Q

Data Race

A

When two unordered memory operations (one of which is a write) act on the same variable

64
Q

What are the conditions of Mutual Exclusion

A
  1. No two threads may be in their Critical Regions simultaneously
  2. Any number of threads
  3. Thread running outside Critical Region cannot block another thread
  4. Thread cannot wait forever to enter Critical Region
65
Q

pthread_mutex_init()

  1. arguments
  2. success return value?
  3. error return value?
A

1.pthread_mutex_init (pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
2. Success: 0
3. Error: error code

  • set attr to NULL to use default attr
66
Q

pthread_mutex_lock()

  1. arguments
  2. success return value?
  3. error return value?
A
  1. pthread_mutex_lock (pthread_mutex_t *mutex)
  2. Success: 0
  3. Error: error code
67
Q

pthread_mutex_unlock()

  1. arguments
  2. success return value?
  3. error return value?
A
  1. pthread_mutex_unlock (pthread_mutex_t *mutex)
  2. Success: 0
  3. Error: error code
68
Q

pthread_mutex_destroy()

  1. arguments
  2. success return value?
  3. error return value?
A
  1. pthread_mutex_destroy (pthread_mutex_t *mutex)
  2. Success: 0
  3. Error: error code
69
Q

pthread_cond_wait()

  1. arguments
  2. success return value?
  3. error return value?
A
  1. pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
  2. Success: 0
  3. Error: error code
70
Q

pthread_cond_signal()

  1. arguments
  2. success return value?
  3. error return value?
A
  1. pthread_cond_signal (pthread_cond_t *cond)
  2. Success: 0
  3. Error: error code
71
Q

pthread_cond_broadcast()

  1. arguments
  2. success return value?
  3. error return value?
A
  1. pthread_cond_broadcast (pthread_cond_t *cond)
  2. Success: 0
  3. Error: error code
72
Q

sem_init()

  1. arguments?
  2. success return value?
  3. error return value?
A
  1. sem_init (sem_t *sem, int pshared, unsigned value)
  2. Success: 0
  3. Error: -1
73
Q

pthread_cond_init()

  1. arguments?
  2. success return value?
  3. error return value?
A
  1. pthread_cond_init (pthread_cond_t *cond, pthread_condattr_t *attr)
  2. Success: 0
  3. Error: error code
74
Q

sem_wait()

  1. arguments?
  2. success return value?
  3. error return value?
A
  1. sem_wait(sem_t *sem)
  2. Success: 0
  3. Error: -1
75
Q

sem_post()

  1. arguments?
  2. success return value?
  3. error return value?
A
  1. sem_post(sem_t *sem)
  2. Success: 0
  3. Error: -1
76
Q

sem_destroy()

  1. arguments?
  2. success return value?
  3. error return value?
A
  1. sem_destroy(sem_t *sem)
  2. Success: 0
  3. Error: -1
77
Q

pthread_create()

  1. arguments?
  2. success return value?
  3. error return value?
A
  1. pthread_create (pthread_t thread, pthread_attr_t attr, void func, void arg)
  2. Success: 0
  3. Error: error code
  • set attr_t to NULL to get default attributes
78
Q

pthread_join()

  1. arguments?
  2. success return value?
  3. error return value?
A
  1. pthread_join(pthread_t thread, void value_ptr**)
  2. Success: 0
  3. Error: -1
79
Q

Preemptable Resource/Nonpreemtable resource

A

Preemptable resource is a resource that can be taken away from a process with no ill effects.

80
Q

Infeasible Region

A

When path inside infeasible region it means two tasks have resource simultaneously

81
Q

Unsafe Region

A

If two tasks reach unsafe region there is no way out tasks must end, will get “Cycle of Waiting”. Irreversibility of progress guarantees deadlock

82
Q

Conditions for an Unsafe Region

A
  1. Tasks both claim Mutual Exclusion
  2. Nonpreemption for both tasks
  3. Both tasks are in a state of “Hold and Wait”
83
Q

Conditions for Deadlock

A
  1. Tasks both claim Mutual Exclusion
  2. Nonpreemption for both tasks
  3. Both tasks are in a state of “Hold and Wait”
  4. “Cycle of Waiting”

Basically conditions for unsafe region + “Cycle of Waiting”

84
Q

In a resource and task graph how can we identify a deadlock?

A

With a cycle

85
Q

Ostrich Algorithm

A

Pretend there is no problem, reasonable if deadlock occurs rarely or/and cost of prevention high

86
Q

How can we eliminate Mutual Exclusion during deadlock

A

Spooling, Avoid assigning resource when not absolutely necessary, As few processes as possible actually claim the resource

87
Q

How can we eliminate Hold and Wait during deadlock

A

Require processes to request resources before starting

Variation: a process must give up all resources before making a new
request

88
Q

Livelock

A

processes can still run, but not make progress

P0 gets A, P1 gets B
P0 drops A, P1 drops B
P0 gets B, P1 gets A

89
Q

deci

A

10^-1

90
Q

deka

A

10^1

91
Q

hecto

A

10^2

92
Q

centi

A

10^-2

93
Q

milli

A

10^-3

94
Q

kilo

A

10^3

95
Q

Mega

A

10^6

96
Q

micro

A

10^-6

97
Q

Giga

A

10^9

98
Q

nano

A

10^-9

99
Q

In a resource allocation graph:

  1. what shape is around resources?
  2. what shape is around tasks?
  3. what does it mean when an arrow points from resource -> task?
  4. what does it mean when an arrow points from task -> resource?
A
  1. Square
  2. Circle
  3. task HOLDS resource
  4. task WANTS resource
100
Q

Strict Alternation

A

TWO threads take turns executing use a shared variable called turn

101
Q

Dekker’s Algorithm

A

Basically like Strict Alternation, but thread has to proclaim interest

102
Q

Lamport’s Bakery

A

Each task takes a unique number in increasing order, and executes their Critical Section, then give up their number. If two tasks attempt to grab same number break tie with task ID

103
Q

getopt()

  1. arguments
  2. success return value?
  3. error return value?
A
  1. getopt(int argc, char **argv, char *opstring)
  2. Success: option character or -1
  3. Error: ? or :
104
Q

Techniques for improving performance

A
  1. Pipelining
  2. Concurrency
  3. Fast Path
  4. Limitations
105
Q

Latency_a+b ? latency a + latency b

in a pipelined system?

A

latency_a+b >= latency_a + latency_b

106
Q

throughput_a+b = ?(throughput_a, throughput_b)

in a pipelined system?

A

throughput_a+b = min(throughput_a, throughput_b)

107
Q

Concurrency in terms of Performance

A

Running independent subtasks in parallel, improves throughput

108
Q

Formula for Average Latency with a slow path and a fast path

A

Average Latency = fraction_fast path * latency_fast path + fraction_slow_path * latency_slow path

109
Q

In a single module what’s the relation between latency and throughput?

A

Latency = 1/throughput

110
Q

Total throughput of n CONCURRENT, IDENTICAL modules

A

n * throughput_individual module

111
Q

Batching to deal with bottlenecks

A

Group requests as a group and process them as a single unit

112
Q

Dallying to deal with bottlenecks

A

Delay unit hopefully will not be needed or will be batched

113
Q

Speculation to deal with bottlenecks

A

Read next data early

114
Q

Burts and Overload

A

If sudden burst of requests and pipeline not properly equipped it might be overloaded

115
Q

How to design system for performance

A
  1. Measure the system to see if it is needs to be faster
  2. Measure again to find the bottleneck
  3. Predict the impact of removing bottleneck
    3.a.Removing the bottleneck doesn’t help performance: reconsider design?
    3.b.Removing the bottleneck will help: find ways to remove it
  4. Implement new solution and repeat
116
Q

Workload

A

the tasks (requests) processed by a system

117
Q

Benchmarks

A

Create a “synthetic” workload based on characteristics observed in real ones, may use some randomness

118
Q

Caching

A

remembering expensive computations in case they are
needed again

119
Q

Working set

A

the set of items used during interval Δt

120
Q

Locality Of Reference

A

clustering of memory references in both time and address space

121
Q

What if working set < primary storage?

A

Nothing, that’s a good thing!

122
Q

What if working set > primary storage?

A

BAD, thrashing = overwriting of primary storage

123
Q

Temporal Locality

A

Recent items are likely to be referenced again soon

124
Q

Spatial Locality

A

Items “near” recently items are likely to be referenced

125
Q

Write-Back

A

Write to cached data only

126
Q

Write-Through

A

Write to both cached data and back-end data

127
Q

Fully Associative

A

each item can be stored anywhere

128
Q

Direct-Mapped Associative

A

each item can be stored in only one location

129
Q

N-Way Associative

A

each item can be stored in n locations

130
Q

Mechanism

A

The algorithms and structures used

131
Q

Policy

A

The decision of what action to perform

132
Q

What are the page replacement policies?

A
  1. LRU
  2. FIFO
  3. Second Chance
  4. Clock
133
Q

Not recently used + Dirty bit classes:

0 ___ referenced, ____ dirty
1 ___ referenced, ____ dirty
2 ___ referenced, ____ dirty
3 ___ referenced, ____ dirty

A

0: not referenced, not dirty
1: not referenced, dirty
2: referenced, not dirty
3: referenced, dirty

134
Q

Reference String

A

set of accesses made to system

135
Q

Belady’s Anomaly (kinda cool)

A

Adding more memory can increase amount of page faults in FIFO page replacement

136
Q

Kerchoff’s Doctrine

A

The security of a system should depend on its key, not on its design remaining obscure

137
Q

Assumptions in single-node system attacker can:

A
  1. Observe the timing of actions
  2. Observe the inputs/outputs of the system
  3. Control the inputs to the system
138
Q

Assumptions in multi-node system attacker can:

A
  1. Observe messages sent between nodes
  2. Drop messages sent between nodes
  3. Change messages sent between nodes
139
Q

Types of Security Vulnerabilities

A
  1. Corner-case Bugs
  2. Unsanitized-input Bugs
  3. Side-channel Bugs
  4. Dependency Vulnerabilities