-
What are the two characteristics of Processes?
- Resource ownership
- Scheduling/execution
These two characteristics are treated independently by the operating system
-
What is Multithreading?
Multithreading refers to the ability of an OS to support multiple, concurrent paths of execution within a single process.
-
Characteristics of Processes: Resource ownership define:
A process includes a virtual address space to hold the process image
-
Characteristics of Processes:Scheduling/ execution define:
A process follows an execution path that may be interleaved with other processes
-
The unit of dispatching is referred to as a _?_or _?_ process
thread or lightweight process
-
The unit of resource ownership is referred to as a _?_ or _?_.
The unit of resource ownership is referred to as a process or task.
-
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
-
Define Multithreading:
The ability of an OS to support multiple, concurrent paths of execution within a single process
-
_?_ 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
-
_?_ 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
-
Multithreading:
Java run-time environment is a _?_ process with _?_ threads
- Java run-time environment is a single process with multiple threads --> Multithreading
-
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.
-
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)
-
The key states for a thread are:
-
Thread operations associated with a change in thread state are:
-
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.
-
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
-
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
-
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
-
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.
-
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.
-
In what ways are thread activities similar to process activities?
Threads have execution states and may synchronize with one another.
-
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
-
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.
-
User-mode scheduling (UMS)
a lightweight mechanism that applications can use to schedule their own threads.
-
In the context of Symmetric Multiprocessing, what is Hard Affinity?
In Symmetric Multiprocessing, an application restricts thread execution to certain processors
-
What is the advantage of Soft Affinity?
helps reuse data still in that processor’s memory caches from the previous execution of the thread.
-
User-level threads: created and managed by a __?__ that runs in the user space of a process
threads library
-
User-level threads: a __?__ is not required to switch from one thread to another
mode switch
-
User-level threads: only a __?__ within a process can execute at a time
single user-level thread
-
User-level threads: if one thread blocks, the __?___ is blocked
entire process
-
Kernel-level threads: threads within a __?___ that are maintained by the kernel.
process
-
Kernel-level threads: a __?__ is required to switch from one thread to another
mode switch
-
Kernel-level threads: blocking of a thread ___?__ block the entire process.
does not
-
Kernel-level threads: __?__ within the same process can execute in parallel on a multiprocessor.
multiple threads
-
Windows 8 Process and Thread Management: __?__ is a lightweight mechanism that applications can use to schedule their own threads.
User-mode scheduling (UMS)
-
Windows 8 Process and Thread Management: An __?__ consists of one or more processes.
application
-
Windows 8 Process and Thread Management: Each process provides the __?__ needed to execute a program
resources
-
Windows 8 Process and Thread Management: A __?__ is the entity within a process that can be scheduled for execution
thread
-
Windows 8 Process and Thread Management: A __?__ allows groups of process to be managed as a unit
job object
-
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
-
Windows 8 Process and Thread Management: A __?__ is a unit of execution that must be manually scheduled by the application
fiber
-
Windows 8 Changes from previous Windows versions: Developers are now responsible for_____?_____ of their individual applications
managing the state
-
Windows 8 Changes from previous Windows versions: In the new__?__ interface Windows 8 takes over the process lifecycle of an application
Metro
-
Windows 8 takes over the___?___ of an application
process lifecycle
-
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
-
Windows 8: only one ___?___ can run at one time
Store application
-
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
-
Windows 8: Foreground application in the Metro interface has access to all of the: _?_, _?_, _?_ available to the user
processor, network, and disk resources
-
Windows 8: When an app enters a ___?___, an event should be triggered to store the state of the user’s information
suspended mode
-
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
-
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
-
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
-
In Windows 8: Background apps only receive _?_ processor second per processor hour
1
-
Windows 8: Process and services are implemented as __?__
objects
-
Windows 8: Process and services are created as a new__?__ or a copy of an existing __?__
process
-
Windows 8: Process and services -- an executable process may contain one or more _?_
threads
-
Windows 8: Process and services --both processes and thread objects have built-in _?__ capabilities
synchronization
-
Windows makes use of two types of process-related objects
- Processes: Process object
- Threads: Thread object
-
Windows: process-related objects:Process:
an entity corresponding to a user job or application that owns resources
-
Windows: process-related objects:Thread:
- a dispatchable unit of work that executes sequentially
- is interruptible
-
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
-
Process Object: Windows 8: Services:
- Create process
- Open process
- Query process information
- Set process information
- Current process
- Terminate process
-
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
-
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
-
Multithreaded Process: Achieves concurrency without ___?____.
the overhead of using multiple processes
-
Multithreaded Process: Threads within the same process can exchange information through their ____?____
common address space
-
Multithreaded Process: Threads within the same process have access to the ___?___ of the process
shared resources
-
Multithreaded Process:Threads in different processes can exchange information through __?__ that has been set up between the two processes
shared memory
-
Unix Solaris Process: makes use of four thread-related concepts:
- Process
- User-level Threads
- Lightweight Processes (LWP)
- Kernel Threads
-
Unix Solaris Process: thread-related concepts:Process concept:
includes the user’s address space, stack, and process control block
-
Unix Solaris Process: thread-related concepts: User-level Threads concept:
a user-created unit of execution within a process
-
Unix Solaris Process: thread-related concepts:Light Weight Processes (LWP)
mapping between ULTs and kernel threads
-
Unix Solaris Process: thread-related concepts: Kernel Threads
fundamental entities that can be scheduled and dispatched to run on one of the system processors
-
Process and Threads in Solaris:
-
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.
-
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
-
KLT and ULT: What OS is an example of a combined approach?
Solaris
-
KLT and ULT: In the Solaris (UNIX) OS: Thread creation is done in the __?__.
user space
-
KLT and ULT: In the Solaris (UNIX) OS:Bulk of scheduling and synchronization of threads is by __?__
the application
-
KLT and ULT: In the Solaris (UNIX) OS:Bulk of scheduling and synchronization of threads is by __?__
the application
-
User Level Thread (ULT): All thread management is done by ___?___
the application
-
User Level Thread (ULT):The __?__ is not aware of the existence of threads
kernel
-
User Level Thread (ULT):Kernel only knows about __?__.
processes
-
User Level Thread (ULT): Each user process manages its own __?__
private thread table
-
-
User Level Thread (ULT): Thread switching does not require _?_ _?_ privileges.
kernel mode
-
User Level Thread (ULT): Scheduling can be __?__specific
application
-
User Level Thread (ULT): ULTs can run on any __?__
OS
-
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
-
ULT Disadvantages: In a pure ULT strategy, a multithreaded application cannot take advantage of___?___
multiprocessing (multi-processor or multi-core
-
Overcoming ULT Disadvantages: Jacketing
converts a blocking system call into a non-blocking system call
-
Overcoming ULT Disadvantages: Writing an application as...
multiple processes rather than multiple threads
-
Kernel-Level Threads (KLTs): Thread management is done by the __?__
kernel
-
Kernel-Level Threads (KLTs): no thread management is done by the __?__
application
-
Kernel-Level Threads (KLTs):Creating and destroying threads are __?___
system calls
-
Kernel-Level Threads (KLTs): Kernel maintains context information for the __?__ and the __?__.
process and the threads
-
Kernel-Level Threads (KLTs): __?__ is an example of this approach.
MS Windows
-
Advantages of KLTs: The kernel can simultaneously schedule:
multiple threads from the same process on multiple processors
-
Advantages of KLTs: If one thread in a process is blocked, the kernel can __?__
schedule another thread of the same process.
-
Advantages of KLTs: Kernel routines can be __?__
multithreaded
-
Disadvantages of KLT: The transfer of control from one thread to another within the same process requires a __?__ to the kernel
mode switch
|
|