CECS326 All Zybook Questions
What is the valid test for determining if the bounded buffer is empty? -Both in and out are equal to 0 -(in == out) -in = -1
(in == out)
Which of the following forms of storage has the largest capacity? -registers -hard-disk drives -nonvolatile memory
-hard-disk drives
How many threads may run in parallel on a single processing core with two hardware threads? -1 -2 -4
1
If lock = 0, the function call compare_and_swap(&lock,0,1) sets lock to ____ and returns _____. -0, 0 -0, 1 -1, 0 -1, 1
1, 0
_________________ saves the state of the currently running process and restores the state of the next process to run. -The CPU scheduler -Swapping -A context switch
A context switch
Which of the following is true of nonpreemptive scheduling? -Nonpreemptive scheduling requires a timer. -A process keeps the CPU until it releases the CPU either by terminating or by switching to the waiting state. -Nonpreemptive scheduling incurs a cost associated with access to shared data.
A process keeps the CPU until it releases the CPU either by terminating or by switching to the waiting state.
Which of the following is not considered a liveness failure? -Deadlock -Indefinite waiting -A race condition
A race condition
What best describes a maskable interrupt? -An interrupt that can temporarily be disabled. -An interrupt that must be responded to immediately, regardless what the operating system is performing at the moment. -A technique for prioritizing various interrupts.
An interrupt that can temporarily be disabled.
Which of the following is not true of clustered systems? -They can provide high-availability service. -Because they are typically connected across a computer network, they cannot meet high-performance computing needs. -Data sharing is still possible on clustered systems even though the cluster consists of separate computer systems.
Because they are typically connected across a computer network, they cannot meet high-performance computing needs.
Message passing with direct communication requires _______ . -Either the send() message or receive() message functions to specify a process as a parameter to the function. -Both the send() message and receive() message functions to specify a process as a parameter to the function. -A separate mailbox.
Both the send() message and receive() message functions to specify a process as a parameter to the function.
How do POSIX condition variables provide mutual exclusion? -By using a condition variable within a monitor. -By associating a condition variable with a mutex lock. -Mutual exclusion is part of the condition variable type.
By associating a condition variable with a mutex lock.
Which of the following is a property of peer-to-peer systems? -Clients and servers are not distinguished from one another. -Peer-to-peer systems do not offer any advantages over traditional client-server systems. -Peer-to-peer systems suffer from the server acting as the bottleneck in performance.
Clients and servers are not distinguished from one another.
What best describes the situation in the dining philosophers problem if all five philosophers attempt to eat at the same time? -All five philosophers are able to eat -Only two of the five philosophers will be able to eat -Deadlock will occur
Deadlock will occur
Which of the following is true of multilevel queue scheduling? -Processes can move among queues. -Each queue is assigned a specific scheduling algorithm. -Threads in one queue cannot have absolute priority over threads in lower-priority queues.
Each queue is assigned a specific scheduling algorithm.
If a resource-allocation graph has a cycle, the system must be in a deadlock. -True -False
False
Multicore also means multiple CPUs. -True -False
False
What is the purpose of the semaphore mutex in the implementation of the bounded-buffer problem using semaphores? -It indicates the number of empty slots in the buffer. -It indicates the number of occupied slots in the buffer. -It ensures mutual exclusion.
It ensures mutual exclusion.
A stack uses the ______ principle for organizing data while a queue uses the ________ principle. -FIFO, LIFO -LIFO, FIFO -left child, right child
LIFO, FIFO
What best explains why shared memory is typically faster than message passing? -Message passing is implemented in system calls which requires kernel intervention; shared memory only requires a system call to establish the shared memory segment. -Message passing is typically used for sharing large amounts of data. -Message passing is only used in distributed systems where communication takes place across a slower network.
Message passing is implemented in system calls which requires kernel intervention; shared memory only requires a system call to establish the shared memory segment.
___ is a software framework that provides additional services (to those provided by an operating system) to application developers. -System programs -Kernel -Middleware
Middleware
Under _______ loads, CAS protection will be faster than traditional synchronization. -Uncontended -Moderately-contended -Highly-contended
Moderately-contended
What best explains why Peterson's solution does not solve the critical section problem on modern computer architectures? -Modern computer architectures may reorder instructions. -Peterson's solution does not preserve the bounded waiting requirement.
Modern computer architectures may reorder instructions.
What best describes the advantage of POSIX named semaphores? -The functions for using a named semaphore are easier for programmers to work with than unnamed semaphores. -Only POSIX named semaphores can be provided an initial value. -Multiple, unrelated processes can use a named semaphore and only threads belonging to the same process can use an unnamed semaphore.
Multiple, unrelated processes can use a named semaphore and only threads belonging to the same process can use an unnamed semaphore.
_________ is the requirement that if a process is in its critical section, no other processes can be in their critical sections at the same time. -Progress -Bounded waiting -Mutual exclusion
Mutual exclusion
Which of the following types of operating system kernel is free from race conditions? -Nonpreemptive kernel -Preemptive kernel -No operating system kernel is free from race conditions
Nonpreemptive kernel
What is the best scenario for implementing a mutex lock as a spinlock? -On a single-core system where the lock is held for a short duration. -On a multi-core system where the lock is held for a long duration. -On a multi-core system where the lock is held for a short duration.
On a multi-core system where the lock is held for a short duration.
____________ can occur when a higher-priority process needs to access a data structure that is currently being accessed by a lower-priority process. -Priority inversion -Deadlock -Infinite loop
Priority inversion
What statement concerning privileged instructions is considered false? -Unless used appropriately, privileged instructions may cause harm to the system. -Privileged instructions can only be executed in kernel mode. -Privileged instructions can be executed in both user mode and kernel mode.
Privileged instructions can be executed in both user mode and kernel mode.
____ means that a process has an affinity for the processor on which it is currently running.
Processor affinity
____ scheduling algorithm preempts the currently-running process after its time quantum has expired. -FCFS -RR -Multilevel queue
RR
Which of the following is not an example of a wait queue? -Ready queue -Child termination queue -I/O queue
Ready queue
What type of process is created by the Chrome browser for each tab that is opened?
Renderer
Match each state transition to the corresponding event. A timeout has occurred. -Ready -> Running -Running -> Ready -Running -> Terminated -Waiting -> Ready -Running -> Waiting
Running -> Ready
Match each state transition to the corresponding event. Process is selected to run on a processing core. -Ready -> Running -Running -> Ready -Running -> Terminated -Waiting -> Ready -Running -> Waiting
Running -> Ready
Match each state transition to the corresponding event. Process exits. -Ready -> Running -Running -> Ready -Running -> Terminated -Waiting -> Ready -Running -> Waiting
Running -> Terminated
Match each state transition to the corresponding event. Process needs to wait for an event (such as completion of an I/O operation) -Ready -> Running -Running -> Ready -Running -> Terminated -Waiting -> Ready -Running -> Waiting
Running -> Waiting
In ____ scheduling, the next CPU burst is predicted with an exponential average of the measured lengths of previous CPU bursts. -Multilevel queue -FCFS -SJF
SJF
Which of the following statements are false? -Semaphores can be used to solve the critical section problem. -Semaphores can be used to control access to a finite number of resources. -Semaphores are equivalent to mutex locks.
Semaphores are equivalent to mutex locks.
Which of the following statements concerning open source operating systems is true? -Source code is made available. -Open source operating systems are always more secure than commercial, closed systems. -All open source operating systems share the same set of goals.
Source code is made available.
The ____ determines the decision of which kernel thread to schedule onto which CPU. -Process-contention scope -System-contention scope -Dispatcher
System-contention scope
What best describes what occurs when a child process calls the exec() system call? -The parent must wait for the child to terminate. -The child is a duplicate of the parent. -The child process has a new program loaded into it.
The child process has a new program loaded into it.
Which of the following statements best describes the role of the dispatcher? -The dispatcher is involved with making scheduling decisions. -The dispatcher gives control of the CPU to the process selected by the scheduler. -The dispatcher is not involved during a context switch.
The dispatcher gives control of the CPU to the process selected by the scheduler.
A process may transition to the Ready state by which of the following actions? -While the process is waiting for completion of an I/O event -The process timed out or it has requested an operation (a waited I/O or a semaphore WAIT). -The process is dispatched by the scheduler to run on a CPU core.
The process timed out or it has requested an operation (a waited I/O or a semaphore WAIT).
____ is the number of processes that are completed per time unit. -CPU utilization -Response time -Throughput
Throughput
A counting semaphore can be used as a binary semaphore. -True -False
True
The four necessary conditions of deadlock must be present for deadlock to occur. -True -False
True
Under ______ loads, both traditional and CAS-based protection will be fast. -Uncontended -Moderately-contended -Highly-contended
Uncontended
_______ is a technology that abstracts the hardware of an actual computer into several different execution environments. -Emulation -Host operating system -Virtualization
Virtualization
Match each state transition to the corresponding event. The event for which the process was waiting has occured. -Ready -> Running -Running -> Ready -Running -> Terminated -Waiting -> Ready -Running -> Waiting
Waiting -> Ready
_____ can be used to prevent busy waiting when implementing a semaphore.
Waiting Queues
Which of the following operating systems is not open source? -Windows -Solaris -GNU/Linux
Windows
The presence of a cycle in a resource-allocation graph is ____. -a necessary and sufficient condition for deadlock in the case that each resource has more than one instance -a necessary and sufficient condition for a deadlock in the case that each resource has exactly one instance -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
On SMP machines the fundamental locking mechanism in the Linux kernel is _____. -a mutex lock -a spinlock -kernel preemption
a spinlock
What is the correct order of operations for protecting a critical section using mutex locks? -release() followed by acquire() -acquire() followed by release() -Setting the lock to true followed by setting the lock to false
acquire() followed by release()
Message passing in Windows is known as _______ . -advanced local procedure call -a shared section object -communication ports
advanced local procedure call
A device controller informs a device driver it has completed an I/O operation using ________. -direct memory access (DMA) -an interrupt handler -an interrupt
an interrupt
in Little's formula, λ, represents the ____. -average waiting time in the queue -average arrival rate for new processes in the queue -average queue length
average arrival rate for new processes in the queue
The code example below _________ lead to deadlock between two threads. /* thread_one runs in this function */ void *do_work_one(void *param) { pthread_mutex_lock(&first_mutex); pthread_mutex_lock(&second_mutex); /** * Do some work */ pthread_mutex_unlock(&second_mutex); pthread_mutex_unlock(&first_mutex); pthread_exit(0); } /* thread_two runs in this function */ void *do_work_two(void *param) { pthread_mutex_lock(&second_mutex); pthread_mutex_lock(&first_mutex); /** * Do some work */ pthread_mutex_unlock(&first_mutex); pthread_mutex_unlock(&second_mutex); pthread_exit(0); } -will not -can -will
can
A mutex lock ____. -is another term for a boolean variable -can be used to solve the critical section problem -is not guaranteed to have atomic operations
can be used to solve the critical section problem
Deadlock prevention by denying the _________ condition is the simplest way to prevent deadlocks. -mutual exclusion -no preemption -circular wait
circular wait
With ____ a thread executes on a processor until a long-latency event (i.e. a memory stall) occurs, at which point the processor switches to another thread. -coarse-grained multithreading -fine-grained multithreading -symmetric multiprocessing (SMP)
coarse-grained multithreading
A process control block ____. -contains a process' states -stores the executable code the process will run -determines which process is to be run next
contains a process' states
A semaphore ________ . -contains an integer value -is not guaranteed to have atomic operations -Uses the same acquire() and release() operations as a mutex lock.
contains an integer value
A(n) _______ refers to the section of the code which is accessing data that may be modified by another process executing concurrently. -critical section -entry section -remainder section
critical section
A ___ is a custom build of the Linux operating system. -LiveCD -distribution -VMWare Player
distribution
There is the shared global variable double balance; that represents the balance in a banking account. There are multiple threads that may concurrently call the deposit() and withdraw() functions double deposit(double amount) { balance += amount; return balance; } double withdraw(double amount) { if (amount <= balance) { balance -= amount; } return balance; } There is a race condition on the shared variable balance. Which of the following code statements correctly fixes the race condition in the deposit() function using a mutex lock with the acquire() and release() operations? -double deposit(double amount) { acquire(); balance += amount; return balance; } -double deposit(double amount) { acquire(); balance += amount; release(); return balance; } -double deposit(double amount) { acquire(); balance += amount; return balance; release(); }
double deposit(double amount) { acquire(); balance += amount; release(); return balance; }
There is the shared global variable double balance; that represents the balance in a banking account. There are multiple threads that may concurrently call the deposit() and withdraw() functions double deposit(double amount) { balance += amount; return balance; } double withdraw(double amount) { if (amount <= balance) { balance -= amount; } return balance; } There is a race condition on the shared variable balance. Which of the following code statements correctly fixes the race condition in the withdraw() function using a mutex lock with the acquire() and release() operations? -double withdraw(double amount) { acquire(); if (amount <= balance) { balance -= amount; release(); } return balance; } -double withdraw(double amount) { acquire(); if (amount <= balance) { balance -= amount; } release(); return balance; }
double withdraw(double amount) { acquire(); if (amount <= balance) { balance -= amount; } release(); return balance; }
A deadlock occurs when ____. -a process is waiting for I/O to a device that does not exist -the system has no available free resources -every process in a set is waiting for an event that can only be caused by another process in the set
every process in a set is waiting for an event that can only be caused by another process in the set
An instruction that executes atomically ____. -must consist of only one machine instruction -executes as a single, uninterruptible unit -cannot be used to solve the critical section problem
executes as a single, uninterruptible unit
A _____ provides a file-system interface which allows clients to create and modify files. -compute-server system -file-server system -software as a service
file-server system
In Peterson's solution, the ____ variable indicates if process i is ready to enter its critical section. -turn -lock -flag[i]
flag[i]
A ________ associates [key:value] pairs. -hash map -hash function -hash collision
hash map
One necessary condition for deadlock is ____, which states that a process must be holding one resource and waiting to acquire additional resources. -hold and wait -mutual exclusion -no preemption
hold and wait
To handle deadlocks, operating systems most often ____. -ignore the problem of deadlocks -use protocols to prevent or avoid deadlocks -detect and recover from deadlocks
ignore the problem of deadlocks
A _________ instruction ensures that all loads and store operations are completed before additional load and store operations are performed. -memory barrier -atomic variable -memory model
memory barrier
A(n) ______________ allows several unrelated processes to use the pipe for communication. -anonymous pipe -named pipe -ordinary pipe
named pipe
Bluetooth devices use wireless technology to communicate over several feet, in essence creating a ____. -local-area network -wide-area network -personal-area network
personal-area network
Deadlock _______ handles deadlocks by ensuring that one of their necessary conditions cannot hold. -avoidance -prevention -recovery
prevention
A/an ___ is an instance of a program in execution. -process -operating system -program counter
process
The ________ is the physical chip that contains one or more CPUs.
processor
The two general approaches to load balancing are ____ and ____. -coarse grained, fine grained -soft real-time, hard real-time -push migration, pull migration
push migration, pull migration
Embedded computers typically run on a ____ operating system. -real-time -mobile -client-server
real-time
A blocking send() and blocking receive() is known as a(n) ________________. -synchronous communication -rendezvous -asynchronous communication
rendezvous
A monitor ________ . -represents programmer-defined data and a set of functions that provide mutual exclusion -is similar to a semaphore -allows multiple threads to be active within the monitor at the same time
represents programmer-defined data and a set of functions that provide mutual exclusion
Processes can wait while _______ a resource. -requesting -using -releasing
requesting
The first readers-writers problem ____. -requires that, once a writer is ready, that writer performs its write as soon as possible -requires that no reader will be kept waiting unless a writer has already obtained permission to use the shared database -allows either only one reader or one writer simultaneous access to the database
requires that no reader will be kept waiting unless a writer has already obtained permission to use the shared database
UNIX systems escalate privileges by setting the _______ attribute. -effective user id -setuid -security id
setuid
A Windows dispatcher object is available when the dispatcher object is in a ______ state.
signaled
A call to pthread_cond_signal() ________. -releases the mutex lock and signals one thread waiting on the condition variable -signals one thread waiting on the condition variable, but does not release the mutex lock -signals all threads waiting on the condition variable, but does not release the mutex lock
signals one thread waiting on the condition variable, but does not release the mutex lock
Two important design issues for cache memory are ___. -speed and volatility -size and replacement policy -size and access privileges
size and replacement policy
Examples of the _______ model include applications such as word processors or spreadsheets that run in the cloud and may be accessed via the internet. -platform as a service -hybrid cloud -software as a service
software as a service
The convention in modern operating systems and compilers is that the ____ of a process contains temporary data such as function parameters, return addresses, and local variables. -text section -data section -stack
stack
______ refers to the special operation which allows a user program to request an operating system service. -process -system call -kernel mode
system call
A UNIX/Linux _______ process is assigned as the parent to orphan processes. -zombie -systemd -sshd
systemd
A process that calls the wait() function on a condition variable is blocked ________. -only if another process is active in the monitor -until another process calls signal() on the condition variable -only if at least 1 other process has also called wait() on the condition variable
until another process calls signal() on the condition variable
Which of the following terms is not considered another term for kernel mode? -user mode -system mode -privileged mode
user mode
What best describes the return value from fork() for the child process? -value < 0 -value of 0 -value > 0
value of 0
To use a binary semaphore to solve the critical section problem, the semaphore must be initialized to 1 and _____ must be called before entering a critical section and _____ must be called after exiting the critical section. -wait(), signal() -signal(), wait() -Mutex locks - not semaphores - are used to solve the critical section problem.
wait(), signal()
A race condition can occur ____. -when several threads read the same data concurrently -when several threads try to access and modify the same data concurrently -only if the outcome of execution does not depend on the order in which instructions are executed
when several threads try to access and modify the same data concurrently
A UNIX/Linux process that calls exit() to terminate, but whose parent has not yet called wait(), is known as a ________ process. -zombie -orphan -terminated
zombie