Chapter 5 Section 5.1 5.1 Threads that operate independently of one another but must occasionally interact to perform cooperative tasks are said to execute ________. a) synchronously b) in parallel c) asynchronously d) simultaneously Section 5.2 5.2 Preventing more than one thread from accessing a shared variable simultaneously is known as ________ access to the shared variable. a) excluding b) synchronizing c) serializing d) protecting 5.3 ________ restricts access to a shared variable to only one thread at any given time. a) asynchronism b) serialization c) protection d) mutual exclusion Section 5.2.1 5.4 An example of a producer/consumer relationship is ________. a) an application that copies data from a fixed-size buffer to a CD-RW b) a word processor that sends data to a buffer to be printed c) both a and b d) none of the above 5.5 In Java, Object method notify transitions a thread from the ________ state to the ________ state. a) waiting, ready b) blocked, waiting c) running, waiting d) ready, running 5.6 In Java, the sleep method call must appear in part of a ________ statement because it might throw an exception indicating that the thread was interrupted before its sleep time expired. a) if...else b) do...while c) try...catch d) switch
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Chapter 5
Section 5.1
5.1 Threads that operate independently of one another but must occasionally interact to perform cooperative tasks are
said to execute ________.
a) synchronously
b) in parallel
c) asynchronously
d) simultaneously
Section 5.2
5.2 Preventing more than one thread from accessing a shared variable simultaneously is known as ________ access to
the shared variable.
a) excluding
b) synchronizing
c) serializing
d) protecting
5.3 ________ restricts access to a shared variable to only one thread at any given time.
a) asynchronism
b) serialization
c) protection
d) mutual exclusion
Section 5.2.1
5.4 An example of a producer/consumer relationship is ________.
a) an application that copies data from a fixed-size buffer to a CD-RW
b) a word processor that sends data to a buffer to be printed
c) both a and b
d) none of the above
5.5 In Java, Object method notify transitions a thread from the ________ state to the ________ state.
a) waiting, ready
b) blocked, waiting
c) running, waiting
d) ready, running
5.6 In Java, the sleep method call must appear in part of a ________ statement because it might throw an exception
indicating that the thread was interrupted before its sleep time expired.
a) if...else
b) do...while
c) try...catch
d) switch
Section 5.2.2
5.7 Which of the following statements about critical sections is false?
a) Only one thread at a time can execute the instructions in its critical section for a particular resource.
b) If one thread is already in its critical section, another thread must wait for the executing thread to exit its critical
section before continuing.
c) Once a thread has exited its critical section, a waiting thread may enter its critical section.
d) All threads must wait whenever any critical section is occupied.
5.8 Code inside a critical section should ________.
a) access shared, modifiable data
b) run as quickly as possible
c) prevent the possibility of infinite loops
d) all of the above
Section 5.2.3
5.9 The constructs that encapsulate a thread’s critical section are sometimes called ________.
a) critical section primitives
b) synchronism delimiters
c) mutual exclusion primitives
d) protection delimiters
Section 5.3
5.10 Which property of mutual exclusion primitives is inappropriate for multiprocessor systems?
a) The solution is implemented purely in software on a machine without specially designed mutual exclusion
machine-language instructions.
b) No assumption can be made about the relative speeds of asynchronous concurrent threads.
c) A thread that is executing instructions outside its critical section cannot prevent any other threads from entering
their critical sections.
d) A thread must not be indefinitely postponed from entering its critical section.
Section 5.4
Section 5.4.1
5.11 A thread that uses processor cycles to continually test a condition before entering its critical section is said to be
________.
a) lockstep synchronized
b) deadlocked
c) busy waiting
d) indefinitely postponed
5.12 Lockstep synchronization does not ________.
a) occur when threads must enter and leave their critical sections in strict alternation
b) improve the efficiency of a process by forcing threads to operate at the same speed
c) force faster threads to operate at the same speed as slower threads
d) occur as a result of using a single variable to govern access to threads’ critical sections
5.13 ________ occurs when an infinite loop prevents progress in a multithreaded application.
a) Lockstep synchronization
b) Deadlock
c) Busy waiting
d) Indefinite postponement
Section 5.4.2
No questions.
Section 5.4.3
5.14 Lamport’s Bakery Algorithm does not require ________.
a) a large number of shared variables
b) complicated loops
c) that any operations occur atomically
d) all of the above
5.15 Which of the following statements about Lamport’s Bakery Algorithm is false?
a) Lamport’s algorithm allows multiple threads to obtain the same ticket number.
b) The thread possessing the ticket with the highest numerical value can enter its critical section.
c) Lamport’s algorithm enforces mutual exclusion.
d) A thread’s ticket number is reset when the thread exits its critical section.
5.16 Which of the following mutual exclusion algorithms require instructions to be executed atomically?
a) Dekker’s algorithm
b) Peterson’s algorithm
c) Lamport’s algorithm
d) both a and b
Section 5.5
Section 5.5.1
5.17 Disabling interrupts ________.
a) is a viable solution for mutual exclusion in a multiprocessor system
b) on a uniprocessor system could result in an infinite loop causing the system to hang
c) typically prevents a thread from being preempted while accessing shared data
d) both b and c
Section 5.5.2
5.18 A ________ is a variable that governs access to critical sections.
a) primitive
b) lock
c) controller
d) flag
5.19 The test-and-set instruction ________.
a) prevents deadlock
b) prevents indefinite postponement
c) eliminates the possibility that a thread is preempted between reading a value from a memory location and writing a
new value to the memory location
d) none of the above
Section 5.5.3
5.20 Many system architectures support a(n) ________ instruction that enables a thread to exchange the values of two
variables atomically.
a) swap
b) test-and-set
c) semaphore
d) switch
Section 5.6
5.21 Which of the following statements about semaphores is false?
a) A thread performs the P operation after it enters its critical section.
b) A thread performs the V operation before exiting its critical section.
c) Initializing a semaphore sets the value of a protected variable to indicate that no thread is executing its critical
section.
d) Initializing a semaphore creates a queue that stores references to threads waiting to enter their critical sections
protected by that semaphore.
Section 5.6.1
5.22 What happens when a thread calls P( S ) when it wants to enter its critical section, where S is a binary semaphore
set to 1?
a) The thread is allowed to enter its critical section and S is decremented.
b) The thread is blocked and added to a queue of waiting threads.
c) The semaphore is set to 2.
d) none of the above
5.23 Which of the following statements about semaphores is true?
a) P and V operations should be indivisible operations.
b) If several threads attempt a P( S ) operation simultaneously, only one thread should be allowed to proceed.
c) A semaphore implementation should guarantee that threads do not suffer indefinite postponement.
d) all of the above
Section 5.6.2
5.24 Semaphores can be used for each of the following purposes except:
a) to protect access to a critical section
b) to notify the process that an event has occurred
c) to prevent shared variables from getting corrupted
d) to synchronize two or more concurrent threads
Section 5.6.3
5.25 If a thread attempts a P operation when a counting semaphore has been decremented to zero, ________.
a) the thread obtains a resource from the pool and decrements the semaphore to -1
b) the thread obtains a resource from the pool and the semaphore remains equal to 0
c) the thread must wait until a resource is returned to the pool by a V operation
d) the thread returns a resource to the pool and increments the semaphore to 1
Section 5.6.4
5.26 Semaphore operations can be implemented in the kernel of a multiprocessor system by:
a) giving one processor the job of controlling the ready list.
b) controlling access (via busy waiting) to a shared ready list.
c) both a and b
d) none of the above
Chapter 6
Section 6.1
6.1 Which of the following is not a reason why the programming community is so intent on concurrent programming?
a) Concurrent programming enables us to express more natural solutions to problems that are inherently parallel.
b) The true hardware parallelism possible with multiprocessors and distributed systems can only be harnessed through
concurrent programming.
c) Concurrent programs are easier to write, debug, modify and prove correct than sequential programs.
d) Systems such as air traffic control systems, mission-critical systems, and real-time process control systems can
benefit from concurrent programming.
6.2 ________ supports concurrent programming, in addition to many features needed to implement real concurrent
systems.
a) Java
b) Visual Basic .NET
c) Python
d) all of the above
Section 6.2
6.3 ________ is a software architectural technique that improves modularity and facilitates the development of more
reliable software systems.
a) Mutual exclusion
b) Multithreading
c) Information hiding
d) Concurrent programming
6.4 To avoid indefinite postponement, a monitor ________.
a) terminates newly arriving threads when other threads are waiting
b) gives a higher priority to waiting threads than to newly arriving ones
c) terminates waiting threads when new threads arrive
d) gives a higher priority to newly arriving threads than to waiting ones
Section 6.2.1
6.5 Monitors implement ________ between threads of execution.
a) mutual exclusion
b) synchronization
c) both a and b
d) none of the above
6.6 A thread can exit a monitor by ________.
a) completing execution of the code protected by the monitor
b) sleeping inside the monitor
c) waiting on a condition variable
d) both a and c
Section 6.2.2
6.7 Monitor initialization ________.
a) occurs each time a thread returns a resource
b) typically sets a variable indicating that the monitor initially is in use
c) occurs only once, before threads begin using the monitor
d) occurs each time a thread requests access to a resource
Section 6.2.3
6.8 Which of the following statements about using a circular buffer to implement print spooling is false?
a) The despooler thread tends to run at a slower speed than the spooler thread.
b) A circular buffer can “take up the slack” resulting from the mismatch in the speeds of the spooler and despooler
threads.
c) If the system always generates print lines faster than the printer can print them, the buffer will always be full.
d) The spooler thread tends to run at a slower speed than the despooler thread.
6.9 If the producer and consumer work at approximately the same speed, using the circular buffer can ________ the
average speed of the application.
a) decrease
b) have no effect on
c) increase
d) none of the above
Section 6.2.4
6.10 In the readers/writers problem, cascading in readers ________.
a) forces all arriving threads to wait
b) continues until all waiting readers have become active
c) allows waiting readers to become active as soon as another reader finishes
d) all of the above
6.11 ________ is important for preventing indefinite postponement in the readers/writers problem.
a) Giving preference to waiting readers over waiting writers
b) Ensuring that no writer thread is waiting to write when a new reader begins reading
c) Forcing that arriving readers to wait while waiting readers are cascading
d) all of the above
Section 6.3
6.12 Which type of monitor allows a thread inside the monitor to signal that the monitor will soon become available,
but still maintain a lock on the monitor until it exits?
a) signal-and-exit
b) signal-and-wait
c) signal-and-continue
d) signal-and-wake
6.13 In Java, a(n)________ is a queue of threads awaiting entry into a monitor.
a) wait set (or queue)
b) entry set
c) notified set
d) either a or b
6.14 In Java, a(n)________ is a queue of threads waiting to reenter the monitor for an object.
a) wait set (or queue)
b) entry set (or queue)
c) notified set
d) either a or b
6.15 In Java, the ________ method wakes all threads in the entry and wait sets.
a) notify
b) signal
c) notifyAll
d) signalAll
Section 6.4
6.16 In the Java implementation of the producer/consumer relationship, the producer thread remains in the ________
until it is notified by another thread that it may proceed.
a) ready state
b) running state
c) waiting state
d) none of the above
6.17 Methods declared as ________ encapsulate critical sections of a program that can only be occupied by one thread
at a time.
a) static
b) synchronized
c) private
d) protected
Section 6.5
6.18 The size of a circular buffer is important because ________.
a) if the number of buffer slots is too large, threads will wait more often
b) if the number of buffer slots is too small, there would be wasted memory
c) if the number of buffer slots is too small, threads will wait more often.
d) if the number of buffer slots is too large, fewer threads can access the buffer
6.19 Which variable(s) must be shared between threads to implement a producer/consumer relationship using a
circular buffer?
a) variables that maintain read and write buffer locations
b) a variable that maintains a count of occupied buffers
c) a reference to a buffer object that holds data used by the readers/writers and provides access methods
d) all of the above
Chapter 7
Section 7.1
7.1 Deadlock can occur ________.
a) only between two or more threads
b) only on multiprogrammed systems
c) only if resource sharing is allowed
d) none of the above
7.2 Which of the following is not a major area of deadlock research?
a) prevention
b) avoidance
c) recovery
d) none of the above
Section 7.2
7.3 If a process is given the task of waiting for an event to occur, and if the system includes no provision for signaling
that event, then we have ________.
a) one-process deadlock
b) starvation
c) mutual exclusion
d) circular wait
Section 7.2.1
Section 7.2.2
7.4 Most deadlocks in operating systems develop because of the normal contention for _________ .
a) dedicated resources
b) processors
c) main memory
d) device drivers
Section 7.2.3
7.5 ________ is characteristic of deadlocked systems.
a) Starvation
b) Circular waiting
c) Saturation
d) Aging
7.6 To avoid deadlock in spooling systems, a system can ________.
a) provide considerably more space for spooling files than is likely to be needed
b) restrain the input spoolers so that they do not accept additional print jobs when the spooling files approach some
saturation threshold
c) allow printing to begin before the job is completed so that a full, or nearly full, spooling file can begin emptying
while a job is still executing
d) all of the above
Section 7.2.4
7.7 The solution to the Dining Philosophers problem must ________.
a) prevent deadlock
b) prevent starvation
c) ensure mutual exclusion
d) all of the above
Section 7.3
7.8 ________ is a technique that prevents indefinite postponement.
a) Monitors
b) Mutual exclusion
c) Aging
d) Preemption
Section 7.4
7.9 Code that may be changed but is reinitialized each time it is used is said to be ________ .
a) serially reusable
b) reentrant
c) static
d) shared
7.10 ________ code is not modified as it executes and may be shared by several processes simultaneously.
a) Preemptible
b) Dynamic
c) Reentrant
d) Serially reusable
7.11 ________ resources are the kinds that tend to become involved in deadlocks.
a) Preemptible
b) Serially reusable
c) Reentrant
d) all of the above
Section 7.5
7.12 Which of the following is not a condition necessary for deadlock to exist?
a) wait-for condition
b) mutual-exclusion condition
c) circular-wait condition
d) indefinite-postponement condition
Section 7.6
7.13 _______ conditions a system to remove any possibility of deadlocks occurring.
a) Deadlock avoidance
b) Deadlock prevention
c) Deadlock detection
d) Deadlock recovery
7.14 ________ imposes less stringent conditions than deadlock prevention in an attempt to get better resource
utilization while stopping deadlock from occurring.
a) Deadlock avoidance
b) Deadlock detection
c) Deadlock recovery
d) both a and c
Section 7.7
Section 7.7.1
7.15 The strategy of denying the “wait-for” condition ________.
a) prevents deadlock from occurring
b) is commonly implemented
c) leads to poor resource utilization
d) both a and c
Section 7.7.2
7.16 The strategy of denying the “no-preemption” condition could lead to ________.
a) indefinite postponement
b) loss of work
c) poor resource utilization
d) both a and b
Section 7.7.3
7.17 The strategy of denying the “circular-wait” condition ________.
a) is a deadlock prevention technique that promotes portability
b) creates a linear ordering of resources
c) maximizes resource utilization
d) none of the above
Section 7.8
7.18 The system is said to be in an unsafe state if ________.
a) the operating system cannot guarantee that all current processes can complete their work within a finite time
b) the system is deadlocked
c) a thread is indefinitely postponed
d) mutual exclusion has been violated
7.19 Dijkstra’s Banker’s Algorithm requires the system to maintain ________ for each process.
a) a count of the system’s total resources
b) the maximum resources that can be requested
c) the current loan
d) both b and c
Section 7.8.1
7.20 Consider the following system state:
Process Max ( Pi ) Loan ( Pi)
P1 7 2
P2 6 2
P3 7 4
Total resources, t = 11
The system will be in a safe state if ________.
a) process P1 is allocated one additional resource
b) process P2 is allocated two additional resources
c) process P3 is allocated three additional resources
d) process P2 is allocated one additional resource
Section 7.8.2
7.21 An unsafe state implies ________.
a) the existence of deadlock
b) that deadlock will eventually occur
c) that some unfortunate sequence of events might lead to a deadlock
d) none of the above
Section 7.8.3
7.22 Consider the following system state:
Process Max ( Pi ) Loan ( Pi)
P1 7 2
P2 5 2
P3 9 4
Total resources, t = 12
The system will enter an unsafe state if ________.
a) process P1 is allocated one additional resource
b) process P2 is allocated two additional resources
c) process P3 is allocated three additional resources
d) process P2 is allocated one additional resource
Section 7.8.4
7.23 In the Banker’s Algorithm, resource requests that would result in ________ are repeatedly denied until they can
eventually be satisfied.
a) indefinite postponement
b) holding resources while waiting for others
c) unsafe states
d) all of the above
Section 7.8.5
7.24 ________ is a weakness of the Banker’s Algorithm.
a) Allowing the population of processes to vary over time
b) Enabling processes to hold their resources indefinitely
c) Requiring that processes state their maximum needs in advance
d) Enabling the number of resources to fluctuate
7.25 The Banker’s Algorithm ________.
a) can provide better resource utilization than deadlock prevention
b) incurs little overhead
c) is appropriate for real-time systems
d) facilitates applications programming
Section 7.9
7.26 ________ is the process of determining that a deadlock exists and identifying the processes and resources
involved in the deadlock.
a) Deadlock avoidance
b) Deadlock detection
c) Deadlock recovery
d) Deadlock prevention
Section 7.9.1
7.27 In a resource-allocation graph, ________ represent processes and ________ represent resources.
a) circles, squares
b) arrows, circles
c) squares, circles
d) arrows, squares
7.28 In a resource-allocation graph, an arrow points from a ________ to a ________ to indicate that the system has
allocated a specific resource of a specific type to the process.
a) square, large circle
b) square, small circle
c) large circle, square
d) small circle, square
Section 7.9.2
7.29 If a graph can be reduced by all its processes, then ________.
a) there is no deadlock
b) indefinite postponement cannot occur
c) the system is in an unsafe state
d) none of the above
Section 7.10
7.30 To ensure that data in a database remains in a consistent state when deadlocked processes are terminated,
database systems typically perform resource allocations using ________.
a) checkpoints
b) rollback
c) aging
d) transactions
7.31 Which of the following complicates deadlock recovery?
a) It may not be clear that the system has become deadlocked.
b) Most systems do not provide the means to suspend a process indefinitely.
c) The deadlock could involve many processes.
d) all of the above
Section 7.11
7.32 Many of today’s personal computer systems ignore deadlock because ________.
a) the processor time required to check for deadlocks can significantly reduce system performance
b) they do not perform many concurrent operations that could lead to deadlock
c) the number of resources that operating systems must manage is decreasing dramatically
d) all of the above
7.33 Deadlock will continue to be an important area of research in current and future systems because ________.
a) large-scale systems are becoming more oriented toward asynchronous parallel operations
b) small, portable devices, for which users cannot rely on an administrator to detect and rid a system of deadlock, are
becoming more prevalent
c) there is an increasing tendency of operating systems designers to view data as a resource that must be managed
carefully
d) all of the above
Chapter 9
Section 9.1
9.1 ________, while plentiful, is slower than other forms of storage and not suitable for running programs.
a) main memory
b) cache
c) secondary storage
d) All of the above
9.2 Which of the following statements is false?
a) Secondary storage cannot be referenced directly by a processor.
b) Some systems cannot afford the overhead of virtual memory.
c) Real memory management is unimportant in today’s systems.
d) Most of today’s systems are virtual memory systems.
Section 9.2
9.3 Operating systems can divide main memory into portions called ________ so that one process cannot overwrite
another’s memory, either inadvertently or maliciously.
a) sections
b) partitions
c) modules
d) regions
Section 9.3
9.4 A memory manager’s primary function is ________.
a) to determine how to allocate available memory
b) to determine how to respond to changes in a process’s memory usage
c) to interact with special memory management hardware
d) all of the above
Section 9.4
9.5 According to ________, many processes that access data and instructions once are likely to access them again in
the future.
a) access patterns
b) Moore’s Law
c) spatial locality
d) temporal locality
9.6 Going from lower to higher levels in the memory hierarchy, ________.
a) storage access time decreases
b) storage cost per bit increases
c) storage capacity increases
d) both a and b
Section 9.5
9.7 ________ strategies determine which pieces of data to remove from main memory to free space for a new process.
a) Fetch
b) Placement
c) Replacement
d) both a and c
9.8 ________ strategies attempt to load a piece of program or data into memory before it is referenced.
a) Demand fetch
b) Anticipatory fetch
c) First-fit placement
d) Next-fit placement
Section 9.6
9.9 In general, the overhead incurred by ________ allocation is outweighed by the advantages of being able to store
more processes in main memory at the same time.
a) contiguous
b) noncontiguous
c) fragment
d) segment
9.10 Noncontiguous memory allocation splits programs into blocks of memory called ________ that can be loaded
into nonadjacent “holes” in main memory.
a) pages
b) partitions
c) frames
d) segments
Section 9.7
9.11 Before the advent of ________, programmers wrote all the code necessary to implement a particular application,
including the highly detailed machine-level input/output instructions.
a) an IOCS
b) a BIOS
c) object-oriented programming languages
d) memory management
Section 9.7.1
9.12 ________ is a technique that involves breaking a program into logical segments and keeping only the currently
needed segment in memory at any one time.
a) Caching
b) Swapping
c) Dynamic programming
d) Creating overlays
9.13 ________ can be thought of as a modern operating system-controlled version of overlays.
a) IOCS
b) Virtual memory
c) Caching
d) Noncontiguous memory
Section 9.7.2
9.14 A(n) ________ can be used in single-user contiguous memory allocation systems to prevent programs from
damaging the operating system’s memory.
a) lock
b) protection bit
c) boundary register
d) semaphore
9.15 To allow programs to access and execute operating system instructions, operating systems provide ________.
a) the executive mode of execution
b) system calls
c) memory protection keys
d) both a and b
Section 9.7.3
9.16 ________ was an early innovation that helped decrease the amount time the computer wasted between jobs.
a) Batch processing
b) Interactive computing
c) Single-user contiguous memory allocation
d) both a and b
9.17 A ________ reads and executes the control-language statements that define each job as well as helps prepare the
system for the next job.
a) boundary register
b) batch processor
c) single-stream batch processor
d) job stream processor
Section 9.8
9.18 Under fixed-partition multiprogramming, ________ occurs when a memory partition is larger than the memory
and data of the process currently loaded into it.
a) compaction
b) garbage collection
c) internal fragmentation
d) external fragmentation
9.19 In a partitioned memory environment, the single boundary register is replaced by the ________ and ________
registers which delimit the upper and lower boundaries of a partition, respectively.
a) base, limit
b) limit, base
c) high, low
d) low, high
Section 9.9
9.20 ________-partition multiprogramming allows a process to occupy only as much space as needed in an attempt to
prevent ________ fragmentation.
a) Variable, internal
b) Fixed, internal
c) Variable, external
d) Fixed, external
Section 9.9.1
9.21 To maximize the use of available space, ________ combines adjacent holes in memory, while ________
relocates all occupied areas of memory to one end of main memory, leaving a single large free memory hole instead of