9691 Computing Paper 3 Section 3.1 The functions of Operating Systems.

Slides:



Advertisements
Similar presentations
PROCESS MANAGEMENT Y. Colette LeMard.
Advertisements

Computer Architecture
Topic : Process Management Lecture By: Rupinder Kaur Lecturer IT, SRS Govt. Polytechnic College for Girls,Ludhiana.
IT Systems Multiprocessor System EN230-1 Justin Champion C208 –
Ceng Operating Systems Chapter 2.2 : Process Scheduling Process concept  Process scheduling Interprocess communication Deadlocks Threads.
Scheduling in Batch Systems
Operating Systems (CSCI2413) Lecture 4 Process Scheduling phones off (please)
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
Review: Operating System Manages all system resources ALU Memory I/O Files Objectives: Security Efficiency Convenience.
Chapter 1 and 2 Computer System and Operating System Overview
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
CHAPTER 9: Input / Output
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
FUNCTIONS OF OPERATING SYSTEMS Interfaces Memory Management Security Utility Interrupt Handling.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
The Operating System. Operating Systems (F) What you need to know about –operating system as a program; –directory/folder.
CPU Scheduling Chapter 6 Chapter 6.
Chapter 6: CPU Scheduling
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Chapter 4 Processor Management
Chapter 6 CPU SCHEDULING.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Systems Software Operating Systems. What is software? Software is the term that we use for all the programs and data that we use with a computer system.
Operating Systems Process Management.
6 Memory Management and Processor Management Management of Resources Measure of Effectiveness – On most modern computers, the operating system serves.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling To improve: Response time: time it takes a system to react to a given input Turnaround Time (TAT)
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Processor Architecture
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 Software. 2 What is software ► Software is the term that we use for all the programs and data on a computer system. ► Two types of software ► Program.
The Functions of Operating Systems Scheduling(multi-programming)
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Chapter 6: Computer Components Dr Mohamed Menacer Taibah University
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
9691 Computing Paper 3 Section 3.1 The functions of Operating Systems.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
REAL-TIME OPERATING SYSTEMS
Chapter 13 The Function of Operating Systems
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Lesson Objectives Aims Key Words Interrupt, Buffer, Priority, Stack
Advanced OS Concepts (For OCR)
Process Description and Control
Processor Management Damian Gordon.
Chapter 6: CPU Scheduling
Computer System Overview
Operating System Concepts
Processor Fundamentals
Chapter 2: The Linux System Part 3
TDC 311 Process Scheduling.
Process Description and Control
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Uniprocessor scheduling
Processor Management Damian Gordon.
Scheduling Computing Theory – F453.
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

9691 Computing Paper 3 Section 3.1 The functions of Operating Systems

Functions of Operating Systems (OS)  All Operating Systems (OS) have three main functions:  Controlling and Managing Hardware  Providing An Interface (Human-Machine and Machine-Software)  Facilitating Application Software To Run  Operating systems must:  Provide and manage hardware resources  Provide an interface between the user and the machine  Provide an interface between application software and the machine  Provide security for data on the system  Provide utility software to allow maintenance to be done VCN ICT Department 20132

Features of OS 1.User interface: the two main types of user interfaces are command line and graphical user interface. 2.Device drivers (Routines which control hardware). Example: Keyboard driver 3.Multitasking capability which enables the computer to run more than one program at one time. (Example: Running a word processing program, spreadsheet program and a database program at the same time in the computer.) 4.Spooling: directs jobs and data files to a queue on a backing store before sending them to their intended peripheral device. VCN ICT Department 20133

Features of OS (continued) 5.Security: ensures that users can keep their files confidential 6.Scheduler: allocates job priorities and find and resolve deadlocks using scheduling algorithms 7.Memory manager: allocates memory to jobs and data 8.Interrupt handler: routine in the operating system which puts interrupts in a queue until they are processed by the processor. 9.Translators: converts source code of application programs into object code or to machine code VCN ICT Department 20134

