Advanced OS Concepts (For OCR)

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

PROCESS MANAGEMENT Y. Colette LeMard.
Chapter 3 Process Description and Control
Lecture 11: Operating System Services. What is an Operating System? An operating system is an event driven program which acts as an interface between.
Process Description and Control Module 1.0. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Process Description and Control Chapter 3. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Computer Organization and Architecture
Process Description and Control A process is sometimes called a task, it is a program in execution.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Implementing Processes and Process Management Brian Bershad.
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Process by Dr. Amin Danial Asham. References Operating System Concepts ABRAHAM SILBERSCHATZ, PETER BAER GALVIN, and GREG GAGNE.
C o n f i d e n t i a l 1 Course: BCA Semester: III Subject Code : BC 0042 Subject Name: Operating Systems Unit number : 1 Unit Title: Overview of Operating.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
O PERATING S YSTEM. What is an Operating System? An operating system is an event driven program which acts as an interface between a user of a computer,
The Functions of Operating Systems Scheduling(multi-programming)
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Operating System Concepts Three User Interfaces Command-line Job-Control Language (JCL) Graphical User Interface (GUI)
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
9691 Computing Paper 3 Section 3.1 The functions of Operating Systems.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Operating Systems c. define and explain the purpose of scheduling, job queues, priorities and how they are used to manage job throughput; d. explain how.
CSCE451/851 Introduction to Operating Systems
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Lecture 3 Process.
Basic Computer Organization and Design
Lecture 1: Operating System Services
Processes and threads.
Process concept.
Chapter 2 Memory and process management
2. OPERATING SYSTEM 2.1 Operating System Function
Process Management Process Concept Why only the global variables?
Component 2 6G, H, I, J, K.
Lesson Objectives Aims Key Words Interrupt, Buffer, Priority, Stack
OPERATING SYSTEMS CS3502 Fall 2017
The Operating System Nick Sims.
Lecture Topics: 11/1 Processes Process Management
William Stallings Computer Organization and Architecture
Process Description and Control
Intro to Processes CSSE 332 Operating Systems
Chapter 3 Top Level View of Computer Function and Interconnection
Process Virtualization. Process Process is a program that has initiated its execution. A program is a passive entity; whereas a process is an active entity.
Processor Management Damian Gordon.
Multistep Processing of a User Program
Processor Fundamentals
Main Memory Background Swapping Contiguous Allocation Paging
Process & its States Lecture 5.
Operating Systems.
Chapter 8: Memory management
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Process Description and Control
Lecture Topics: 11/1 General Operating System Concepts Processes
Processes Hank Levy 1.
Processes and Process Management
Ainsley Smith Tel: Ex
Spooling Describe spooling, explaining why it is used.
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Chapter 3: Processes.
Processes Hank Levy 1.
Processor Management Damian Gordon.
Chapter 3: Process Management
Presentation transcript:

Advanced OS Concepts (For OCR) Nick Sims

Memory Management - Scheduling OS schedules the jobs in sequence Making best use of the processor Important that the input / output phrase must not delay the processor This could be a problem if the input output devices are slow… This can be overcome by using Simultaneous Peripheral Operations On-Line (or spooling)

Memory Management - Scheduling Spooling is to store all input and output on a high-speed device such as a disk Input Spool Output spool Input device Output device Read Process Application Program Write process

Memory Management - Scheduling Another problem is that programs may not be loaded into the same memory locations each time they have been loaded i.e. suppose three programs were loaded in the order of A, B, and C on one occasion And again the order C, A, and B on another occasion The processor needs to know where all the data and instructions are stored So moving data / instructions around can have enormous implications

Memory Management - Loader The loader remembers exactly where everything is every time it is loaded The loader remembers bits of programs that have moved to different places how to stay in touch with each other

The Process Concept This is important in multi-programming operating systems What type of an operating system is this? This is an O.S. that allows a number of programs to appear to be running simultaneously on one computer Definition: a process is a program actually running on the CPU, even though it might be waiting for I/O at a particular moment

The Process Concept Example: remember there could be only one CPU a Pascal Compiler may be executed by several people simultaneously on a network There will only be one copy in memory Different parts of it will be used by several different people to compile their programs They will share the same code Each instance of the program running will be a process, with separate data areas maintained for each execution A program working this way is said to be re-entrant

Memory Management - The Loader A further problem is where: two or more users use the same program at the same time Waste of time if two copies are loaded into main memory So user X’s program and user’s Y’s program are stored in main memory along with a single copy of the program OS User X’s program and data User Y’s program and data Compiler Free Re-Entrant Two users can use the program in turn and will want to use different parts of the program. There will be two different sets of data for the compiler. Two sets of data must be kept separate.

