Professional Documents
Culture Documents
CSE410 Autumn 2000 Final Exam Solutions: MULTIPLE CHOICE (2 Points Each)
CSE410 Autumn 2000 Final Exam Solutions: MULTIPLE CHOICE (2 Points Each)
Questions 1-20 are multiple choice. For these questions, choose the one best answer.
1. Which of the following is the reason that the least recently used (LRU) algorithm is usually
not used as a page replacement algorithm?
A. Other practical schemes such as MIN do a better job.
B. LRU requires knowledge of the future to work correctly.
C. LRU is too inefficient to implement in practice.
D. The Clock algorithm always outperforms LRU.
2. Which of the following are shared between threads in the same process?
A. registers
B. page table
C. stack
D. stack pointer
E. None of these are shared
5. If a process has allocated every 1024th virtual page (e.g. it has allocated virtual pages 0, 1024,
2048, 3072, 4096, 5120 ... 1024000), which one of the following page table schemes will use the
LEAST amount of memory?
A. A flat page table
B. A two-level page table with 1024 first level entries
C. A two-level page table with 2048 first level entries
D. An inverted page table
E. Each of the above page table will use exactly the same amount of memory
1
6. Making no assumptions about the processes being scheduled, which of these scheduling
algorithms will prevent starvation?
I. First Come First Served (doesn’t work if a job runs forever—infinite loop)
II. Round Robin
III. Priority
A. I
B. II
C. I & III
D. I, II, & III
7. Consider a group of RAID4 disks. This group has four data disks and one parity disk. Which
of the following are true?
I. Any data disk but NOT the parity disk can be reconstructed from the other four
II. The parity disk must be read whenever one of the data disks is read
III. The parity disk must be written whenever one of the data disks is written
A. III
B. I & III
C. II & III
D. I, II, & III
E. None of the above
8. Which of the following is true about two threads running in the same process?
A. One thread can both read and write another thread's registers
B. One thread can change the other thread's program counter
C. One thread can neither read nor write the other thread's stack
D. One thread can both read and write the other thread's stack (there is no
address space protection between threads in the same process)
9.Which disk block allocation scheme will require the most I/O operations for random access to
a large file?
A. Indexed allocation
B. Linked allocation
C. Contiguous allocation
D. I-node allocation
E. Each scheme requires approximately the same number of I/O operations
2
11. What is the primary reason that a translation lookaside buffer (TLB) is used?
A. A TLB ensures that a process does not access memory outside of its address
space
B. A TLB makes translating virtual addresses to physical addresses faster
C. A TLB allows multiple processes to share the L1 cache
D. A TLB makes translating virtual addresses to physical addresses possible
E. None of the above
13. Which of the following is NOT a way to make file systems faster?
A. Put parts of a file on many different tracks so part of it can be accessed no
matter where the disk head is
B. Cache frequently used blocks in memory so they can be accessed at memory
speeds instead of disk speeds
C. Use a disk scheduling algorithm to minimize the distance between seeks
D. Put frequently used files or directories near the center of the disk so on average
they won't be far from the read head
E. All of these will make a file system faster
14. Which of the following is true about base and bounds registers?
I. They offer protection between processes
II. They lead to internal fragmentation of physical memory
III. Once a process has been started at a given memory location, it cannot be
moved to another location
A. I
B. II
C. I & II
D. I, II, & III
E. None of the above
15. Which of the following can I do without knowing your private key?
A. Pretend to send a private message on your behalf
B. Decrypt messages that were intended for only you
C. Send you a message that only you can read
D. Digitally sign a message on your behalf
E. I must know your private key to perform all of these operations
3
16. Public/private key encryption is usually avoided because
A. It is much slower than symmetric key encryption
B. It is only useful when encrypting large amounts of data
C. It is not as secure as symmetric key encryption
D. It cannot be used unless two parties can exchange their private keys securely
E. None of the above
Suppose a system has only three physical pages. Given the following sequence of virtual page
references, determine the number of page faults that are required. Initially, assume that the
physical pages are not being used by any virtual page.
121132143112415621
4
SHORT ANSWER
None of these questions requires a long answer. Some require an answer of only a few
words. Others may require up to a few sentences. The amount of space left to answer the
question is not indicative of how long your answer should be. Your answers should be
specific.
21. Earlier in the quarter, we used the following equation to calculate the average memory access
time:
In this equation, either an L1 cache miss or an L2 cache miss can lead to an increased memory
access time.
When processes use virtual addresses (i.e. processes do not refer to memory using
actual physical addresses), what additional event can increase the average
memory access time? Be specific. (3 points)
TLB miss
When using virtual memory (i.e. infrequently used portions of memory are moved
to the page file), what additional event can increase the average memory access
time? Be specific. (3 points)
Page fault
22. Consider a process that has two threads. One thread puts items on the tail of a queue, and the
other thread removes items from the head of the queue. Britney argues that you don't need
synchronization because the two threads are accessing separate ends of the queue. Her friend,
Christina disagrees. Who is right? Briefly explain you answer. (7 points)
Christina is right. Consider the case that the queue has only zero or one elements. Both
threads might be accessing the same element.
5
23. Assume two threads are executing the following code segment simultaneously. Can there be
deadlock? Why or why not? (6 points)
Lock1->Acquire();
...
Lock2->Acquire();
...
Lock1->Release();
...
Lock2->Release();
24. With a 2GByte disk, Microsoft's FAT16 file system uses disk blocks that are 64Kbytes. With
the same disk, their FAT32 file system uses disk blocks that are 4KBytes.
There is less internal fragmentation than with 64Kbyte blocks. That is, not as much space
is wasted for each file.
25. In the Internet, why is public/private key cryptography typically used instead of symmetric
key cryptography? (5 points)
If symmetric key encryption was used, then the two parties must exchange the symmetric
key secretly, which is usually impossible. Public/private key encryption does not require a
secret to be transferred between the two parties in order for them to communicate
securely.
6
26. Below is an implementation of a BankAccount class. (8 points)
class BankAccount {
private:
double balance;
Mutex mutex;
public:
BankAccount() {
balance = 0.0;
double GetBalance() {
return balance;
mutex.acquire();
balance = newBalance;
mutex.release();
mutex.acquire();
balance = newBalance;
mutex.release();
};
7
(Ignore the possibility that amount could be negative or that amount withdrawn could be greater
than the balance.)
Assume that multiple threads could access a member of the BankAccount class at the same
time. Assume a bank account’s balance is $100. If one thread calls bankAccount->
DepositMoney(50.0) and one thread calls bankAccount->WithdrawMoney(75.0),
what are all of the possible values for balance that could result after both of these threads
execute?
Now add synchronization to this class so that the balance that is stored is always correct. You
may change or add lines to the provided implementation. You may also rewrite the entire class
definition if you desire. You are not required to know the exact syntax for whatever
synchronization primitive you choose to use.
(see code)