Concurrency in Operating Systems
- 83Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
83 questions
- 1In operating systems, concurrency informally means doing multiple things_____.
Hint
Think about when separate activities overlap in execution.
Answer
at the same time
- 2A program can be decomposed into_____chunks when the order in which they run does not matter.
Hint
These parts of a program can run in different orders without changing the intended result.
Answer
order-independent
- 3On UNIX, multiple processes can run_____.
Hint
The operating system can run more than one process during the same period.
Answer
simultaneously
- 4On UNIX, multiple_____of the same program can run at once.
Hint
Each running instance is a separate execution of the program.
Answer
copies
- 5The CPU's available time and processing capacity can be_____among running processes.
Hint
The operating system distributes access to the processor.
Answer
shared
- 6When one process is waiting for input or output, another process can use the_____.
Hint
It is the processor that executes instructions.
Answer
CPU
- 7Multiprogramming means that more than one process can be_____to execute.
Hint
These processes are prepared to run, even though they may not all execute at once.
Answer
ready
- 8Timesharing splits CPU time among multiple processes, creating the_____that many are running at once.
Hint
The processes appear to run together because each receives a portion of processor time.
Answer
illusion
- 9A system call is a request for service that passes control from a process to the_____.
Hint
This software manages the computer's hardware and system resources.
Answer
operating system
- 10While a process waits for a system call to return, it is typically_____and cannot continue past that point.
Hint
The process is stalled until the requested operation finishes.
Answer
blocked
- 11Reading data from a device or writing data to one are common examples of_____.
Hint
These operations request services that the process cannot carry out on its own.
Answer
system calls
- 12A C library function such as computing a square root is generally different from a system call because it does not_____the process.
Hint
Unlike a system call waiting on an operating-system service, the function can proceed within the program.
Answer
block
- 13Switching execution from one process to another is called a_____.
Hint
The operating system changes which process is running.
Answer
context switch
- 14In multiprogramming, a blocked process can hand off control so that_____can run.
Hint
The operating system can use the processor for a different process while the first waits.
Answer
another process
- 15Unlike multiprogramming's handoff when a process is blocked, timesharing divides CPU time among processes_____.
Hint
The CPU's time allocation does not depend only on whether a process is waiting.
Answer
no matter what those processes are doing
- 16Multiprocessing differs from multiprogramming because multiprocessing executes multiple processes_____.
Hint
This describes actual simultaneous execution rather than taking turns on one processor.
Answer
at the same time
- 17On a multicore CPU, each core can run a separate line of processing, enabling_____execution.
Hint
This is actual simultaneous execution, not just the appearance of it.
Answer
true concurrent
- 18A primary duty of the kernel is to provide the_____that decides which work receives CPU time.
Hint
This kernel component allocates processor time.
Answer
scheduler
- 19When concurrent processes share data or resources, unwanted access can create a_____concern.
Hint
Consider whether one process should be able to see another process's sensitive information.
Answer
security
- 20A race condition can occur when multiple operations access the same resource and the result depends on their relative_____.
Hint
The order in which the operations happen affects the outcome.
Answer
timing
- 21In the ATM example, two withdrawals can both read the same account balance before either writes an updated balance, causing a_____.
Hint
The concurrent operations interfere because they act on the same account data.
Answer
race condition
- 22In the ATM example, if two processes each read a balance of 100andeachwithdraws20, the final balance can incorrectly reflect only_____withdrawal.
Hint
One process's write can overwrite the update made by the other.
Answer
one
- 23Race conditions are difficult to detect partly because they may require a rare and specific set of_____.
Hint
The problematic timing and events may not happen in ordinary testing.
Answer
circumstances
- 24A flaw whose output unexpectedly depends critically on the relative timing of events is called a_____.
Hint
This term describes timing-dependent errors in a system or process.
Answer
race condition
- 25The Therac-25 disaster involved a radiation machine used in_____therapy.
Hint
The machine was intended to treat a serious disease with radiation.
Answer
cancer
- 26The Therac-25 system failed to account for operators becoming faster at entering information, allowing them to_____the system.
Hint
The operators' speed exceeded what the software designers had anticipated.
Answer
outrun
- 27In the Therac-25, replacing hardware interlocks with software-only interlocks contributed to serious_____.
Hint
The failure had severe consequences for patients.
Answer
injuries and deaths
- 28When concurrent processes may access a resource and at least one may write to it, the system needs_____.
Hint
The system must regulate which process may use the resource during an update.
Answer
access control
- 29While one process is writing to a protected resource, other processes should not access it for reading or writing until the_____is complete.
Hint
The restriction lasts until the update operation finishes.
Answer
write
- 30A lock grants access to a protected resource only to the process that_____it.
Hint
The process that acquired the lock is the one permitted to use the resource.
Answer
owns
- 31A chat server may need to handle incoming users, receive messages, and send output; a single process can perform only_____of these tasks at a time.
Hint
The example motivates organizing separate lines of execution.
Answer
one
- 32A thread organizes a particular_____that needs to run.
Hint
It describes a sequence of work within a program.
Answer
line of execution
- 33Threads in the same program share the program's_____.
Hint
All of the threads can execute instructions from the same program.
Answer
code
- 34Threads in a process share the_____where dynamically created memory is kept.
Hint
This memory area is distinct from each thread's function-call storage.
Answer
heap
- 35Because threads share data, they can access global variables, including initialized and uninitialized globals, as well as_____.
Hint
These variables have static storage duration.
Answer
statics
- 36Each thread has its own_____for function return information and automatic variables.
Hint
This memory area tracks a thread's active function calls.
Answer
stack
- 37Although each thread has its own stack, threads can also access the_____of other threads.
Hint
The lecture notes that another thread's automatic variables may be visible through shared memory.
Answer
stacks
- 38Thread switches can be faster than process switches because threads share memory that does not need to be_____and loaded again.
Hint
The shared program data can remain in place during a thread switch.
Answer
unloaded
- 39When kernel-level threads run on separate CPU cores at once, they provide_____concurrency.
Hint
Unlike timesharing on a single core, this is actual simultaneous execution.
Answer
true
- 40A process can contain_____threads, each of which can be scheduled to run.
Hint
A process is not limited to a single line of execution.
Answer
multiple
- 41Kernel-level threads are controlled by the kernel and receive CPU time from the_____.
Hint
This kernel component allocates processor time.
Answer
scheduler
- 42User-level threads are implemented inside a process and are not known to the_____.
Hint
The operating system sees the process, not these internal execution paths.
Answer
kernel
- 43Switching between user-level threads is cooperative because the program decides when to switch to a different_____.
Hint
The program manages its own internal execution paths.
Answer
line of execution
- 44User-level threads are sometimes called_____because they do not independently occupy time on the kernel.
Hint
This nickname distinguishes them from threads managed directly by the kernel.
Answer
green threads
- 45Switching user-level threads can be faster than switching kernel threads because it can resemble switching between_____within a program.
Hint
The program changes which internal routine runs without a kernel thread switch.
Answer
function calls
- 46A major disadvantage of user-level threads is that the scheduler can preempt the_____that contains all of them.
Hint
The kernel schedules the process as a whole rather than its internal user threads.
Answer
entire program
- 47If a user-level-thread process makes a blocking system call, the call can block the_____.
Hint
The kernel cannot continue another internal user thread independently.
Answer
entire process
- 48Compared with kernel-level threads, user-level threads are described as more difficult to use and less supported by built-in_____.
Hint
The lecture contrasts their availability with the built-in support for kernel-level threads.
Answer
UNIX libraries
- 49POSIX provides a standard set of interfaces intended to help UNIX-like operating systems_____with one another.
Hint
The standard promotes compatible interfaces across systems.
Answer
interact
- 50The standard API commonly used to write multithreaded applications on UNIX is_____.
Hint
Its name combines the standard's name with the kind of execution paths it supports.
Answer
POSIX threads
- 51In C, the header needed for the POSIX thread API is_____.
Hint
It is the thread library's header file.
Answer
pthread.h
- 52When compiling a program that uses POSIX threads with gcc, the_____option is used to link the thread library.
Hint
This compiler option enables the thread library during compilation and linking.
Answer
-pthread
- 53The first argument to the thread-creation function provides a location where the new thread's_____is written.
Hint
This value identifies the created thread.
Answer
ID
- 54A thread ID is often stored in a structure and is not necessarily a simple, human-readable_____.
Hint
The lecture warns against assuming this identifier is just a number you can print meaningfully.
Answer
integer
- 55The attribute argument to the thread-creation function points to options, which are normally_____.
Hint
The lecture says that programs commonly provide no special options.
Answer
unused
- 56The start routine supplied when creating a thread is a_____that identifies the function where the thread begins.
Hint
It refers to executable code rather than directly calling the function at the creation site.
Answer
function pointer
- 57The final argument to the thread-creation function can pass a value to the start routine, but it accepts only_____argument.
Hint
Multiple values must be bundled together before being passed.
Answer
one
- 58If a thread must receive several values through its single argument, those values can be bundled in a_____.
Hint
This C data type groups multiple fields together.
Answer
struct
- 59The thread can retrieve its own ID by calling_____.
Hint
The function's name indicates that it returns the calling thread's identity.
Answer
pthread_self
- 60In the example program, the work routine uses a void pointer so that its argument can represent_____.
Hint
The pointer type does not specify the particular data type being passed.
Answer
anything
- 61To interpret the example's void-pointer argument as an integer value, the code casts it to an integer pointer and then_____it.
Hint
This operation follows the pointer to access the value it points to.
Answer
dereferences
- 62The example's constant definition for the number of threads is processed by the_____before compilation.
Hint
This stage replaces the defined name with its specified value.
Answer
preprocessor
- 63In the example program, a loop creates five threads with argument values ranging from_____through four.
Hint
The loop begins with the first index used for the threads.
Answer
zero
- 64The example checks whether thread creation succeeded by verifying that the result code is_____.
Hint
The program uses an assertion to check the expected success value.
Answer
zero
- 65The thread-joining function makes the calling thread_____until the specified thread terminates.
Hint
The caller waits rather than continuing immediately.
Answer
block
- 66Although the example joins threads in index order, the order in which they begin and report their work is determined by the_____.
Hint
Scheduling decisions determine when each thread runs.
Answer
operating system
- 67The example's thread output can appear before all threads have been created because the threads are running_____.
Hint
A thread can begin its work while the main thread continues creating others.
Answer
concurrently
- 68A thread can terminate by explicitly calling_____.
Hint
This function lets the currently running thread end itself.
Answer
pthread_exit
- 69A thread also terminates when it reaches the end of its start routine and_____.
Hint
The thread has no more instructions to execute in that function.
Answer
falls off the end
- 70One thread can request the termination of another thread using_____.
Hint
This function is used to cancel a thread externally.
Answer
pthread_cancel
- 71If any thread calls the process-wide exit function,_____.
Hint
The function ends the process rather than only the calling thread.
Answer
all threads die
- 72At the end of a program's main function, returning is generally better style than calling_____.
Hint
This alternative terminates the process directly rather than returning from the function.
Answer
exit
- 73A mutex is short for_____.
Hint
Its name describes restricting access so users exclude one another.
Answer
mutual exclusion
- 74A mutex acts like a variable lock that can protect data or other_____.
Hint
The lock can guard anything the program chooses to protect.
Answer
resources
- 75A mutex can be initialized with the predefined_____.
Hint
This named initializer starts a mutex in its usable state.
Answer
PTHREAD_MUTEX_INITIALIZER
- 76When a mutex is no longer needed, it can be removed with the_____function.
Hint
This operation ends the mutex's lifetime.
Answer
destroy
- 77A thread acquires a mutex by calling the_____function.
Hint
Acquiring this prevents other attempts from proceeding while the mutex is held.
Answer
lock
- 78If a thread tries to lock a mutex that is already locked, that attempt will_____.
Hint
The thread cannot continue until the lock becomes available.
Answer
block
- 79The thread that previously acquired a mutex releases it by calling the_____function.
Hint
This operation makes the mutex available again.
Answer
unlock
- 80A nonblocking attempt to determine whether a mutex is already locked uses the_____function.
Hint
Its name indicates that the thread tries to acquire the lock without waiting.
Answer
trylock
- 81A counting semaphore can track a quantity such as the number of available buffers, open files, or established_____.
Hint
This example refers to links between endpoints that may be active at once.
Answer
connections
- 82A binary semaphore has two possible states; for a mutex, these are_____.
Hint
The states describe whether the protected resource is currently claimed.
Answer
locked or unlocked
- 83The concept of semaphores is credited to Edsger_____.
Hint
He was a Dutch computer scientist associated with the early development of semaphores.
Answer
Dijkstra

Ask anything
We've read this whole study set, so questions about it get the best answers.