Operating Systems Flashcards
Operating Systems
Definition: Software that handles the interface to the hardware and manages resources.
Features of OS
Provide and manage hardware resources. Provide an interface between the user and the machine e.g. CLI, GUI. Provide an interface between applications software and the machine e.g. saving to disk. Provide security for the data on the system e.g. passwords, access rights, encryption. Provide utility software to allow maintenance to be done e.g. housekeeping, anti-virus.
Manage HW Resources
Management of memory – partitioning, allocating memory, virtual memory. Scheduling of Jobs including interrupt handling.
Interrupt
An interrupt/signal sent to the processor. Request for processing time. Allows important tasks to be processed. Interrupts may cause a break in execution of the current routine so it can be resumed later.
Reasons for interrupts
To obtain processor time…for a higher priority task. To avoid delays. To avoid loss of data. As an indicator to the processor… that a device needs to be serviced.
Sources of interrupt
User e.g. new user logon request, power failure e.g. to allow orderly shut-down (prevent data loss), system failure, peripheral e.g. printer buffer empty, Clock, software e.g. divide by zero error.
HW Interrupt
A hardware interrupt is an electronic alerting signal sent to the processor from an external device, either a part of the computer itself such as a disk controller or an external peripheral. E.g. imminent power failure.
SW Interrupt
Software interrupt is an interrupt generated within a processor by executing an instruction. E.g. Divide by zero.
Processing interrupts
After each cycle is completed (execute instruction) the processor checks the interrupt register by comparing priority of the current task with the highest priority interrupt. If interrupt is of higher priority the contents of registers put on stack …PC set to start address of interrupt service routine…interrupt is processed…check for further interrupts…contents of registers restored from stack and original task continues. If the interrupt was not of a higher priority than the current task then it starts the fetch-execute cycle again (the address of next instruction is copied from the PC to MAR).
Resuming after interrupt
Reset interrupt request flag so shows interrupt has been serviced. Check interrupt register for further interrupts and service them if they are of higher priority than task to be resumed. If there are no higher priority interrupts then restore the contents of the registers from the stack and resume task.
Interrupt priority
Interrupts have priorities: To decide between interrupt and current task. To choose which interrupt to process if 2 (or more) occur together. To ensure most urgent task is performed first. To ensure most efficient use of the processor. e.g. new user log on can wait… but data must be saved before power fails.
Scheduling
The operating system allocates priorities to jobs. Deciding which job to run next is the job of the scheduler.
Scheduler Purpose
Ensure all jobs are processed changing priorities where necessary. Process as many jobs as possible in the least possible time.
Maximise the number of interactive users receiving fast response times. Maximise throughput by utilising resources and processor time efficiently.
Priority
An order of importance.
Job States
Ready, Running and Blocked.
Job Queue and Priorities
Jobs are given different priorities when in a job queue. This is because some jobs are more urgent than others. Priorities are also used to maximise the use of the computer resources. A job with a low priority can have its priority changed by the operating system.
Job Leaving Running State 4 reasons
Job may have finished running. Job may require services of a peripheral (placed in the blocked queue to await servicing). Job has had long enough and it has to give up its place so that the other jobs get a chance. A higher priority interrupt comes along.
Scheduling Algorithms
Round robin, system of priorities, length of job, first come, first served, multi-level feedback queues.
Round robin
Each user is allocated a time slice. When time slice is up, system moves to next user. If next user needs processor, user given time slice. Repeat this for all users in turn (until all users serviced). Users may have different priorities which can change the order. Time slices are very small with no apparent delay for any user.
Memory management
Physical and logical division of memory and programs (memory is not disk storage).
Why mm is needed
To allocate memory to allow separate processes to run apparently simultaneously. To deal with allocation when paging/segmentation. To reallocate when necessary. To protect processes and data from each other. To protect the operating system and provide security. To enable memory to be shared.
Virtual memory
Virtual memory combines active RAM and inactive memory on secondary storage to form a large range of contiguous addresses. Allows programs to run when there is insufficient memory available.
Paging
Way of partitioning memory. Used for virtual memory. Segments stored on backing store and assigned to memory when needed. Pages are of a fixed size, they are made to fit sections of memory, they are physical divisions. Paged allocation divides the computer’s primary memory into fixed-size units called page frames, and the program’s address space into pages of the same size.
Segmentation
Way of partitioning memory. Used for virtual memory. Segments stored on backing store and assigned to memory when needed. Segments are different sizes, complete sections of programs, logical divisions.