OS Organization Chapter 4 Threads W. Stallings book

  1. What are the two characteristics of Processes?
    • Resource ownership
    • Scheduling/execution

    These two characteristics are treated independently by the operating system
  2. What is Multithreading?
    Multithreading refers to the ability of an OS to support multiple, concurrent paths of execution within a single process.
  3. Characteristics of Processes: Resource ownership define:
    A process includes a virtual address space to hold the process image
  4. Characteristics of Processes:Scheduling/ execution define:
    A process follows an execution path that may be interleaved with other processes
  5. The unit of dispatching is referred to as a _?_or _?_ process
    thread or lightweight process
  6. The unit of resource ownership is referred to as a _?_ or _?_.
    The unit of resource ownership is referred to as a process or task.
  7. What is meant by a Single Threaded approach?
    • Single Threaded approach: The traditional approach of a single thread of
    • execution per process, in which the concept of a thread is not recognized
  8. Define Multithreading:
    The ability of an OS to support multiple, concurrent paths of execution within a single process
  9. _?_ supports a single user process and a single thread.
    MS-DOS supports a single user process and a single thread. --> A type of Single Thread Approach
  10. _?_ supports a single user process and a single thread.
    Some UNIX, support multiple user processes but only support one thread per process. --> A type of Single Thread Approach
  11. Multithreading
    Java run-time environment is a _?_ process with _?_ threads
    • Java run-time environment is a single process with multiple threads --> Multithreading
  12. Processes:
    Define the term process in the context of a multithreaded environment.
    In a multithreaded environment, a process is defined as the unit of resource allocation and a unit of protection.
  13. One or More Threads in Process: Each thread has:
    • –An execution state (running, ready, etc.)
    • –Saved thread context when not running
    • –An execution stack
    • –Some per-thread static storage for local variables–Access to the memory and resources of its process (all threads of a process share this)
  14. The key states for a thread are:
    • Running
    • Ready
    • Blocked
  15. Thread operations associated with a change in thread state are:
    • Spawn
    • Block
    • Unblock
    • Finish
  16. Threads vs. processes:

    Name some differences (organizationally) between threads (multithreaded process model) and processes (single threaded process model).
    Threads:

    Each thread has its own:

    • Control Block
    • Kernel Stack
    • User Stack

    Each thread shares:

    • User Address Space
    • Process Control Block

    Thus all of the threads of a process share the state and resources of that process.

    Process:

    Has its own:

    • User Stack
    • Kernel Stack
    • Process Control Block
    • User Address Space

    Processes do not share stuff like the threads do.
  17. Benefits of Threads (list some):
    • Takes less time to create a new thread than a new process.
    • Less time to terminate a thread than a process
    • Switching between two threads takes less time that switching processes
    • Threads can communicate with each other --without invoking the kernel
  18. Takes less time to create a new thread than a process
    • Less time to terminate a thread than a process
    • Switching between two threads takes less time that switching processes
    • Threads can communicate with each other -–without invoking the kernel
  19. Thread use in a Single-User System:
          Foreground and background work:
    Example: spreadsheet application:
    • one thread looking after display
    • another thread updating results of formula
  20. Thread use in a Single-User System:
           Asynchronous processing:
    Example:

    E.G. protection against power failure within a word processor,

    • A thread writes random access memory (RAM) buffer to disk once every minute.
    • this thread schedules itself directly with the OS;
    • no need for fancy code in the main program to provide for time checks or to coordinate input and output.
  21. Thread use in a Single-User System:
        Speed of execution:
    Example:
    • One thread can compute one batch of data while another thread is reading the next batch from a device.
    • On a multiprocessor system, multiple threads from the same process may be able to execute simultaneously.
    • Even though one thread may be blocked for an I/O operation to read in a batch of data, another thread may be executing.
  22. In what ways are thread activities similar to process activities?
    Threads have execution states and may synchronize with one another.
  23. What is Symmetric Multiprocessing or SMP?
    • The threads of any process, including those of the executive, can run on any processor.
    • In the absence of affinity restrictions, the microkernel assigns a ready thread to the next available processor.
    • But an application can restrict affinity
  24. In the context of Symmetric Multiprocessing, what is Soft Affinity?
    In Symmetric Multiprocessing, the dispatcher tries to assign a ready thread to the same processor it last ran on.
  25. User-mode scheduling (UMS)
    a lightweight mechanism that applications can use to schedule their own threads.
  26. In the context of Symmetric Multiprocessing, what is Hard Affinity?
    In Symmetric Multiprocessing, an application restricts thread execution to certain processors
  27. What is the advantage of Soft Affinity?
    helps reuse data still in that processor’s memory caches from the previous execution of the thread.
  28. User-level threads: created and managed by a __?__ that runs in the user space of  a process
    threads library
  29. User-level threads: a __?__ is not required to switch from one thread to another
    mode switch
  30. User-level threads: only a  __?__  within a process can execute at a time
    single user-level thread
  31. User-level threads: if one thread blocks, the __?___ is blocked
    entire process
  32. Kernel-level threads: threads within a __?___  that are maintained by the kernel.
    process
  33. Kernel-level threads: a __?__ is required to switch from one thread to another
    mode switch
  34. Kernel-level threads: blocking of  a thread  ___?__ block the entire process.
    does not
  35. Kernel-level threads: __?__ within the same process can execute in parallel on a multiprocessor.
    multiple threads
  36. Windows 8 Process and Thread Management:  __?__ is a lightweight mechanism that applications can use to schedule their own threads.
    User-mode scheduling (UMS)
  37. Windows 8 Process and Thread Management: An __?__ consists of one or more processes.
    application
  38. Windows 8 Process and Thread Management: Each process provides the __?__ needed to execute a program
    resources
  39. Windows 8 Process and Thread Management: A __?__  is the entity within a process that can be scheduled for execution
    thread
  40. Windows 8 Process and Thread Management: A __?__ allows groups of process to be managed as a unit
    job object
  41. Windows 8 Process and Thread Management: A __?__ is a collection of worker threads that efficiently execute asynchronous callbacks on behalf of the application
    thread pool
  42. Windows 8 Process and Thread Management: A __?__ is a unit of execution that must be manually scheduled by the application
    fiber
  43. Windows 8 Changes from previous Windows versions: Developers are now responsible for_____?_____  of their individual applications
    managing the state
  44. Windows 8 Changes from previous Windows versions: In the new__?__  interface Windows 8 takes over the process lifecycle of an application
    Metro
  45. Windows 8 takes over the___?___ of an application
    process lifecycle
  46. Windows 8:  A limited number of __(1)__ can run alongside the main app in the Metro UI using the ___(2)___ functionality
    • (1) applications
    • (2) SnapView
  47. Windows 8: only one ___?___ can run at one time
    Store application
  48. Live Tiles give the appearance of  applications constantly running on the system, but in reality:
    they receive push notifications and do not use system resources to display the dynamic content offered
  49. Windows 8: Foreground application in the Metro interface has access to all of  the: _?_, _?_, _?_ available to the user
    processor, network, and disk resources
  50. Windows 8: When an app enters a  ___?___, an event should be triggered to store the state of the user’s information
    suspended mode
  51. In Windows 8, When an application enters a suspended mode the responsibility for the event to be triggered to store the state of the user's info?
    the application developer
  52. Windows 8 may terminate a background app
    --you need to __?__ when it’s suspended, in case Windows terminates it so that you can restore its state later
     save your app’s state
  53. Windows 8 may terminate a background app --when the app returns to the foreground another event is triggered to
    obtain the user state from memory
  54. In Windows 8: Background apps only receive _?_ processor second per processor hour
    1
  55. Windows 8: Process and services are implemented as __?__
    objects
  56. Windows 8: Process and services are created as a new__?__ or a copy of an existing __?__
    process
  57. Windows 8: Process and services -- an executable process may contain one or more _?_
    threads
  58. Windows 8: Process and services --both processes and thread objects have built-in _?__ capabilities
    synchronization
  59. Windows makes use of two types of process-related objects
    • Processes: Process object
    • Threads: Thread object
  60. Windows: process-related objects:Process:
    an entity corresponding to a user job or application that owns resources
  61. Windows: process-related objects:Thread:
    • a dispatchable unit of work
    • that executes sequentially
    • is interruptible
  62. Process Object: Windows 8: Object Body Attributes:
    • Process ID
    • Security Descriptor
    • Base priority
    • Default proecessor affinity
    • Quota limits
    • Excution time
    • I/O Counter
    • VM operation counters
    • Execption/debugging ports
    • Exit Status
  63. Process Object: Windows 8: Services:
    • Create process
    • Open process
    • Query process information
    • Set process information
    • Current process
    • Terminate process
  64. Thread Object: Windows 8: Thread Object Body Attributes:
    • Thread ID
    • Thread conxtext
    • Dynaic priotiry
    • Base priority
    • Thread processor affinity
    • Thread execution time
    • Alert status
    • Suspension count
    • Impersonation token
    • Termination port
    • Thread exit status
  65. Thread Object: Windows 8: Thread Object Services:
    • Create thread
    • Open thread
    • Query thread information
    • Set threa information
    • Current thread
    • Terminate thread
    • Get context
    • Set context
    • Suspend
    • Resume
    • Alert thread
    • Test thread alert
    • Register termination port
  66. Multithreaded Process: Achieves concurrency without ___?____.
    the overhead of using multiple processes
  67. Multithreaded Process: Threads within the same process can exchange information through their ____?____
    common address space
  68. Multithreaded Process: Threads within the same process have access to the ___?___ of the process
    shared resources
  69. Multithreaded Process:Threads in different processes can exchange information through __?__ that has been set up between the two processes
    shared memory
  70. Unix Solaris Process: makes use of four thread-related concepts:
    • Process
    • User-level Threads
    • Lightweight Processes (LWP)
    • Kernel Threads
  71. Unix Solaris Process: thread-related concepts:Process concept:
    includes the user’s address space, stack, and process control block
  72. Unix Solaris Process: thread-related concepts: User-level Threads concept:
    a user-created unit of execution within a process
  73. Unix Solaris Process: thread-related concepts:Light Weight Processes (LWP)
    mapping between ULTs and kernel threads
  74. Unix Solaris Process: thread-related concepts: Kernel Threads
    fundamental entities that can be scheduled and dispatched to run on one of the system processors
  75. Process and Threads in Solaris:
    Image Upload 2
  76. Difference between Unix and Solaris Unix:
    • Reg. Unix had Process ID, User IDs, Signal Dispatch Table, Memory Map, File Descriptors, and Processor State.
    • Solaris Unix has this plus the Light Weight Process mapping.
  77. SOLARIS UNIX: A Lightweight Process (LWP) Data Structure Includes:
    • An LWP identifier
    • The priority of this LWP
    • A signal mask
    • Saved values of user-level registers
    • The kernel stack for this LWP
    • Resource usage and profiling data
    • Pointer to the corresponding kernel thread
    • Pointer to the process structure
  78. KLT and ULT: What OS is an example of a combined approach?
    Solaris
  79. KLT and ULT: In the Solaris (UNIX) OS: Thread creation is done in the __?__.
    user space
  80. KLT and ULT: In the Solaris (UNIX) OS:Bulk of scheduling and synchronization of threads is by __?__
    the application
  81. KLT and ULT: In the Solaris (UNIX) OS:Bulk of scheduling and synchronization of threads is by __?__
    the application
  82. User Level Thread (ULT): All thread management is done by ___?___
    the application
  83. User Level Thread (ULT):The __?__ is not aware of the existence of threads
    kernel
  84. User Level Thread (ULT):Kernel only knows about __?__.
    processes
  85. User Level Thread (ULT): Each user process manages its own __?__
    private thread table
  86. Image Upload 4
    Image Upload 6
  87. User Level Thread (ULT): Thread switching does not require _?_  _?_ privileges.
    kernel mode
  88. User Level Thread (ULT): Scheduling can be __?__specific
    application
  89. User Level Thread (ULT): ULTs can run on any __?__
    OS
  90. ULT Disadvantages: In a typical OS many system calls are blocking as a result:
    when a ULT executes a system call, not only is that thread blocked, but all of the threads within the process are blocked
  91. ULT Disadvantages: In a pure ULT strategy, a multithreaded application cannot take advantage of___?___
    multiprocessing (multi-processor or multi-core
  92. Overcoming ULT Disadvantages: Jacketing
    converts a blocking system call into a non-blocking system call
  93. Overcoming ULT Disadvantages: Writing an application as...
    multiple processes rather than multiple threads
  94. Kernel-Level Threads (KLTs): Thread management is done by the __?__
    kernel
  95. Kernel-Level Threads (KLTs): no thread management is done by the __?__
    application
  96. Kernel-Level Threads (KLTs):Creating and destroying threads are __?___
    system calls
  97. Kernel-Level Threads (KLTs): Kernel maintains context information for the __?__ and the __?__.
    process and the threads
  98. Kernel-Level Threads (KLTs): __?__ is an example of this approach.
    MS Windows
  99. Advantages of KLTs: The kernel can simultaneously schedule:
    multiple threads from the same process on multiple processors 
  100. Advantages of KLTs: If one thread in a process is blocked, the kernel can __?__
    schedule another thread of the same process.
  101. Advantages of KLTs: Kernel routines can be __?__
    multithreaded
  102. Disadvantages of KLT: The transfer of control from one thread to another within the same process requires a __?__ to the kernel
    mode switch
Author
geschw66
ID
317031
Card Set
OS Organization Chapter 4 Threads W. Stallings book
Description
CSE442s Flash cards from the spring class. CSE 422s: Operating System Organization
Updated