1. Home
  2. Explore
  3. Computer Science
  4. Concurrency in Operating Systems

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Concurrency in Operating Systems

  • 83Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Concurrency Models
In operating systems, concurrency informally means doing multiple things
.

83 questions

  1. 1
    In operating systems, concurrency informally means doing multiple things
    _____
    .
    Hint

    Think about when separate activities overlap in execution.

    Answer

    at the same time

  2. 2
    A 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

  3. 3
    On UNIX, multiple processes can run
    _____
    .
    Hint

    The operating system can run more than one process during the same period.

    Answer

    simultaneously

  4. 4
    On UNIX, multiple
    _____
    of the same program can run at once.
    Hint

    Each running instance is a separate execution of the program.

    Answer

    copies

  5. 5
    The CPU's available time and processing capacity can be
    _____
    among running processes.
    Hint

    The operating system distributes access to the processor.

    Answer

    shared

  6. 6
    When one process is waiting for input or output, another process can use the
    _____
    .
    Hint

    It is the processor that executes instructions.

    Answer

    CPU

  7. 7
    Multiprogramming 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

  8. 8
    Timesharing 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

  9. 9
    A 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

  10. 10
    While 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

  11. 11
    Reading 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

  12. 12
    A 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

  13. 13
    Switching execution from one process to another is called a
    _____
    .
    Hint

    The operating system changes which process is running.

    Answer

    context switch

  14. 14
    In 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

  15. 15
    Unlike 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

  16. 16
    Multiprocessing 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

  17. 17
    On 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

  18. 18
    A 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

  19. 19
    When 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

  20. 20
    A 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

  21. 21
    In 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

  22. 22
    In the ATM example, if two processes each read a balance of 100andeachwithdraws100 and each withdraws 100andeachwithdraws20, the final balance can incorrectly reflect only
    _____
    withdrawal.
    Hint

    One process's write can overwrite the update made by the other.

    Answer

    one

  23. 23
    Race 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

  24. 24
    A 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

  25. 25
    The Therac-25 disaster involved a radiation machine used in
    _____
    therapy.
    Hint

    The machine was intended to treat a serious disease with radiation.

    Answer

    cancer

  26. 26
    The 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

  27. 27
    In 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

  28. 28
    When 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

  29. 29
    While 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

  30. 30
    A 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

  31. 31
    A 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

  32. 32
    A thread organizes a particular
    _____
    that needs to run.
    Hint

    It describes a sequence of work within a program.

    Answer

    line of execution

  33. 33
    Threads in the same program share the program's
    _____
    .
    Hint

    All of the threads can execute instructions from the same program.

    Answer

    code

  34. 34
    Threads 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

  35. 35
    Because 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

  36. 36
    Each thread has its own
    _____
    for function return information and automatic variables.
    Hint

    This memory area tracks a thread's active function calls.

    Answer

    stack

  37. 37
    Although 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

  38. 38
    Thread 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

  39. 39
    When 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

  40. 40
    A 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

  41. 41
    Kernel-level threads are controlled by the kernel and receive CPU time from the
    _____
    .
    Hint

    This kernel component allocates processor time.

    Answer

    scheduler

  42. 42
    User-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

  43. 43
    Switching 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

  44. 44
    User-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

  45. 45
    Switching 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

  46. 46
    A 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

  47. 47
    If 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

  48. 48
    Compared 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

  49. 49
    POSIX 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

  50. 50
    The 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

  51. 51
    In C, the header needed for the POSIX thread API is
    _____
    .
    Hint

    It is the thread library's header file.

    Answer

    pthread.h

  52. 52
    When 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

  53. 53
    The 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

  54. 54
    A 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

  55. 55
    The 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

  56. 56
    The 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

  57. 57
    The 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

  58. 58
    If 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

  59. 59
    The 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

  60. 60
    In 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

  61. 61
    To 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

  62. 62
    The 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

  63. 63
    In 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

  64. 64
    The 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

  65. 65
    The thread-joining function makes the calling thread
    _____
    until the specified thread terminates.
    Hint

    The caller waits rather than continuing immediately.

    Answer

    block

  66. 66
    Although 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

  67. 67
    The 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

  68. 68
    A thread can terminate by explicitly calling
    _____
    .
    Hint

    This function lets the currently running thread end itself.

    Answer

    pthread_exit

  69. 69
    A 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

  70. 70
    One thread can request the termination of another thread using
    _____
    .
    Hint

    This function is used to cancel a thread externally.

    Answer

    pthread_cancel

  71. 71
    If any thread calls the process-wide exit function,
    _____
    .
    Hint

    The function ends the process rather than only the calling thread.

    Answer

    all threads die

  72. 72
    At 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

  73. 73
    A mutex is short for
    _____
    .
    Hint

    Its name describes restricting access so users exclude one another.

    Answer

    mutual exclusion

  74. 74
    A 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

  75. 75
    A mutex can be initialized with the predefined
    _____
    .
    Hint

    This named initializer starts a mutex in its usable state.

    Answer

    PTHREAD_MUTEX_INITIALIZER

  76. 76
    When a mutex is no longer needed, it can be removed with the
    _____
    function.
    Hint

    This operation ends the mutex's lifetime.

    Answer

    destroy

  77. 77
    A thread acquires a mutex by calling the
    _____
    function.
    Hint

    Acquiring this prevents other attempts from proceeding while the mutex is held.

    Answer

    lock

  78. 78
    If 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

  79. 79
    The thread that previously acquired a mutex releases it by calling the
    _____
    function.
    Hint

    This operation makes the mutex available again.

    Answer

    unlock

  80. 80
    A 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

  81. 81
    A 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

  82. 82
    A 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

  83. 83
    The concept of semaphores is credited to Edsger
    _____
    .
    Hint

    He was a Dutch computer scientist associated with the early development of semaphores.

    Answer

    Dijkstra

1 of 83
Question 1 of 83

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent