CMU Final 2012 Flashcards
Each thread has its own:
(a)Heap
(b) Stack
(c)Global values
(d) Textdata
b. Stack
Simply decreasing the size of block headers used internally by malloc:
(a)Decreases internal fragmentation
(b) Increases internal fragmentation
(c)Decreases external fragmentation
(d) Increases external fragmentation
(a) Decreases internal fragmentation
Which of the following sentences about reader-writer locks is not true?
(a)Many readers can hold the same rwlock at the same time
(b)Two writers cannot hold the same rwlock at the same time
(c)Many readers and exactly one writer can hold the same rwlock at the same time
(d)An rwlock can be used as a mutex
(c) Many readers and exactly one writer can hold the same rwlock at the same time
Which of the following is the correct ordering (left-to-right) of a file’s compilation cycle (a file name
with no extension is an executable):
(a) foo.c→foo.o→foo.s→foo
(b) foo→foo.s→foo.o→foo.c
(c) foo.c→foo.s→foo→foo.o
(d) foo.c→foo.s→foo.o→foo
d) foo.c→foo.s→foo.o→foo
Suppose an int A is stored at virtual address 0xff987cf0, while another int B is stored at virtual address 0xff987d98. If the size of a page is 0x1000 bytes,
then A’s physical address is
numerically less than B’s physical address.
(a)Always true
(b)Always false
(c) Sometimes true, sometimes false (d)Not enough information
(a)Always true
Assuming no errors, which one of the following functions returns exactly once?
(a) fork()
(b) execve()
(c) exit()
(d) longjmp()
(e) waitpid()
(e) waitpid()
On a 64-bit system, which of the following C expressions is equivalent to the C expression (x[2]+4)[3]? Assume x is declared as int **x.
(a) (((x+16))+28)
(b) (((x+2))+7)
(c) (x+28)
(d) (((x)+2)+7)
(e) ((x+2)+7)
(b) (((x+2))+7)
When can short counts occur?
(a)When an EOF is encountered during a read
(b)When a short int is used as a counter (c)When reading or writing to disk files (d)When the kernel runs out of kernel memory
(a) When an EOF is encountered during a read
A program blocks SIGCHLD and SIGUSR1. It is then sent a SIGCHLD, a SIGUSR1, and another SIGCHLD, in that order. What signals does the program receive after it unblocks both of those signals (you may assume the program does not receive any more signals after)?
(a) None, since the signals were blocked they are all discarded.
(b) Just a single SIGCHLD, since all subsequent signals are discarded.
(c) Just a single SIGCHLD and a single SIGUSR1, since the extra SIGCHLD is discarded.
(d) All 3 signals, since no signals are discarded.
(c) Just a single SIGCHLD and a single SIGUSR1, since the extra SIGCHLD is discarded.
Which of the following events does not generate a signal?
(a)Division by zero
(b)A new connection arrives on a listening socket
(c) A write is attempted on a disconnected socket
(d)NULL is dereferenced
(e)A process whose parent has already terminated exits
(b)A new connection arrives on a listening socket
In an x86-64 system, how many integers can be stored in a cache line if your cache is 4KB, is 4-way set-associative and contains 4 sets?
(a) 8
(b) 16
(c) 32
(d) 64
(e) 128
(d) 64
Which types of locality are leveraged by virtual memory?
(a) Spatial locality
(b) Temporal locality
(c) Prime locality
(d)Both (a) and (b)
(e)Both (b) and (c)
(d)Both (a) and (b)
Which of the following is not a section of an ELF file?
(a) .text
(b) .static
(c) .rodata
(d) .data
(e) .bss
(b) .static
Choose the true statement.
(a)All thread-safe functions are reentrant.
(b) Some reentrant functions are not thread-safe.
(c) It is never a good idea to use a persistent state across multiple function calls.
(d) It is impossible to have a race condition between two threads as long as they have no shared state.
(e) All functions which call non-thread-safe functions are themselves not thread safe.
(d) It is impossible to have a race condition between two threads as long as they have no shared state.
We use dynamic memory because:
(a) The heap is significantly faster than the stack.
(b) The stack is prone to corruption from buffer overflows.
(c) Storing data on the stack requires knowing the size of that data at compile time.
(d)None of the above.
(c) Storing data on the stack requires knowing the size of that data at compile time.