1/69
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Operating System
is a software, which makes a computer to actually work.
OS
organizes and controls the hardware, acts as an interface between the application programs and the machine hardware.
Examples of OS
Windows, Linux, Unix and Mac OS
Two basic functions of operating systems
resource management and user friendliness
Resource management
A user program accesses several hardware and software resources during its execution.
Resource management(cont.)
Manages the resources and allocates them to users in an efficient and fair manner. It encompasses the following functions
Examples of Resource management
CPU, Main memory, 1/0 devices, and various types of software (compiler, linker-loader files, etc.).
User friendliness
It hides the unpleasant, low-level details and idiosyncrasies of bare H/W machine. It encompasses the following functions.
Functions of User friendliness
Execution environment (Process management- creation, control, and termination, file manipulation, interrupt handling, support for 1/0 operations. language support). Error detection and handling, Protection and security, Fault tolerance and failure recovery
Functions of Resource management
Time management {CPU and disks scheduling), Space management (main and secondary storages), Process Synchronization and deadlock handling, Accounting and status information.
Design Approaches
Deal with complexities of modern systems
Policies
What should be done
Mechanisms
How it should be done
Three common approaches
Layered Approach, Kernel Approach, Virtual Machine Approach
Layered Approach
Simplifies design, implementation and testing and Modular by dividing OS into functional layers.
Kernel Based Approach
contains a collection of primitives which are used to build the OS.
OS (Kernel)
implements policy
Kernel (Kernel)
implements mechanisms
Virtual Machine Approach
Virtual software layer over hardware, Illusion of multiple instances of hardware, Supports multiple instances of Oss
Types of Advanced OSs
Distributed, Multiprocessor, Database, Real-time
Distributed Operating Systems
Controls and manages resources for a network of autonomous computers, manage both hardware and software resources
Distributed Operating Systems
User not aware of program or resource location, Design issues same as traditional systems. Issues: lack of shared memory and lack of global clock
Multiprocessor Operating Systems
Consists of a set of processors that share a set of physical memory blocks, share a common clock, and "share" over an interconnection network.
Database Operating Systems
place increased demands on an operating system to efficiently support: concept of a transactions, manage large volumes of data, concurrency control, and system failure control.
Real-time Operating Systems
Place application specific special requirements on an operating system. Policies and mechanisms are geared to ensuring jobs meet their deadlines. Problem is one of resource scheduling and overall system utilization
Two privilege level
user level and system level
kernel space protected
requires special instruction sequence to change from user to kernel mode.
Process
compete for system resources blocks if cannot acquire a resource.
Kernel
manages resource - allocate resource to processes "optimally", implements policy for resource allocation (sharing) provide high-level abstract interface to resources.
Address space
memory locations accessible to process.
Virtual address space
memory, disk, swap or remote devices.
Exec
different programs may be run during the life of a process by calling ____.
Exit
processes typically terminate by calling ____.
Dwell defined hierarchy
one parent and zero or more child processes.
init process
is at the root of this tree.
Address Space
Dtext, data, stack, shared memory.
Control information (u area, proc)
Du area, proc structure, maps; kernel stack, Address translation maps, Credentials, user and group ids.
Hardware context
program counter, stack pointer, processor status word, memory management registers, FPU registers.
Process Control Block
Machine registers saved in u area's _____________ during context switch to another process.
U area
Part of user space (above stack), typically mapped to a fixed address, contains info needed while running, Can be swapped
Process
contains info needed when not running, not swapped out, traditionally fixed size table.
User ID
UID
Group ID
GID
Effective ID
file creation and access,
Real ID
real owner of process. Used when sending signals.
The Kernel
program that runs directly on the hardware loaded at boot time and initializes system, creates some initial system processes, remains in memory and manages the system.
Synchronous
kernel performs work on behalf of the process
System call interface (UNIX API)
central component of the UNIX API
Hardware exceptions
unusual action of process
Asynchronous
kernel performs tasks that are possibly unrelated to current process.
Hardware interrupts
devices assert hardware interrupt mechanism to notify kernel of events which require attention (1/0 completion, status change, real-time clock etc).
System processes
scheduled by OS.
Trap or Interrupt Processing
Hardware switches to kernel mode, using the per/process kernel stack. HW saves PC, Status word and possibly other state on kernel stack, Assembly routine saves any other information necessary and dispatches event.
Interrupt handling
Asynchronous event such as disk 1/0, network packet reception or clock "tick". Must be serviced in system context. Must not block.
Interrupt handling (cont)
Multiple interrupt priority levels (ipl), traditionally 0-7, User processes and kernel operate at the lowest ipl level, Higher level Interrupts can preempt lower priority ones.
Exception handling
Synchronous to the currently running process for example divide by zero or invalid memory access. Must run the current processes context.
Software Interrupts
Interrupts typically have the highest priority in system, are assigned priorities above that of user processes but below that of interrupts. typically implemented in software.
System Call Interface
Implemented as an assembly language stub, Trap into kernel dispatch routine which may save additional state and invoke the high-level system call.
Synchronization
Kernel is re-entrant, only one active process at any given time (others are blocked), Nonpreemptive, Blocking operations, masking interrupts.
Sleep()
When resource is unavailable (possibly locked), process sets flag and calls ______.
Switch()
sleep places process blocked queue, sets state to asleep and calls ______.
Wakeup()
when resource released _________ is called.
Dall
sleep processes are woken and state set to runnable (placed on the runnable queues).
Process Scheduling
Preemptive round-robin scheduling fixed time quantums priority is adjusted by nice value and usage factor. Processes in the kernel are assigned a kernel.
Signals
Asynchronous events and exceptions, Signal generation using the kill() system call, Default operation or user specific handlers, sets a bit in the pending signals mask in the proc structure
Fork ()
create a new process, copy of parents virtual memory ,parent return value is child's PIO, child return value is 0.
Exec ()
overwrite with new program.
Exit()
is called closes open files, releases other resources, saves resource usage statistics and exit status in proc structure, wakeup parent, calls switch.
Test-and-set
is a single indivisible machine instruction (TS}.
Lock-and-Key Synchronization
Process first checks if key is available If it is available, process must pick it up and put it in lock to make it unavailable to all other processes.