Interrupts  An interrupt is a signal from a hardware device or an instruction from a software program indicating the processor the need for a change in execution.  The processor processes program instructions stored in the memory. It fetches instructions one after the other and executes them.  If a problem occurs (anywhere in the system) while the processor is busy processing, the processor must respond to the problem as soon as possible in order to avoid damage to data and/or hardware.  This requires the processor to stop whatever it is doing and give its attention to the problem.  The device (hardware) or software, where the problem has occurred generates a signal, called an “interrupt” to get processor’s attention. VCN ICT Department This is a simple method a computer uses to carry out instructions.

Types of Interrupt I/O interrupt – Generated by an I/O device to signal that a job is complete or an error has occurred. E.g. – Printer is out of paper or is not connected. Timer interrupt – Generated at fixed intervals. – Allows for display refresh and to control access to processor in multi-access or multi-programming system.

Types of Interrupt Hardware interrupt – E.g. Power failure which indicates that the OS must close down as safely as possible. Program interrupt – Generated due to an error in a program such as violation of memory use (trying to use part of the memory reserved by the OS for other use) or an attempt to execute an invalid instruction (such as division by zero).

Types of Interrupts (Summary) Hardware: Generated by hardware devices. (Hardware failure. Hardware going off-line) Software: Generated by software applications. (Violation of memory space. Virus found, division by zero) Timer: Generated by internal clock. (Scheduling of processes; an event is due) I/O: Generated by an I/O device. (e.g Printer out of paper; CD copying completed) VCN ICT Department 20138

Managing interrupts After execution of an instruction, the processor must see if an interrupt has occurred. If yes, the OS services that interrupt following a new set of instructions. VCN ICT Department 20139

What happens if the current job is more important than the interrupt? The Priority of the interrupt is compared with current job. – If higher: An appropriate interrupt service routine (ISR), depending on the interrupt's importance, is loaded and run. The Interrupt is serviced by the processor. – If lower: The interrupt is placed in a queue. The current job continues with next cycle. VCN ICT Department

Resuming an interrupted program from where it left off after interrupt has been Serviced The state of the current job is saved. This is done by saving the contents of all the registers in the processor so that the OS can use them to service the interrupt. The OS can load the register contents back in the registers to resume the job being interrupted once the interrupt has been serviced VCN ICT Department

What happens if several interrupts occur at the same time? Place the interrupts in a queue and only allow return to the originally interrupted program when the queue is empty. However, if an interrupt is considered important enough then an interrupt service routine (ISR) is chosen, which will “mask” the interrupt, meaning that any future interrupts are not considered until the current interrupt is completed. VCN ICT Department

What happens if some interrupts are more important than others? The Interrupt is allocated a position in the job queue according to priorities. – How this priority is decided is called scheduling VCN ICT Department

Handling Interrupts - Summary The Current cycle is completed Then the priority of interrupt is compared with the current job If higher: – Contents of special registers are saved, the current job is allocated a position in the job queue according to priorities – Interrupt is serviced by OS. – On completion, values of special registers from original program are loaded and the original job is restored. If lower: – Interrupt is allocated a position in the job queue according to priorities. – Current job continues with next cycle.

JOB SCHEDULING Scheduling is an OS process that starts and ends tasks (programs), manages concurrently running processes, and allocates system resources. REASONS FOR SCHEDULING  Maximize the use of the whole of the computer system  Be fair to all users  Provide a reasonable response time to all users, whether they are on-line users or a batch processing user  Prevent the system failing if it is becoming overloaded  Make sure that the system is consistent by always giving similar response times to similar activities from day to day VCN ICT Department

Input Output (I/O) bound Vs Processor bound jobs I/O bound jobs are those that require relatively little processing but do need to use the peripheral devices substantially. – E.g. Printing wage slips for the employees of a large company Processor bound jobs are those that require a large amount of processor time and very little use of the various peripheral devices. – E.g. Analysing the annual, world-wide sales of the company which has a turnover of many billions of Shillings. VCN ICT Department

VCN ICT Department Job A is processor-bound and Job B is I/O bound. I/O bound jobs are given more time in order to allow them to finish in reasonable time. Processor bound jobs are given lesser time as they can do more in less time and shouldn’t hold the I/O bound jobs. Scheduling Example

