Podcast
Questions and Answers
What is the primary responsibility of an operating system concerning processes?
What is the primary responsibility of an operating system concerning processes?
- Designing new applications.
- Memory allocation only.
- Ensuring all background processes run at the same priority.
- Controlling process execution, including interleaving and resource allocation. (correct)
How does the OS determine the order in which processes should be executed?
How does the OS determine the order in which processes should be executed?
- By randomly assigning execution time.
- By considering interleaving pattern and allocating resources. (correct)
- By assigning processes to users.
- By using virtual memory allocation.
What happens to a process when it is interrupted?
What happens to a process when it is interrupted?
- It is immediately terminated.
- It is given new resources.
- It proceeds to execute.
- It is transferred to the queue of waiting process. (correct)
What is the initial state of a process when the OS creates it?
What is the initial state of a process when the OS creates it?
What is required for the OS to manage processes effectively?
What is required for the OS to manage processes effectively?
What is the purpose of an identifier in the context of processes?
What is the purpose of an identifier in the context of processes?
Which of the following is included in I/O status information?
Which of the following is included in I/O status information?
In what state do processes exist, known to the OS, waiting to execute?
In what state do processes exist, known to the OS, waiting to execute?
What is a 'trace' of a process?
What is a 'trace' of a process?
What is the role of the dispatcher?
What is the role of the dispatcher?
What is process spawning?
What is process spawning?
In a five-state process model, if a process is waiting for an I/O operation to complete, what state would it be in?
In a five-state process model, if a process is waiting for an I/O operation to complete, what state would it be in?
The physical processor is switched among multiple applications so all will appear to be progressing. What concept does this describe?
The physical processor is switched among multiple applications so all will appear to be progressing. What concept does this describe?
Why is the New state useful in process management?
Why is the New state useful in process management?
What is the difference between the Ready and Ready/Suspend states?
What is the difference between the Ready and Ready/Suspend states?
Why does the OS prefer to suspend a blocked process rather than a ready process?
Why does the OS prefer to suspend a blocked process rather than a ready process?
Consider all this information, what describes a process control block?
Consider all this information, what describes a process control block?
What is the key distinction between kernel mode and user mode?
What is the key distinction between kernel mode and user mode?
What would describe the circumstances where an operating system routine is executed?
What would describe the circumstances where an operating system routine is executed?
Which action is not part of the steps involved in creating a process?
Which action is not part of the steps involved in creating a process?
Which action should the interrupt handler perform?
Which action should the interrupt handler perform?
Why is memory management a critical aspect of Operating System control?
Why is memory management a critical aspect of Operating System control?
How does the processor determine what to do after an error that is found with a trap?
How does the processor determine what to do after an error that is found with a trap?
What tables might be needed to control a process?
What tables might be needed to control a process?
Which of the following is NOT a typical reason for process termination?
Which of the following is NOT a typical reason for process termination?
What is the relationship of a parent process and child process, with process spawning?
What is the relationship of a parent process and child process, with process spawning?
The set of all processes that make up the current operating system describes which...
The set of all processes that make up the current operating system describes which...
Which of the following is NOT provided by memory tables?
Which of the following is NOT provided by memory tables?
When viewing source code, what would identify a memory page that is part of the kernel?
When viewing source code, what would identify a memory page that is part of the kernel?
What is the key purpose of including suspension in a state diagram?
What is the key purpose of including suspension in a state diagram?
When the operating system creates tables on initialization, what determines the structure of the table?
When the operating system creates tables on initialization, what determines the structure of the table?
When a process spawns another process with process spawning, how do you identify a parent process versus a child process?
When a process spawns another process with process spawning, how do you identify a parent process versus a child process?
When is the process in a Ready State?
When is the process in a Ready State?
In a two state process model, what happens when a running state has been interrupted?
In a two state process model, what happens when a running state has been interrupted?
What is a parent termination?
What is a parent termination?
After a process terminates, why might it be preserved by the OS?
After a process terminates, why might it be preserved by the OS?
Flashcards
Operating System (OS)
Operating System (OS)
A layer of software between applications and computer hardware. It provides a feature-rich, secure and consistent interface.
Process
Process
An instance of a program running that can be assigned to and executed on a processor.
Essential Elements of a Process
Essential Elements of a Process
Program code that may be shared and a set of data associated with that code
Process Control Block (PCB)
Process Control Block (PCB)
Signup and view all the flashcards
Process Identifier
Process Identifier
Signup and view all the flashcards
Process Priority
Process Priority
Signup and view all the flashcards
Program Counter
Program Counter
Signup and view all the flashcards
Context Data
Context Data
Signup and view all the flashcards
Trace of a Process
Trace of a Process
Signup and view all the flashcards
Two-State Process Model
Two-State Process Model
Signup and view all the flashcards
Ready State
Ready State
Signup and view all the flashcards
Blocked/Waiting State
Blocked/Waiting State
Signup and view all the flashcards
New State
New State
Signup and view all the flashcards
Exit State
Exit State
Signup and view all the flashcards
Suspend State
Suspend State
Signup and view all the flashcards
Blocked/Suspend
Blocked/Suspend
Signup and view all the flashcards
Ready/Suspend
Ready/Suspend
Signup and view all the flashcards
Process Swapping
Process Swapping
Signup and view all the flashcards
Memory Tables
Memory Tables
Signup and view all the flashcards
I/O Tables
I/O Tables
Signup and view all the flashcards
Process Control Block
Process Control Block
Signup and view all the flashcards
User Mode
User Mode
Signup and view all the flashcards
Kernel Mode
Kernel Mode
Signup and view all the flashcards
Process Switching
Process Switching
Signup and view all the flashcards
Trap
Trap
Signup and view all the flashcards
Interrupt stage
Interrupt stage
Signup and view all the flashcards
Nonprocess Kernel
Nonprocess Kernel
Signup and view all the flashcards
Execution within User Processes
Execution within User Processes
Signup and view all the flashcards
Preempted (UNIX)
Preempted (UNIX)
Signup and view all the flashcards
UNIX Process 0
UNIX Process 0
Signup and view all the flashcards
UNIX Process 1 init
UNIX Process 1 init
Signup and view all the flashcards
User-level context
User-level context
Signup and view all the flashcards
Register context
Register context
Signup and view all the flashcards
System-level context
System-level context
Signup and view all the flashcards
Study Notes
- This chapter examines advanced concepts related to process management
- The original concept of a process has two components: resources and execution
- Operating systems are developing a construct known as a thread to address the two components
Processes and Threads
- A process is a unit of resource allocation as well as a unit of protection
- A process has a virtual address space for the process image
- Processes are protected to prevent interference with resources, which can include; processors, other processes (for interprocess communication), files, and I/O resources
- The execution of a process follows an execution path
- A process has an execution state; Running, Ready etc
- A process also has a dispatching priority that the OS can schedule if needed
- A thread is the unit of dispatching
- The unit of resource ownership is a process or task
Multithreading
- An operating system’s ability to support multiple, concurrent paths of execution within a single process
- A single thread of execution per process is a single-threaded approach
- A Java run-time environment uses one process with multiple threads
- Windows and Solaris use multiple processes that support multiple threads
Multithreaded Environment
-
Processes are the unit of resource allocation and a unit of protection
-
Processes have a virtual address space that holds the process image
-
Processes have access to processors, other processes (for interprocess communication), files, I/O resources
-
Threads exist within a process
-
Threads have an execution state (Running, Ready, etc.)
-
When threads are not running, their context is saved
-
Threads have an execution stack
-
Some per-thread static storage for local variables
-
Threads have access to the memory and resources of its process, which is shared with all other threads in that process
-
It takes less time to create/terminate a thread than a process
-
It takes less time to switch between two threads within a process than to switch between processes
-
Threads enhance efficiency in communication between different executing programs
-
The kernel intervenes to provide protection and mechanisms for communication between independent processes
-
Threads within the same process share memory and files, therefore they can communicate without the kernel
Thread States and Operations
-
Key states for a thread are Running, Ready, and Blocked
-
There are no Suspend states with threads
-
Basic thread operations that cause a change in state consist of the following,
-
Spawn: New process spawns a thread for that process
-
Block: Thread waits for event
-
Unblock: Event for which a thread is blocked occurs
-
Finish: Thread completes; register context and stacks are deallocated
Remote Procedure Call (RPC)
- Remote procedure calls (RPCs) to two different hosts is used to get a combined result
- Without threads, results are obtained in sequence; program waits for response from each server
- With threads, requests processed with substantial speedup
Thread Synchronization
- Threads of a process share the same address space and other resources like open files
- Any alteration of a resource by one thread affects the environment of the other threads in the same process
- The activities of the various threads synchronize so they don't interfere with each other or corrupt data structures
Types of Threads: User-Level Threads
- The two categories of thread implementation include: User-level threads (ULTs) and kernel-level threads (KLTs)
- All of the work of thread management is done by the application using a ULT
- The kernel isn't aware of the existence of threads
ULT Advantages
- Thread switching doesn’t require kernel mode privileges
- Scheduling can be application-specific
- ULTs can run on any OS
ULT Disadvantages
- Many system calls are blocking, which blocks the entire process
- Multithreaded applications cannot take advantage of multiprocessing
- A kernel assigns one process to only one processor at a time
Kernel-Level Threads (KLTs)
- All of the work of thread management is done by the kernel; uses an application programming interface (API) to the kernel thread facility
KLT Advantages
- Kernel can schedule multiple threads from the same process on multiple processors
- If one thread in a process is blocked, the kernel can schedule another thread of the same process
- Kernel routines are multithreaded too
KLT Disadvantage
- Requires a mode switch to the kernel to transfer control from one thread to another within the same process, which can be slow
Combined ULT/KLT Approaches
- Provide a combined ULT/KLT facility
- Thread creation completed in user space as well as scheduling and synchronization of threads
- The application maps multiple ULTs onto some number of KLTs
- The programmer adjusts the number of KLTs for a particular application to achieve the best overall results
- Multiple threads can run in parallel on multiple processors
- A system call need not block the entire process
- Minimizes the disadvantages of all approaches
Relationships Between Threads and Processes
- Traditional OS had 1:1 relationship between thread and process
- Other systems include:
- M:1: Processes an address space and dynamic resource ownership, multiple threads may be created and executed there
- 1:M: The thread may migrate from one process environment to another, allowing the thread to be easily moved to distinct systems
- M:N: Combines attributes of M:1 and 1:M cases
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.