1/117
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Virtual addresses and physical addresses might be different addressses, but are in the same address space.
False
A processor may have as few as one atomic instruction.
True
Which stages of the toolchain know about the C programming language?
Compiler
The key concept in the effectiveness of caching is _________.
Locality
What are the three types of cache miss?
1) Conflict
2) Cold
3) Capacity
Calling functions can prevent certain optimizations.
True
A single process can contain multiple threads.
True
The wait operation on a condition variable should always be called in a loop that checks the condition.
True
Which stage of the toolchain allows you to eliminate code entirely based on conditions?
Preprocessor
The ______ function creates a POSIX thread. (Name only)
pthread_create
Course evaluations are open, and I should provide honest feedback on my course evaluation to help improve CSE 220 and provide the information needed to secure necessary resources and make curricular changes to improve the value of my UB degree.
True
Exceptions provide a safe way to change protection domains in an operating system.
True
One of the ways that paging is efficient is that it prevents ________ fragmentation entirely in the memory mapping.
External
The kernel does not operate under the same dedicated machine model as our processes because it runs in _____________. (Two words)
Supervisor mode
Layers in the cache hierarchy that are closer to the CPU are ____________ than layers that are farther from the CPU.
Smaller and faster
Linear address spaces are convenient because:
1) Each location in the address space has a unique address.
2) Each address represents a unique location in the address space.
In the following code, in which section is the variable x located?
int x = 42;
int main(int argc, char *argv[]) {
printf("%d\n", x);
return 0;
}
Data section
What is a logical control flow?
The instructions run by a processor while running a program
The Memory Management Unit (MMU) is _______ that _______.
A) Hardware
B) Translates addresses
Memory used by the allocator that is not used directly to serve user allocation is called _____________.
overhead
A system can use either multithreading or multiprocessing, but not both.
False
Mutexes and mutual exclusion map almost directly to the race condition-related concept of the _________________
Critical sections
The addresses near 0 in the system are ______ so that NULL is an invalid address.
unmapped
Optimizing sequential computations may involve both code motion and reduction in strength.
True
Every address on a single virtual page must map to the same physical page.
True
Paper was once used as nonvolatile storage for computers.
True
The C preprocessor knows about the platform it is compiling for.
False
Processes cannot detect segmentation faults and react to them, instead of crashing and leaving a core dump.
False
How many conditions must be met in order to have a race?
3
A data race can be present in as little as a single line of code.
True
Which sections have a size that can be determined only when the program runs?
1) Heap
2) Stack
When using semaphores, the states 0 and 1 are always equivalent to a locked and unlocked mutex, respectively.
False
Suppose that a compiler turns this code:
int sum = 0;
for (int i = 0; i < MAXI; i++) {
for (int j = 0; j < MAXJ; j++) {
sum += 4 * i + j;
}
}
Into this code:
int sum = 0;
for (int i = 0; i < MAXI; i++) {
const int fouri = 4 * i;
for (int j = 0; j < MAXJ; j++) {
sum += fouri + j;
}
}
What type of optimization is this?
Code Motion
System calls are typically invoked as:
A normal function call that uses a special processor instruction
Which of the following is a well-defined term?
1) CPU Core
2) Logical control flow
The C compiler is limited to optimizations that can be deduced from the source code of the program.
True
The operating system provides an allocation interface to manage small allocations.
True
The size of a memory allocation created by malloc() is visible to the user.
False
What is the primary difference between threads and processes from a software design standpoint?
Threads share a common memory mapping.
The MMU on an x86-64 processor uses _____ to translate virtual addresses to physical addresses. (One word)
paging
Wasted memory in the allocator often comes from:
1) Metadata
2) Fragmentation
Which property is the most important for an optimizing compiler?
Correct program behavior
If a program has a large working set, but accesses it sequentially, it will still exhibit good locality.
True
The name of the "fastmutex" variable in the slides is copied from __________.
man pthread_mutex_init
What mechanism allows function arguments to be call-by-value?
Stack allocated arguments
Every process on a Unix system appears to run on a dedicated computer from its own point of view.
True
When using a condition variable, only the waiting thread must call pthread_mutex_lock and pthread_mutex_unlock. The signaling thread does not need to use a mutex.
False
Given the following declarations, which of these statements are valid?
- struct p { int x; int y };
- int a1[5] = { 1, 2, 3, 4, 5 };
- int a2[5];
- struct p p1 = { 42, 73 };
- struct p p2
p2 = p1;
For this course, you must learn the following regarding assembly language: (mark all that apply)
1) the basic kinds of things that machine instructions can do
2) how to understand assembly programs while I am explaining it
In the following code, the final expression is always true:
bool b = 2;
b == 1;
True
When is it best to fix a system bug?
During system design
When compiling a conditional, the compiler will preserve: (mark all that apply)
- The names of your variables
- The semantics of your program (that is, its meaning)
- The structure of your program
The semantics of your program (that is, its meaning)
In which incidents did people die partly due to computer programmers copying code that they did not fully understand, but thought they did?
- Therac-25
- Mars Pathfinder scheduling
- Toyota unintended acceleration
1) Toyota unintended acceleration
2) Therac-25
You should always use curly braces for if/else/while/etc. in this course.
True
What is the decimal value of the following 8-bit binary number:
0101 1110
94
Computer systems perfectly implement the numeric and boolean systems we want to use.
False
Which of the following 16-bit integers in binary form is a little endian representation of the decimal number 258?
- 10000000 01000000
- 00000010 00000001
- 00000001 00000010
- 01000000 100000000
00000010 00000001
Which of the following would be the IEEE 754 single-precision representation of the binary number 11.01011?
- 1 10101100 00000000000000000000000
- 0 10000000 10101100000000000000000
- 0 00000000 11010110000000000000000
- 0 00000001 10101100000000000000000
0 10000000 10101100000000000000000
0 - Sign bit
10000000 = 1 (expononent) + 127 (bias) = 128
10101100000000000000000 = 11.01011
What file must be included in order to define the type bool and the true and false values?
stdbool.h
Which of the following hexadecimal digits are even?
- 3
- 4
- C
- D
1) 4
2) C
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
Where might you see one's complement math in 2020?
Network packets
If IEEE 754 floating point represents numbers of the following form:
x * 2^y
How many times larger is the largest possible exponent in double-precision floating point versus single-precision floating point? (Note that this question requires understanding the properties of both floating point and integer binary representations!)
8
How wide is the memory bus on our x86-64 system?
64 bits
Order of operations in a program can change program performance by an order of magnitude or more, due to the way memory is accessed.
True
Which of the following bit patterns (represented in hexadecimal) would be negative if they were 32-bit signed integers?
- 0x7B90FF62
- 0x83B96F60
- 0x32109876
- 0xFFFFFFFF
1) 0x83B96F60
2) 0xFFFFFFFF
Leading Value:
0 - 7 = Position
8- F = Negative
Why are structures and array elements padded?
To preserve alignment of the individual members
A pointer is an integer value that contains the address of some data and associates it with a type.
True
Given the following code:
int x = 13;
int *px = &x;
What type is the result of the expression *px?
int
A pointer can be dereferenced with square brackets in the same manner as an array, and with the same result.
True
Pointers and arrays are always interchangeable.
False
Serialization allows us to store data in memory or on disk, or communicate it over a network, without having to follow all of the alignment and representation rules of the platform on which our code is executing.
True
What representation does IEEE 754 floating point use to store negative floating point values?
Sign-magnitude
What is the C compiler driver
The C compiler driver can take a .c source file and produce an executable directly.
What are the 4 parts of the C compiler and toolchain?
Preprocessor, compiler, assembler, linker
What is the preprocessor
- The preprocessor performs certain source code transformations before the C is processed by the compiler.
- It DOESN'T understand C
What is the C compiler?
- The compiler transforms C into machine-dependent assembly code
- It produces and object file via the assembler
- Only part of the tool chain that understands C. Understands the semantics of C and the capabilities of the machine.
What is the assembler?
- The assembler transforms assembly language into machine code.
- Machine code is binary instructions understood by the processor.
- The output of the assembler is object files
What is the linker?
- The linker turns one or more object files into an executable.
What is code folding?
Computation of constants at compile time
- int i = 2 + 3
('i' will never be anything else besides 5)
What is code motion?
The movement of code to minimize redundant operations or calculations.
What is reduction in strength?
Replacement of expensive operations with cheaper operations.
E.x: Multiply and divide are expensive operations, but shift operations are cheap.
What can block optimizations?
1) Data-dependent operations
2) Procedure calls (without inter-procedural optimization)
2) Pointer aliases (more than one pointer to an object)
What is 11.101b in decimal?
3.625
= (1 x 2^1) + (1 x 2^0) + (1 x 2^-1) + (0 x 2^-2) + (1 x 2^-3)
= 2 + 1 + 0.5 + 0 + 0.125
= 3.625
For SINGLE precision floating point numbers:
How many sign bits are there?
How many exponent bits are there?
How many significand bits are there?
Sign - 1
Exponent - 8
Significand - 23
For DOUBLE precision floating point numbers:
How many sign bits are there?
How many exponent bits are there?
How many significand bits are there?
Sign - 1
Exponent - 11
Significand - 52
What does the Text section of memory hold?
The text section is:
The executable code.
What do the Data and BSS sections for memory hold?
The data and BSS (block started by symbol) sections are:
- Global and static local variables
- Variables in the data section have initialized values in the source code.
- Variables in the BSS do not.
What is the width of a register on x86-64?
64 bits
An un-aligned memory access may crash your program.
True
What type of race involves two concurrent flows of control accessing the same state with insufficient synchronization?
data race
Given a pointer to an area of memory allocated with malloc, it is possible for the programmer to tell how large it is.
False
Which of these is very similar to a mutex?
a. condition variable
b. atomic operation
c. binary semaphore
d. counting semaphore
binary semaphore
The data section is cleared to all zero bits when your program starts.
False
Which of these makes sequential array accesses much faster than "jumping around"?
a. caching
b. virtual memory
c. alignment
d. synchronization
Caching
An exception involves non-local control flow.
True
Printing output to the terminal MUST use a system call.
True
Which stage of the compiler toolchain understands the C language?
a. preprocessor
b. compiler
c. assembler
d. linker
Compiler
Changing only the sign bit on a two's complement integer also changes both the sign and the magnitude of its value.
True
Which storage technology is slowest?
a. registers
b. sram
c. dram
DRAM
Three conditions are required to have a race. How many must be broken to eliminate the race?
1