STRATEGIES FOR SCHEDULING Scheduling of processes requires careful considerations. The following are the most common:  Priority: Giving some jobs priority over others.  I/O or Processor Bound: Deciding which job is processor bound and which is I/O bound.  Type of Job: Batch processing, on-line and real-time jobs all require different response times.  Resource Requirements: The amount of time needed to complete the job, the memory required, I/O and processor time.  Resources Used So Far: The amount of processor time used so far, how much I/O used so far.  Waiting Time: The time the job has been waiting to use the system. VCN ICT Department

Process handling A job can be in any of the following states. – Ready [ Ready to start ] – Running [ on the system ] – Blocked [ Waiting for a peripheral ] VCN ICT Department A job can only enter the running state from the ready state. The ready and blocked states are queues that may hold several jobs. On a standard single processor computer only one job can be in the running state. All jobs entering the system normally enter via the ready state and (normally) only leave the system from the running state. NOTE

Schedulers High Level Scheduler (HLS) is responsible for placing a job in the ready queue. The HLS makes sure that the system is not over loaded. Mid-Level Scheduler (MLS) is responsible for swapping jobs between main and secondary memory. Low-Level Scheduler (LLS) is responsible for Moving jobs in and out of the ready state. – The LLS decides the order in which jobs are to be placed in the running state. VCN ICT Department

Scheduling policies There are many policies that may be used to do scheduling, but they can all be placed in one of two classes. These are pre-emptive and non-pre-emptive policies. Pre-emptive policy: allows the LLS to put or remove jobs from the RUNNING queue as and when needed. Non Pre-emptive policy allows jobs to run until they no longer need the processor. VCN ICT Department

Common scheduling algorithms First come first Served (FCFS): Simply means that the first job to enter the ready queue is the first to enter the running state. This favors long jobs. (Non pre-emptive by design) Shortest Job first (SJF): Simply means sort jobs in the ready queue in ascending order of times expected to be needed by each job. New jobs are added to the queue in such a way as to preserve this order. (Non pre-emptive) Round Robin (RR): This gives each job a maximum length of processor time (called a time slice) after which the job is put at the back of the ready queue and the job at the front of the queue is given use of the processor. If a job is completed before the maximum time is up it leaves the system. Shortest Remaining Time (SRT): The ready queue is sorted on the amount of expected time still required by a job. This scheme favours short jobs even more than SJF. Also there is a danger of long jobs being prevented from running. Priority Queues (PQ): Priority Queues involve queues of different priorities. Jobs in higher priority queues are executed first. Multi-level Feedback queues (MFQ): Involves several queues of different priorities with jobs migrating downwards. VCN ICT Department

Other methods of allocating priorities: All the policies discussed on previous slides are methods of allocating priorities. Here are some others: Amount of time already waited. Amount of processor time already given. Amount of peripheral time. – Compares I/O jobs and asks “How much of a I/O job are you?” Necessary response time. – Compares real-time / on-line jobs and asks “How much of a real-time / on-line jobs are you?” or “OK, you are a real- time / on-line job but how quickly do I need to respond to you?”

Other methods of allocating priorities: Importance of Job / Type of Job – Safety critical jobs will be given very high priority, on-line and real time applications will also have to have high priorities. E.g. 1.A computer monitoring the temperature and pressure in a chemical process whilst analysing results of readings taken over a period of time must give the high priority to the control program. – If the temperature or pressure goes out of a pre-defined range, the control program must take over immediately. 2.A bank's computer is printing bank statements over night and someone wishes to use a cash point, the cash point job must take priority. – Also remember I/O bound jobs will also get priority as stated earlier. – Can be Pre-Emptive or Non-Pre-Emptive depending on if the queue is checked after each cycle or not. VCN ICT Department

Memory Management Memory Management is the process of managing jobs and their data in the memory.  When a job needs to be processed, it is stored in the main memory along with its data.  The job’s code and data must be managed and protected from actions of other other.  In most of the modern OS, more than one job can be loaded into the memory at one time. VCN ICT Department