Operating Systems Flashcards
(91 cards)
define operating system
a program that acts as an intermediary between a user and hardware
OS goals
- execute user programs
- makes solving user problems easier
- makes computer system convenient to use
- use system resources efficiently and fairly (priority and scheduling)
- manage processes
OS is a …. (roles and responsibilities)
- resource allocator: responsible for management of all computer resources
- kernel: the one program that runs the whole time
- control program: controls execution of user programs and operation of I/O devices
what is a process
a unit of execution that uses associated resources to execute collection of instructions completing a reasonable task
OS process management roles
- creating and deleting processes
- holding and resuming processes
- mechanisms for process synchronisation (priority, scheduling)
process includes
- code: text section
- heap: memory allocated during program execution
- data stack: temporary data e.g. local variables
- data section: global variables
- current activity: through PC and CPU register contents
information of process stored as:
a process control block. holds info on:
- unique identifier: PID (process ID)
- state
- CPU utilisation
- CPU scheduling info e.g. priority
- memory usage
- other info e.g. owner, description
process state (~status)
- new: process is being created
- running: instructions are being executed
- waiting: process is waiting for some event to occur
- ready: process is ready to be dispatched to CPU
- terminated: process has completed execution or some other process is causing termination
process state cycle
new –(admitted)–> ready –(scheduler dispatch)–>running
running–(interrupt)–> ready
running –(I/O or event wait)–> waiting – (event completion or I/O)–> ready
running – (exit) –> terminated
process creation
a new process, as a parent process, can create a number of child processes which can create processes themselves, forming a tree of processes.
process creation: sharing resources
parent and child processes can either:
- share all resources
- child shares subset of parent processes
- share no processes
process creation: execution
parent and child either:
- execute concurrently
- parent waits for child process to terminate
process termination
process executes final instruction and requests OS to delete it:
- data outputted from child to parent process
- child processes resources deallocated by OS
why would parent process terminate execution of child process?
- child process exceeded its allocated resources
- child task no longer necessary
- parent itself is terminating (cascading termination)
aim of kernel
provide an environment in which processes can exist
four essential components of a kernel
- privileged instruction set
- interrupt mechanism
- clock
- memory protection mechanisms
kernel consists of
- FLIH (first level interrupt handler): manage interrupts
- dispatcher: switch CPU between interrupts
- intra OS communications via system bus
what is an interrupt
a signal from either hardware or software of an event causing a change in process:
e. g. hardware: triggers an interrupt by sending a signal to the CPU via the system bus (eg IO event- printing complete)
software: triggers an interrupt by making a system call asking for some action by the OS (eg asking for time
interrupt routines
OS routines executed whenever an interrupt has occurred
function of FLIH
determine source of interrupt
initiate servicing of interrupt: select suitable dispatcher process
privileged instruction set
some instructions can only be accessible to OS:
- managing I/O
- halting processes
- interrupt management
dual mode
- distinguishes between user-defined code and OS code. don’t let user execute instructions that could cause harm
1) user mode 2) kernel mode/supervisor/system/privileged mode
when switch from user to kernel mode?
- an interrupt occurs (hardware)
- an error condition occurs in a user process (software)
- user process calls on OS to execute a function requiring privileged instruction set
- attempt to execute privileged instruction while in user mode
what does dispatcher do
assigns resources to processes