1/33
Process and Process State
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Process
is a program in execution.
passive, active
A Program is ______; a process is _______.
Address Space
CPU State
OS Resources
Process Structure
New
Running
Waiting (Blocked)
Ready
Terminated
Process State
New
The process is about to be created but not yet created. It is the program that is present in secondary memory that will be picked up by OS to create the process.
Running
The process is chosen from the ready queue by the CPU for execution and the instructions within the process are executed by any one of the available CPU cores
Waiting (Blocked)
Whenever the process is _____ for an event, it enters the ______
state or ____state. The process continues to wait in the main memory and does not require CPU.
Ready
After the creation of a process, the process enters the ____ state. Processes that are ______ for execution by the CPU are maintained in a queue called ready queue.
Process Control Block (PCB)
Each process is represented in the operating system by a _____ also called a task control block.
It contains information associated with a specific process
Process State
Program Counter
CPU registers
CPU-Scheduling Information
Memory-Management Information
Accounting Information
I/O status Information
Process Control Block includes:
Process State
The state may be new, ready, running, waited, halted, etc.
Program Counter
The counter indicates the address of the next instruction to be
executed for this process.
CPU Registers
The registers vary in number and type, depending on the computer architecture.
They include accumulators, index registers, stack pointers, and general-purpose registers.
CPU-Scheduling Information
This information includes a process priority, pointers to
scheduling queues, and any other scheduling parameters
Memory Management Information
This information may include such items as the value of the base and limit registers and the page tables, or the segment tables, depending on the memory system used by the operating system
Accounting Information
This information includes the amount of CPU and real time used, time limits, account numbers, job or process numbers, etc.
I/O Status Information
This information includes the list of I/O devices allocated to the process, a list of open files, etc.
Process Scheduler
selects an available process (possibly from a set of several available processes) for program execution on a core
Ready Queue
Wait Queue
Scheduling Queues
Ready Queue
contains those processes that are ready to run
Wait Queue
contains those processes that are waiting for a certain event to occur
Context Switch
is a task where switching the CPU core to another process requires performing a state save of the current process and a state restore of a different process
State Save
performs a state save of the current state of the CPU core
State Restore
to resume operations
State save
State restore
Context Switch
Preemptive
Non-preemptive
Categories in Scheduling falls into two categories:
Non-preemptive
a process’s resource cannot be taken before the process has finished running.
when a running process finishes and transitions to a waiting state, resources are switched.
Preemptive
the OS assigns resources to a process for a predetermined period of time.
the process switches from running state to ready state or from waiting state to ready state during resource allocation.
Long Term or Job Scheduler
brings the new process to the Ready State.
it controls the Degree of Multi-programming
it increases efficiency by maintaining a balance between I/O and CPU-bound processes.
they operate at a high level and are typically used in batch-processing systems.
Short-Term or CPU Scheduler
• is responsible for selecting one process from the ready state for scheduling it on the running state.
• all scheduling algorithms are used.
• is responsible for ensuring no starvation due to high burst time processes.
The Dispatcher
is responsible for loading the process selected by the Short-term scheduler on the CPU (Ready to Running State) Context switching is done by the dispatcher only
Switching Context;
Switching to user mode;
Jumping to the proper location in the newly loaded program.
The dispatcher does the following:
Medium-Term Scheduler
it is responsible for suspending and resuming process.
it mainly does swapping (moving processes from main memory to disk and vice versa).
swapping may be necessary to improve the process mix or because a change in memory requirements has overcommitted available memory, requiring memory to be freed up.
is helpful in maintaining a perfect balance between the I/O bound and the CPU bound.
it reduces the degree of multiprogramming.
Degree of Multi-programming
the number of processes present in a ready state at any point in time.