ICT Unit 05 - Operating Systems PDF
Document Details
Uploaded by NiceHouston
Tags
Summary
This document provides an overview of operating systems, including their classification, file systems, storage allocation, process management, scheduling policies, and context switching.
Full Transcript
Unit 05 – Operating Systems Classification of operating systems Single user – single task , Single user – multi task , Multi user – multi task Multi-threading -provide a way to improve application performance through the parallel execution of sub process. Real time -designed to...
Unit 05 – Operating Systems Classification of operating systems Single user – single task , Single user – multi task , Multi user – multi task Multi-threading -provide a way to improve application performance through the parallel execution of sub process. Real time -designed to run applications with very precise timing and with a high degree of reliability. These types of OS are needed in situations where downtime is costly or a program delay could cause a safety hazard. Features: quick and predictable response to events Time sharing systems - Enables to share the processor time among multiple programs / multiple users. Features: provides quick response, reduces CPU idle time Multiprogramming systems -enables the execution of multiple programs simultaneously Multitasking - working on multiple tasks simultaneously File systems FAT (supports all devices), NTFS (supports encryption, recovery, compression) Fragmentation Internal (allocated size- requested size) & external (needed blocks are not contiguous) Storage allocation Contiguous allocation - Allocate disk space as a collection of adjacent/contiguous blocks. Features: simple, easy access, file size is not known at the time of creation, extending file size is difficult, internal & external fragmentations, directory entry is the starting block. Linked allocation - Inside each block a link is maintained to point to where the next block of the file is. Features: no external fragmentation, files can grow easily, Many seek are required to access file, directory entry is the starting block. Indexed allocation - Creates a table of pointers (index) at the time of the file creation. This table is stored as index block. Features: no external fragmentation, index block contains all the pointers (overhead), external fragmentation, directory entry is the address of the index block. Disk formatting Low level formatting- is a physical formatting process that marks cylinders and tracks of the blank hard-disk. Partitioning - is the process of dividing the hard-disk into one or more regions. High level formatting- Set up file systems like FAT32, NTFS, etc. Process management Types of processes -I/O bound, CPU bound Process control block A Process Control Block is a data structure maintained by the OS for every process. This contains: PID , State , PC, CPU registers ,I/O status information , Memory management information , Accounting information Context switching A context switch is the mechanism to store and restore the state or context of a CPU in PCB. Then process execution can be resumed from the same point at a later time. Interrupt Interrupt is an event that alters the sequence of execution of process, can occur due to a time expiry an OS service, I/O completion. occurs asynchronously Process states New - The process is being created, involves LTS, job queue hold the processes Ready - The process is waiting to be assigned to the CPU/ ready to execute (involves STS) , ready queue hold the processes Running - Currently running process in CPU Wait/ Blocked - The process is waiting for I/O request / some event to occur (such as an I/O completion, termination of a child process, a signal/message from another process, wait queue hold the processes Terminated - The process has finished execution and de-allocate resources Suspend Wait/ Suspend block - When waiting queue becomes full, involves MTS Suspend Ready - When ready queue becomes full, after complete operations in suspend wait (if still wait queue is full) moved to suspend ready state Reasons New batch job - User starts a program, OS creates process to provide a service, Running program starts another process Termination - Normal termination, Execution time-limit exceeded, resource requested is unavailable, execution error, OS or parent process request, Parent process has terminated. Process schedulers Long-term (/job) scheduling - determines which programs are admitted to the system for processing, selects processes from the job queue and loads them into memory, Controls the degree of multiprogramming ,Speed is lesser than short term scheduler Medium-term scheduling: doing swapping processes between the main memory and the secondary storage, Controls the degree of multiprogramming, Speed is in between Short-term (/low-level) scheduling: Determines which ready process will be assigned the CPU next. Provides lesser control over the degree of multiprogramming, fastest among other two Scheduling Policies Non-preemptive - Once a process is in the running state, it will continue until it terminates or blocks for I/O. Preemptive - Currently running process may be interrupted and moved to the Ready state by the OS. Happens with priority , time sharing Times related CPU Utilization -The percentage of time that the CPU is busy. Turnaround time: Time required for a particular process to complete, from submission time to completion. Response time : The difference between the arrival time and the time at which the process first gets the CPU Throughput: Number of processes completed per unit time. Waiting time: How much time a process spends in the ready queue till its turn to get on the CPU. Arrival Time: The time at which the process enters into the ready queue Burst/ execution Time: The total amount of time required by the CPU to execute the whole process. This does not include the waiting time. Completion Time: The Time at which the process enters into the completion state or the time at which the process completes its execution TAT= CT-AT = WT+BT Memory Management Memory Management Unit (MMU) -Hardware device that maps virtual to physical address Paging - is a memory management technique in which process LAS is broken into fixed size blocks (pages). Similarly, physical memory is divided into fixed- sized blocks (frames). Paging reduces external fragmentation, simple to implement, efficient memory, swapping becomes very easy management technique, Page table requires extra memory space, may not be good for a system having small RAM. Page size = Frame size Logical Address = Page number + page offset Physical Address = Frame number + page offset Number of entries in page table= no.of pages* one entry size one entry size= frame bits+ additional bits No of Frames= (Physical Address Space size) / (frame size) No of Pages= (Logical Address Space size) / (page size) LAS= 2bits for logical address PAS== 2bits for physical address no.of pages= 2bits for page no.of frames= 2bits for frame Page size= 2offset Virtual memory Allow applications larger than physical memory to execute. Run partially loaded programs Increase Degree of Multiprogramming Page fault A page fault is a type of interrupt, occurs when a program attempts to access data or code that is in its address space, but is not currently located in the system RAM Device management Spooling- Spooling refers to putting data of various I/O jobs in a buffer. This buffer is a special area in memory or hard disk which is accessible to I/O devices. Buffering Caching Device Drivers – The computer communicates with peripheral devices through device driver software.