Operating Systems Final Review
Consider a logical (virtual) address space of 32 pages with 1024 bytes per page; mapped onto a physical memory of 16 frames. How many total bits are required for the logical address?
- 1024 bytes = 2^10 bytes - 10 bits are needed for the page offset - 32 = 2^5 pages - therefore, 5 bits are needed for the virtual page number - 10 + 5 = 15 15 bits for the virtual address
Assume there are three resources, R1, R2, and R3, that are each assigned unique integer values 15, 10, and 25 respectively. What is a resource ordering which prevents a circular wait? Choose all that apply. A. R1, R2, R3 B. R3, R2, R1 C. R3, R1, R2 D. R2, R1, R3
- R3, R1, R2 - R2, R1, R3
Consider a logical (virtual) address space of 32 pages with 1024 bytes per page; mapped onto a physical memory of 16 frames. How many total bits are required for the physical address?
- from part a) we need 10 bits for the page offset - 16 = 2^4 physical page frames - therefore 4 bits are needed for the frame number - 10 + 4 = 14 14 bits for the physical address
What is the order of the memory layers in order from slowest to fastest? - cache - magnetic tape - main memory - magnetic disk - registers
1. magnetic tape 2. magnetic disk 3. main memory 4. cache 5. registers
Given the following reference string of pages required for a process. The number of page frames allocated the processes at a time is 4. Using the LRU page replacement algorithm, determine how many page faults occur. Count initial loads (cold start loads) as page faults. 1 2 4 3 7 1 3 4 5 7 2 3 4 6
12
How many philosophers may eat simultaneously in the Dining Philosophers problem with 5 philosophers as described in your textbook?
2
Given the following reference string of pages required for a process. The number of page frames allocated the processes at a time is 3. Using the FIFO page replacement algorithm, determine how many page faults occur. Count initial loads (cold start loads) as page faults. 0 2 1 3 4 3 2 1
7
A condition variable in a monitor is associated with ..... A. an integer variable, which is initially zero B. a binary semaphore, which is initially zero C. a queue, which is initially empty D. a boolean variable, which is initially false
A queue, which is initially empty
When we discover that a particular page replacement algorithm causes more page faults with 4 page frames than with 3 page frames, this phenomenon is known as: A. Belady's anomaly B. the Stack anomaly C. the Working Set anomaly D. LRU anomaly E. none of these
Belady's anomaly
Requiring a process to request resources is a pre-specified order (resource ordering) is for the purpose of avoiding... A. two-phased locking B. mutual exclusion C. preemption D. circular wait E. none of these
Circular wait
A ___________________ saves the state of the currently running process and restores the state of the next process to run. A. save-and-restore B. state switch C. context switch D. none of the above
Context switch
The _______ refers to the number of process in memory. A. process count B. long-term scheduler C. degree of multiprogramming D. CPU scheduler
Degree of multiprogramming
The round-robin scheduling policy: A. responds poorly to short processes if the time slice is small B. does not use any a priori information about the service times of processes C. becomes equivalent to SJF policy when the time slice is made infinitely large D. ensures that the ready queue is always the same size
Does not use any priori information about the service times of processes
Which of the following is true of multilevel queue scheduling? A. processes can move between queues B. each queue has its own scheduling algorithm C. a queue cannot have absolute priority over lower-priority queues D. it is the most general CPU scheduling algorithm
Each queue has its own scheduling algorithm
One solution to the Dining Philosophers problem which avoids deadlock is: A. Non-preemptive scheduling B. Ensuring that all philosophers pick up their left fork before they pick up their right fork C. Ensuring that all philosophers pick up their right fork before they pick up their left fork D. Ensuring that odd philosophers pick up their left fork before they pick up their right fork and even philosophers pick up their right fork before they pick up their left fork."
Ensuring that odd philosophers pick up their left fork before they pick up their right fork and even philosophers pick up their right fork before they pick up their left fork.
Disk scheduling involves: A. Allocating disk space to users in a fair manner B. Validating the file control information stored in the file C. Examining pending disk requests to determine the most efficient way to service the requests D. Reorganizing disk requests to maximize seek time."
Examining pending disk requests to determine the most efficient way to service the requests
Which of the following scheduling algorithms must be nonpreemptive? A. SJF B. RR C. FCFS D. priority algorithms
FCFS
Which of the following scheduling algorithms must be non-preemptive? A. SJF B. RR C. FCFS D. priority algorithms
FCFS (first come, first serve)
True/False: A system in an unsafe state will ultimately deadlock.
False
True/False: In RR scheduling, the time quantum should be small with respect to the context-switch time.
False
True/False: One cause of thrashing is the low degree of multiprogramming, that is, not having enough jobs in a system to keep CPU busy
False
True/False: a deadlock-free solution eliminates the possibility of starvation
False
True/False: The rate of page faults in a virtual memory system can always be reduced by adding more memory
False. Belady's anomaly for FIFO page replacement shows that increasing physical memory frames might cause the page fault rate to go up
True/False: Threads within the same process share the same heap and stack.
False. Each thread must have its own stack
True/False: The Nachos operating system uses Mesa-style condition variables for all synchronization.
False. Nachos uses semaphors and interrupt enable/disable for some things
True/False: All Page Table entries will be invalid directly after a context switch between processes
False. Only pages that should've been invalidated are those that were evicted while another process was running
True/False: Each physical page belongs to only one process
False. Pages can be shared between processes
True/False: When designing a multithreaded application, you must use synchronization primitives to make sure that the threads do not overwrite each other's registers. Explain your answer.
False. Registers are part of the state of computation that is private to each thread. There is no danger of a register content being overwritten by another thread
True/False: Seek time is the time for a disk to rotate to the beginning of the desired sector (or block)
False. Seek time is the time to position the read/write head over the correct track
True/False: The number of page frames needed for a virtual page depends on the amount of physical memory allocated to a process which owns the page
False. The number of page frames for a virtual page is 1 irrespective of the size of the process
The significant drawback of contiguous disk space allocation include.... A. fragmentation B. disk wear C. random access is slow D. all of these E. none of these
Fragmentation
It is advantageous for the page size to be small because: A. less unreferenced data will be loaded into memory B. virtual addresses will be smaller C. page tables will be smaller D. large programs can be run
Less unreferenced data will be loaded into memory
The basic principle of a monitor is that: A. several resources can only be controlled by a monitor B. several processes may concurrently execute a procedure of a given monitor C. only one process may execute a procedure of a given monitor at any given time D. it schedules the execution of processes in a multiprocessor operating system
Only one process may execute a procedure of a given monitor at any given time
Which is the best possible page replacement algorithm but is impossible to implement? A. Not Recently Used B. Optimal Page Replacement C. First-In-First-Out D. Second Chance Replacement E. none of these
Optimal Page Replacement
The _________ scheduling algorithm is designed especially for time-sharing systems. A. SJF B. FCFS C. RR D. multilevel queue
RR (Round-Robin)
Putting blocks of a file that are likely to be accessed in a sequence close to each other results in ...... A. smaller files B. reducing disk arm motion C. less disk space wasted D. all of these E. none
Reducing disk arm motion
When using two-phased locking, a database application proceeds to lock all records it will need and finds one already locked by another process; What does the algorithm have to do in this situation? A. go on and lock the rest B. release all locks and start over C. preempt the lock from the other process D. wait for the locked record to be released E. none of these
Release all locks and start over
A race condition __________ A. results when several threads try to access the same data concurrently B. results when several threads try to access and modify the same data concurrently C. will result only if the outcome of executes not depend on the order in which instructions are executed D. none of the above
Results when several threads try to access and modify the same data concurrently
_________ scheduling is approximated by predicting the next CPU burst with an exponential average of the measured lengths of previous CPU bursts A. multilevel queue B. RR C. FCFS D. SJF
SJF (shortest-job-first)
When using semaphores, a process invokes the P() operation before accessing its critical section, followed by the V() operation upon completion of its critical section. Consider reversing the order of these two operations -- first calling V(), then calling P(). What would be a possible outcome of this?
Several processes could be active in their critical sections at the same time
When using semaphores, a process invokes the P() operation before accessing its critical section, followed by the V() operation upon completion of its critical section. Consider reversing the order of these two operations first calling V(), then calling P(). What would be a possible outcome of this? A. Starvation is possible B. Several processes could be active in their critical sections at the same time C. Mutual exclusion is still assured D. Deadlock is possible
Several processes could be active in their critical sections at the same time
The FIFO page-replacement policy: A. Is based on program locality B. Sometimes can cause more page faults when memory size is increased C. Is not easy to implement, and hence, most systems use an approximation of FIFO.
Sometimes can cause more page faults when memory size is increased
The _________ of a process contains temporary data such as function parameters, return addresses, and local variables. A. text section B. data section C. program counter D. stack
Stack
_________ provide(s) an interface to the services provided by an operating system.
System calls
Which of the following statements is False? A. I/O-bound processes should be given priority in scheduling over CPU-bound processes to ensure good turnaround time B. Users can exploit a multilevel feedback-scheduling policy by breaking a long job into several small jobs C. The processor scheduler normally classifies a process as being a CPU-bound process if it uses most of the previous time slice allocated to it. D. The round-robin-scheduling policy allocates a time slice to a process depending on the number of time slices it has already used
The round-robin-scheduling policy allocates a time slice to a process depending on the number of time slices it has already used.
What statement concerning privileged instructions is considered false? A. They may cause harm to the system B. They can only be executed in kernel mode C. They cannot be attempted from user mode D. They are used to manage interrupts
They cannot be attempted from user mode
True/False Round robin scheduling provides a latency improvement over FCFS scheduling for interactive jobs.
True
True/False: For a FAT file system, keeping the index table in memory speeds up the random access to a file.
True
True/False: For a single-processor system, there will never be more than one process in the Running state.
True
True/False: The CPU scheduling policy that minimizes average completion time can lead to starvation
True
True/False: The size of a process's working set is a measure of process reference locality
True
True/False: it is possible to create a thread library without any kernel-level support
True
True/False: The lottery scheduler reduces the chances of CPU starvation by assigning at least one ticket to each scheduled thread. Explain your answer.
True. The lottery scheduler makes sure that every thread has a chance to get scheduled and to get at least some CPU time.
What is the technique which is used to allow a computer to run a process requiring more memory than the computer has? A. interprocess communication B. BIOS C. deadlock avoidance D. virtual memory E. none of these
Virtual Memory
Which of the following statements is FALSE? A. With the Least Recently Used (LRU) page-replacement policy, when the page size is halved, the number of page faults can be more than double the original number of page faults B. The working set is a monotonically nondecreasing function of the working set parameter C. When the working set policy is used, main memory may contain some pages which do not belong to the working set of any program
With the Least Recently Used (LRU) page-replacement policy, when the page size is halved, the number of page faults can be more than double the original number of page faults
When an operating system keeps track of the particular collection of pages a process is using, this is called the _________ A. demand set B. NRU set C. second chance set D. working set E. none of these
Working set
A cycle in a resource-allocation graph is _____ A. a necessary and sufficient condition for deadlock in the case that each resource has more than one instance B. a necessary and sufficient condition for a deadlock in the case that each resource has exactly one instance C. a sufficient condition for a deadlock in the case that each resource has more than once instance D. is neither necessary nor sufficient for indicating deadlock in the case that each resource has exactly one instance"
a necessary and sufficient condition for a deadlock in the case that each resource has exactly one instance
Which of the following will result in a process being in the Ready state? A. completion of an I/O event B. awaiting its turn on the CPU C. newly-admitted process D. all of the above
all of the above
When a page fault occurs partway through the execution of an instruction, A. a trap to the operating system occurs B. the required page must be brought into memory C. the instruction causing the page fault must be restarted, D. all of these E. none of these
all of these
When a linked list of free memory segments is kept, which algorithm is used to allocate memory for a new process? A. use the first available large enough segment B. use the best fitting segment available C. use the largest segment available D. any one of these can be used E. none of these
any one of these can be used
A solution to the critical section problem does not have to satisfy which of the following requirements? A. mutual exclusion B. progress C. atomicity D. bounded waiting
atomicity
The ____________ occurs in first-come-first-served scheduling when a process with a long CPU burst occupies the CPU
convoy effect
The file reference count is good for..... A. counting of read bytes B. counting number of open files C. counting number of links pointing to a file
counting number of links pointing to a file
A spinlock __________ A. is never advantageous B. will ultimately result in a context switch when a process must wait on a lock C. does not require a context switch when a process must wait on a lock D. is useful when locks are expected to be held for long amounts of time
does not require a context switch when a process must wait on a lock
In a paged segmented scheme of memory management, the segment table entry points to a page table because: A. The segment table may occasionally be too large to fit in one page B. Each segment may be spread over a number of pages C. Page size is usually larger than the segment size D. The page table may be too large to fit into a single segment
each segment may be spread over a number of pages
In Peterson's solution, the ___- variable indicates if a process is ready to enter its critical section A. turn B. lock C. flag[i] D. turn[i]
flag[i]
Thread-specific data is data that ________
is copied and not shared with the parent process
Which of the following statements is true for the Banker's algorithm? A. it cannot be used for a system with many resources, each of which is unique with no multiple copies B. it is used to detect deadlock C. it is not applicable when a resource is shared simultaneously by many users D. an unsafe situation will always lead to a deadlock
it is not applicable when a resource is shared simultaneously by many users
Non-preemptive process scheduling policies: A. are indispensable for interactive systems B. allocate the processor to a process for a fixed time period C. always use a ready queue sorted in order of decreasing priority D. make short jobs wait for long jobs
make short jobs wait for long jobs
The main distinction between a multiprocessor system and a multiprogrammed system is that in a multiprocessor system..... A. the main storage is shared by several programs B. the input is accepted in batches of many jobs C. processor time is shared among several processes D. many processors may be active simultaneously
many processors may be active simultaneously
The ______________ multithreading model multiplexes many user-level threads to a smaller or equal number of kernel threads. A. many-to-one model B. one-to-one model C. many-to-many model D. many-to-some model
many-to-many model
The goal of a scheduling algorithm for batch systems is.... A. keep the CPU free from jobs in case of emergency B. maximize the time between submission of a job and its termination C. maximize the number of jobs per unit time D. all of these E. none of these
maximize the number of jobs per unit time
It is advantageous for the page size to be large because:
page tables will be smaller
Implementation of segmentation differs from paging in that
pages are fixed sized and segments are not
Implementation of segmentation differs from paging in that A. segments are fixed size and pages are not B. many more pages than segments are needed C. pages are fixed sized and segments are not D. segmentation is dynamic and paging is static E. none of these"
pages are fixed sized and segments are not
A program in execution is called a(n) _________ A. process B. device driver C. interrupt handler D. bus E. none of these
process
A directed acyclic graph (DAG) is the result of a file system allowing ... A. long file names B. shared files C. file allocation tables D. all of these E. none of these
shared files
Which of the following are items private to each thread? A. stack B. open files C. address space D. all of these are private E. none of these are private
stack
A significant problem with priority scheduling algorithms is ____________ A. complexity B. starvation C. determining the length of the next CPU burst D. determining the length of the time quantum
starvation
What data structure contains information about a process' state, its program counter, stack, pointer, and other information? A. the scheduler B. the interrupt vector C. the process control block D. the thread E. none of these
the process control block
What concept allows multiple executions to take place concurrently in the same process environment? A. interrupts B. PCBs C. threads D. kernel E. none of these
threads
________ is the number of processes that are completed per time unit A. CPU utilization B. response time C. turnaround time D. throughput
throughput
__________ is the number of processes that are completed per unit time A. CPU utilization B. response time C. turnaround time D. throughput
throughput
A ________ can be used to prevent a user program from never returning control to the operating system A. portal B. program counter C. firewall D. timer
timer
A virtual address is split into two parts: an offset and a(n) A. MMU B. TLB C. virtual bit map D. virtual page number E. none of these
virtual page number
A virtual address is split into two parts: an offset and a(n) _________
virtual page number
___________ can be used to prevent busy waiting when implementing a semaphore. A. spinlocks B. waiting queues C. mutex lock D. allowing the wait() operation to succeed
waiting queues
When an operating system keeps track of the particular collection of pages, a process is using, this is called the....
working set