Looks like no one added any tags here yet for you.
Operating System (OS)
An interface between applications and hardware.
Process Utilization =
\frac{P}{\text{Sum of processing times}}
Evolution of Operating Systems:
Serial Processing
Simple Batch Systems
Multiprogrammed Batch Systems
Time Sharing Systems
Serial Processing
Programs interface directly with the hardware.
Simple Batch Systems
Uses a monitor to control a program’s access to the hardware.
Monitor
Controls a program’s access to the hardware. Software will always branch back to the monitor.
Resident Monitor
Software that is always in memory.
Job Control Language (JCL)
Used to provide instructions to the monitor.
User Mode
No access to certain areas of memory.
Kernel Mode
Complete access to hardware.
Monitor Drawbacks:
Monitor takes time to exectute
Monitor takes up space in memory.
Multiprogramming / Multitasking
Swapping control to a different program when the current one needs to wait for I/O.
Time-Sharing Systems
Handles multiple programs that require I/O.
Can be accessed by multiple users at once.
Time-Sharing Systems use ___ to directly interface with the program.
Terminals
Compatible Time-Sharing Systems (CTSS)
One of the first OS’s.
CTSS Time Slicing
Would “interrupt” the system at set intervals to swap to another program.
Incomplete programs would be written to a disk while another job was finishing.
Process
A program being executed.
Improper Synchronization
A program is overwritten before it could be saved.
Nondeterminate Program Operation
Programs overwrite an area of memory that is already occupied by another program.
Failed Mutual Exclusion
More than one user or program tries to make use of a shared resource at the same time.
Deadlocks
Two programs can be hung up waiting on each other.
3 Components of a Process:
Program
Associated Memory
Execution Context / State
Execution Context
The “state” the a process is currently in.
OS Storage Responsibilities:
Process Isolation
Automatic Memory Management
Modular Programming Support
Access Control
Long-Term Storage
Virtual Memory
Allows programs to access memory as symbols instead of directly accessing memory.
This allows the OS to handle memory allocation.
Paging
Allows processes to be comprised of a number of fixed-size blocks called pages.
Provides a dynamic mapping between a virtual and physical address.
Main Issues with Access Control:
Availability
Confidentiality
Data Integrity
Autheticity
Resources Allocation policies that must be considered:
Efficiency
Fairness
Differential Responsiveness
Process Control Block
A data block created and maintained by the os.
Contains all the elements that make up a process.
Notable process elements:
ID
State
Priority
Counter
Pointers
Context
I/O
Accounting
Trace
The behavior of a process as defined by the list of executed instructions.
Dispatcher
A small program that switches the processer from one process to another.
Process Counter
The address of the next instruction to be executed.
Process Pointers
Pointers to any data associated with the process + any memory shared with other processes.
Process Context
The data present in the context registers while the process is executing.
Process I/O
Includes any I/O requests, devices, files, etc.
Process Accounting
May include things such as the amount of time a process has taken, time limits, etc.
Reasons for process creation:
New batch job
Login
Service-by-OS
From existing process
Process Spawning
The act of a process requesting another process be made.
The requester is the parent and the resulting process is the child.
Reasons for process termination:
Completion
Timeout
Error
OS Intervention
Parent Termination
Parent Request
Process Blocked State
Occurs when the process is waiting for an event to occur, typically I/O.
Process Swapping
Moving parts of a process from main memory to disk, putting it into a suspended state.
7-State Process Model
Reasons for process suspension:
Swapping
OS-Suspicion
User Request
Timing
Parent Request
Memory Tables
Used to keep track of real and virtual memory.
Memory tables must include:
Allocation of real memory.
Allocation of virtual memory.
Protection attributes for real and virtual memory.
Info needed to manage virtual memory.
I/O Tables
Used by the OS to manage the I/O devices and channels.
File Tables keep track of:
Existence of files.
File location on virtual memory.
Current status.
File-specific attributes.
Process Tables
Used and maintained by the OS to manage processes.
Process tables help the OS keep track of:
Process Location
Process Attributes
Process Location
Where a process’s programs and data is located.
A process will always have sufficient enough memory to hold said programs and data.
Process Attributes
Any unique attributes a process may possess.
Process Image
The collection of a process’s program, data, stack, and attributes.
A process image contains:
User Data
User Program
Stack
Process Control Block
Process Control Block
Contains all the information about a process that is needed by the OS.
A process control block contains:
ID
State Information
Control Information
Process ID
A unique numeric ID given to a process.
Processor State Information contains the:
User-Visible Registers
Control & Status Registers
Stack Pointers
Program Status Word (PSW)
Contains condition codes and other status information.
Process Control Information
The additional information needed by the OS to coordinate the various active processes.
Process Modes of Execution:
User Mode
System Mode
Typical Functions of a OS Kernel:
Process Management
Memory Management
I/O Management
Process Creation Steps:
Assign ID
Allocate space
Initialize control block
Set appropriate links
Create/expand other data structures
System Interrupt
Stops a process from running to either handle I/O or switch processes.
System Trap
Stops a process from running to handle an error or exception.
Scheduling and Process State Transitions
Long-term Scheduler
Determines which programs are admitted to the system for processing.
Medium-term Scheduler
Determines which parts of any process is moved into main memory.
Part of the swapping function.
Short-term Scheduler / Dispatcher
Determines which process gets executed next.
Priority Queueing
Selection Function
Determines which process, among ready processes, is selected for execution.
Decision Mode
Specifies the instants in time at which the selection function is exercised.
Nonpreemptive Decision Mode
Once a process is in the running state, it will continue until it terminates or requires I/O.
Preemptive Decision Mode
Interrupts running processes and moves them to the “ready” state.