Memory Management - Interrupts Interrupts are used to gain processor time Start This process is fine as long as the program being run maintains control of the processor! Fetch Function Execute Instruction YES Any more instructions? NO End

Memory Management - Loader If a user has used all the time allocated to the use of the processor, it will be necessary to stop that program running in order to be fair to all users This is managed through a scheduling algorithm Interrupts instigates this change These are messages sent to the processor by some external entity I/O Interrupt – generated by I/O device to signal a job to complete or an error occurred Timer Interrupt – generated by an internal clock indicating the processor must attend to time critical activities Hardware error – power failure which indicates that the OS must be close down 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 for the operating system) or an attempt to execute an invalid instruction (division by zero)

Memory Management - Interrupts Start After execution of an instruction, the OS must see if an interrupt has occurred… If one has occurred, the OS must service the interrupt if it is more important than the task already being carried out. New instructions are obeyed and the contents of the registers are stored in a stack… Fetch Function Execute Instruction Any more instructions? End YES NO Is there an interrupt? Service Interrupt

Memory Management - Interrupts If an interrupt interrupts another interrupt, then a queue is used, only return to the original program when the queue is empty. The position of an individual interrupt in the queue is determined by their importance to the user, to the system and to the job itself. Each job is given a priority and the further along the queue it is stored. Start Fetch Function Any more instructions? Execute Instruction Is there an interrupt? YES YES Service Interrupt NO End

The purpose of scheduling, job queues, and priorities OS has to arrange jobs that need to be done in the appropriate order The order is chosen for the maximum use made of the processor; another order may make one job more important than the other The OS makes use of priorities

The purpose of scheduling, job queues, and priorities The processor is required by program ‘A’ (wage slips) And the processor is required for program ‘B’ (which analyses the annual, world-wide sales of the company which has a turnover of a million pounds) Program ‘A’ makes very little use of the processor – jobs are concerned about input and output (I/O bound jobs) Program ‘B’ makes a great deal of the processor, only needing to collect one set of data from the drive and producing one lot of printout at the end (job is processor bound)

The purpose of scheduling, job queues, and priorities Program B has priority over a program ‘A’ for use of the processor, it could be a long time before program ‘A’ can print, because ‘B’s’ processing will need to be done before ‘A’ gets a look in It would be more fair to let ‘A’ do a bit or processing and then use the printer, because printing takes a longer time, Then whilst the printing is carried out, B is allowed to use the processor

The purpose of scheduling, job queues, and priorities The objectives of scheduling are to: Maximise the use of the whole of the computing system Be fair to all users Provide a reasonable response time to all users, whether they are online users Prevent the system failing if it is becoming overloaded Ensure that the system is consistent by always giving similar response times to similar activities from day-to-day

Scheduling To achieve these objectives some criteria are needed in order to determine the order in which jobs are executed

Scheduling The OS needs to schedule all of the tasks that it is required to carry out The CPU can only carry out one instruction at a time, so the instructions need to be sent to the processor in the most efficient way in order to get all the tasks done. Priority scheduling: give each task a priority and do them in order of importance. Type of job – batch processing and real-time jobs require different response times (Job Control Language (JCL) - a language that allows the user to program the sequence in which tasks will be carried out – usually used with a batch OS. Resource requirements – the amount of time required to complete the job, the memory required, I/O and processor time (Time slicing: give each job a piece of processor time on a round-robin basis) 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.

Time slicing Each task is given a small slice of processor time. Part of the task will be completed in that time slice and then the processor moves on to the next task and so on. After a period of time, a task will have had enough time slices to be complete so no more time slices need allocating. At any one time the processor will be handling part of one of the tasks that need to be complete. The more tasks it is asked to do, the longer it will take to complete each task. The OS can allocate different time-slices to different tasks.

Threads Each process can have more than one thread. Each thread has a scheduled state (runnable, running and suspended) All threads share most of their environment Same virtual address space for instructions and global variables, but they have their own local variables, program counter, registers and stack pointer. Each thread has it’s own control block (TCB). The PCB holds references to one or more TCB. This means less memory is used and it requires less work to create or delete threads than separate processes because threads share virtual address space

Threads A thread is a path of execution within a process Operating systems that support multi-threading enable the programmers to design programs whose threaded parts can execute concurrently Used for writing client-server applications – the programmer must design the program in such a way that all threads can run concurrently without interfering with each other