Operating System Process (PPT 2) Flashcards
What is a process?
It is a program in execution
What is a process made up of?
- Code
- Data, including the stack
- Operating Systems data structures
What are the six process states that can occur?
- New
- Ready
- Running
- Blocked
- Exit
- Suspend
Can a single process go through multiple states?
Yes, it can. You can build a history of the process from these states.
How many processes can have the Running state at one time (single core system)?
Only one process can have the Running state. Once it times out, the process is moved from Running to Ready and the next process is allowed to go.
How can a process become Blocked?
A process can become blocked if it has to wait for anything, such as a keystroke. It is then moved to the blocked state and can only move back to the Ready state if the event it was waiting for occurs
What is the Suspend state?
Suspend allows the OS to remove a blocked process completely from memory, allowing a new process to be started or return an old process back into memory. This occurs over and above the normal Virtual Memory operation.
Why would the OS need two suspend states?
It may need two suspend states, one for Ready suspend and one for Blocked suspend, because it allows the OS to avoid bring a suspended process back into memory just to know if it is still blocked. A process can move from Blocked suspend to Ready suspend once it is no longer blocked, allowing for it to be brought back in.
What is a Process Image?
This is what the process consists of while it sits in memory. It is a snapshot of its state at any given time
What does a Process Image Contain?
- User Data
- User Program Code
- System Stack
- Process Control Block (PCB)
What is a Process Control Block?
It is a data structure which contains all the necessary information which allows the scheduling of a particular process
What does a PCB contain?
- Process ID
- Processor State Information (CPU registers, stack pointers)
- Processor Control Information:
- processor state, priority, scheduling info, event
- data structures, inter-process communication
- privileges, memory management, resource ownership
What is Process Switching?
Taking one process off the CPU and putting another one onto the CPU. Process switch may occur when the OS has control of the CPU. There are three ways to do this:
- External Interrupt
- Trap
- Supervisor/System call
What is the Context?
Any information about the state of one process that would be changed by the execution of another process
What is Context Switching?
Changing the context which the CPU is using
What is the difference between Process and Context switching?
A process switch takes longer as there is much more to do while a Context switch doesn’t always mean a process switch. Instead, it may be just a thread switch within one process.
What are the steps in a Process Switch?
1) Save context of the CPU
2) Update PCB of the running process
3) Move the PCB to the right Queue
4) Select another ready process
5) Update and move the PCB of the chosen process
6) Restore the context of the chosen process
7) Continue Execution
What are the two key characteristics of a process?
-Resource Ownership
Everything owned by the process
-A Thread of Execution
Information about what the process is, where it is in the program and what it is doing. Also the contents of the Program Counter, Processors Status Word and the other internal Registers (the Context)
Why are threads useful?
Changing between threads is just a context switch so therefore light rather than a costly process switch. It makes programs more efficient.
What are the main reasons for using threads?
-Foreground and background work
-Asynchronous Processing
Can use threads for auto save, for example
-Speed of execution
-Organising Programs