Efficiency of Batch Operating Systems



Similar documents
Chapter 2: OS Overview

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

OPERATING SYSTEMS SCHEDULING

Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

Operating System Tutorial

Operating Systems Lecture #6: Process Management

W4118 Operating Systems. Instructor: Junfeng Yang

Introduction. What is an Operating System?

Main Points. Scheduling policy: what to do next, when there are multiple threads ready to run. Definitions. Uniprocessor policies

Types Of Operating Systems

ICS Principles of Operating Systems

A Comparative Study of CPU Scheduling Algorithms

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling

Overview and History of Operating Systems

Process Scheduling CS 241. February 24, Copyright University of Illinois CS 241 Staff

Operating System: Scheduling

This tutorial will take you through step by step approach while learning Operating System concepts.

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances:

Scheduling 0 : Levels. High level scheduling: Medium level scheduling: Low level scheduling

Announcements. Basic Concepts. Histogram of Typical CPU- Burst Times. Dispatcher. CPU Scheduler. Burst Cycle. Reading

CPU Scheduling. CPU Scheduling

Chapter 1 Computer System Overview

Process Scheduling. Process Scheduler. Chapter 7. Context Switch. Scheduler. Selection Strategies

CPU Scheduling Outline

/ Operating Systems I. Process Scheduling. Warren R. Carithers Rob Duncan

PROCESS SCHEDULING ALGORITHMS: A REVIEW

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

theguard! ApplicationManager System Windows Data Collector

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

OS OBJECTIVE QUESTIONS

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Robert Wagner

Chapter 6, The Operating System Machine Level

Operating Systems 4 th Class

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

Chapter 5 Process Scheduling

Operating system Dr. Shroouq J.

Operating Systems. III. Scheduling.

Chapter 3. Operating Systems

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

A LECTURE NOTE ON CSC 322 OPERATING SYSTEM I DR. S. A. SODIYA

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

Job Scheduling Model

Analysis and Comparison of CPU Scheduling Algorithms

2. is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Operating Systems, 6 th ed. Test Bank Chapter 7

Introduction. Scheduling. Types of scheduling. The basics

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

ERserver. iseries. Work management

Components of a Computing System. What is an Operating System? Resources. Abstract Resources. Goals of an OS. System Software

Readings for this topic: Silberschatz/Galvin/Gagne Chapter 5

A Group based Time Quantum Round Robin Algorithm using Min-Max Spread Measure

CHAPTER 15: Operating Systems: An Overview

Chapter 5: CPU Scheduling. Operating System Concepts 8 th Edition

CPU Scheduling. Core Definitions

Buffer Management 5. Buffer Management

Origins of Operating Systems OS/360. Martin Grund HPI

REDUCING TIME: SCHEDULING JOB. Nisha Yadav, Nikita Chhillar, Neha jaiswal

Chapter 11 I/O Management and Disk Scheduling

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Lecture Outline Overview of real-time scheduling algorithms Outline relative strengths, weaknesses

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Scheduling Algorithms

1. Computer System Structure and Components

How To Understand The History Of An Operating System

Performance Comparison of RTOS

Syllabus MCA-404 Operating System - II

Chapter 2: Computer-System Structures. Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General System Architecture

OPERATING SYSTEM INDEX

CPU Scheduling. CSC 256/456 - Operating Systems Fall TA: Mohammad Hedayati

CS414 SP 2007 Assignment 1

I/O Management. General Computer Architecture. Goals for I/O. Levels of I/O. Naming. I/O Management. COMP755 Advanced Operating Systems 1

Have both hardware and software. Want to hide the details from the programmer (user).

Kernel. What is an Operating System? Systems Software and Application Software. The core of an OS is called kernel, which. Module 9: Operating Systems

Computer Systems Structure Input/Output

OPERATING SYSTEM SERVICES

Outline: Operating Systems

Chapter 11 I/O Management and Disk Scheduling

Linux Process Scheduling Policy

Central Processing Unit

OPERATING SYSTEM - VIRTUAL MEMORY

Input / Output and I/O Strategies

Discrete-Event Simulation

Computer-System Architecture

Big Picture. IC220 Set #11: Storage and I/O I/O. Outline. Important but neglected

Processor Scheduling. Queues Recall OS maintains various queues

Lecture 1 Operating System Overview

Unit 4 i5/os Work Management

Computer Organization & Architecture Lecture #19

Chapter 3 Operating-System Structures

Performance Monitoring User s Manual

Convenience: An OS makes a computer more convenient to use. Efficiency: An OS allows the computer system resources to be used in an efficient manner.

Final Report. Cluster Scheduling. Submitted by: Priti Lohani

Analyzing IBM i Performance Metrics

Transcription:

Efficiency of Batch Operating Systems a Teodor Rus rus@cs.uiowa.edu The University of Iowa, Department of Computer Science a These slides have been developed by Teodor Rus. They are copyrighted materials and may not be used in other course settings outside of the University of Iowa in their current form or modified form without the express written permission of the copyright holder. During this course, students are prohibited from selling notes to or being paid for taking notes by any person or commercial firm without the express written permission of the copyright holder. Introduction to System Software Copyright: Teodor Rus p.1/54

Questions about BOS BOS has been obtained as an algorithm that controls the computing system consisting of: (1) an operator batching jobs at one end of a JobFile; (2) a computer processing jobs from the other end of the JobFile; (3) I/O devices performing operations on that JobFile. Questions: 1. Is BOS correct? 2. Is BOS reliable? 3. Is BOS efficient? 4. Is BOS convenient? Does it evolve with problem domain? Introduction to System Software Copyright: Teodor Rus p.2/54

Overlapping 1. The batch operating system was developed as a solution to the problem of overlapping the activities of the I/O devices, processor, and memory on the one hand with those of the human operator on the other hand. 2. The difference in speed between I/O operations and processor/memory operations require a similar treatment. 3. To obtain maximum efficiency, each of the agents involved in problem-solving should work with its entire capacity. 4. This can be obtained if an operating system can be designed that allows all the agents involved in problem-solving to work in parallel and independent of each other. Introduction to System Software Copyright: Teodor Rus p.3/54

Solve action Problem solving with BOS can be formally specified by Solve action as follows: Solve:: local JobFile: file of Jobs, repeat forever Job1, Job2, Job3: job data structures; Operator:Batch(Job1, JobFile) or Skip :Ôperatpr Processopr:Process(Job2, JobFile) or Skip : ˆProcessor IOdevice: DoIO(Job3, JobF ile) or Skip :ÎOdevice Introduction to System Software Copyright: Teodor Rus p.4/54

Contrasting Solve with BOS BOS:: local JobF ile: file of job data structures; repeat Job: job data structure, Record: data or control information record; Operator:Batch(Job, JobF ile) or Skip: Ôperator Processor: MB := 1; Input (JobFile, Record); while (Record EOJ) do or P rocess(job) or Input(Job) or Output(Job) ; Skip : ˆProcessor forever Introduction to System Software Copyright: Teodor Rus p.5/54

Observations 1. With BOS action there is no overlapping between processor and I/O devices. Processor performs either program instructions in user mode or I/O instructions in system mode. 2. With Solve action wile processor performs machine instructions I/O devices perform at the same time I/O operations. 3. I/O operations performed by I/O devices could be on behalf of the current program executed by the processor, called overlapping mode, or on behalf of another program, called concurrent mode. 4. The overlapping and concurrency are different operating modes. One cannot design concurrent systems using a JobFile! Why? Introduction to System Software Copyright: Teodor Rus p.6/54

System performance By definition system performance is defined by Performance = ProcessorTime TotalTime % Note: 1. When I/O operations are initiated processor must wait for I/O operation completion before continuing program execution. 2. Increase in efficiency can be obtained if we can control the processor to perform in parallel with the I/O devices rather than waiting for I/O operations completion. Implementation: (1) processor polling devices or (2) devices interrupting processor. Introduction to System Software Copyright: Teodor Rus p.7/54

Scenario Answers to questions 1 and 2 led to a BOS where Batch() performs in parallel with P rocess() and DoIO(). P rocess() and DoIO() perform serial, Figure 1. Wake up! Operation completed Device Record Processor Read/write next record Figure 1: Processor I/O device serial activity Introduction to System Software Copyright: Teodor Rus p.8/54

Serial activity The processor sends an instruction to the device While the device reads/writes, processor is idle. When device terminates, processor works and device is idle. Introduction to System Software Copyright: Teodor Rus p.9/54

C expression SerialActivity() { while (MoreRecords) { Start I/O operation; while (Device busy) ; /* Processor is idle */ Process record; while (Processor busy) ; /* Device is idle */ } } Introduction to System Software Copyright: Teodor Rus p.10/54

Measuring efficiency Time spent by the device processing one record is T and time spent by the processor processing one record is t (T >> t); The Total Time (TT) required to process a sequence of n records is TT = n (T + t); Since T >> t processor is idle most of the time. Introduction to System Software Copyright: Teodor Rus p.11/54

Overlapping activities The processor starts the device to get next data record; While the device works the processor is idle; When device terminates: 1. processor starts the device for the next data record; 2. in parallel processes the data that has already arrived, instead of waiting for the next data record to arrive. Introduction to System Software Copyright: Teodor Rus p.12/54

Communication During overlapping activity the processor and I/O devices communicate by one or both of the mechanisms: 1. Polling: at given time intervals processor checks device status. If busy, processor can continue, if ready processor can restart it. Problem: when to poll + time lost during polling. 2. Interrupt: when device become ready it sends an interrupt signal to the processor. Introduction to System Software Copyright: Teodor Rus p.13/54

C expression overlap () { Start read/write FirstRecord; while (MoreRecords) { while (Device busy) ; /* Processor is idle */ Start read/write NextRecord; Process PreviousRecord; /* Proceed concurrently */ } Process LastRecord; } Introduction to System Software Copyright: Teodor Rus p.14/54

Measurements The time required to process n records in this scenario is n T + t. (Since T >> t, TT nt ); The gain in time is (n 1) t; Performance = Comparison: SerialPerformance = t T+t % OverlapPerformance = t T % (n t) Total Time % Introduction to System Software Copyright: Teodor Rus p.15/54

Observation Sections 5.9, 5.10 of the original text Systems Methodology for Software discuss buffering strategies that smooth the difference between serial and overlapping performance. Project 3: 1. Implement alternate buffering (page 305); 2. Use your implementation to copy a large file F1 on another file F2; 3. Compare the time taken by your program with the time taken by serial copying. Introduction to System Software Copyright: Teodor Rus p.16/54

Off-line operation The slow devices (card reader, card puncher, etc.), used to organize job files, operate in parallel with processor, in an environment different from that in which the processor and faster devices (disks, tapes, drums) operate. The job file is mapped off-line on tapes (TOS) which are then mounted on system by the human operator. The operating system performs as shown in Figure 2: Introduction to System Software Copyright: Teodor Rus p.17/54

Off-line operation Job activation CardReader Prepare jobs HO HO Tape... Tape OS Mount tapes Execute jobs Processor Job termination Processor OS HO Tape... Tape HO Printer Terminate jobs Dismount tapes Print results Figure 2: Off-line job processing Notation: OS stands for operating system and HO stands for human operator. Introduction to System Software Copyright: Teodor Rus p.18/54

Tape Operating System A TOS uses a magnetic tape as data carried for JobFile. 1. Operator prepares JOBs as usually and maps them off-line on magnetic tapes (MT) which are then mounted on an MT unit. 2. TOS reads and processes JOBs from a magnetic tape; TOS writes results onto a magnetic tape. 3. Operator dismounts tape and print results off-line. Note: since MT units are much faster than CRs and CPs increase in efficiency is expected. Introduction to System Software Copyright: Teodor Rus p.19/54

Implementations Design and develop special devices like card readers, line printers, etc., with the facility to input/output directly onto magnetic tapes. Develop a new computer configuration consisting of: 1. A main computer, performing data processing; 2. Small computers acting as satellites preparing data for the main computer. Introduction to System Software Copyright: Teodor Rus p.20/54

Fact This job processing mode evolved to today distributed systems. Introduction to System Software Copyright: Teodor Rus p.21/54

Advantages The main computer is no longer constrained by the speed of slow devices. It is however, constrained by the speed of magnetic tape unit. No changes are needed in the user programs running on the usual BOS in order to run them on the off-line system (TOS). Reason: I/O operations are performed by virtual devices that read/write their info records from/on magnetic tapes. Introduction to System Software Copyright: Teodor Rus p.22/54

Facts 1. User programs execute I/O operations by requesting them as services provided by the operating system. 2. Data comes from a virtual card reader, (paper tape, etc.) which are organized and standardized on a common magnetic tape. 3. Results are printed using a virtual card puncher (paper tape, etc.) which are organized and standardized on a common magnetic tape. Introduction to System Software Copyright: Teodor Rus p.23/54

A new concept Programs use logical devices which are mapped by the operating system into the physical devices connected to the system. Note: this is the origin of the computing abstractions called the file, and of the IOdevice use protocol: open(file,device), doio(), close(file,device) Introduction to System Software Copyright: Teodor Rus p.24/54

Advances Logical device which appears in the user s program evolved into the concept of a file (external file). Physical device used by the system evolved to the concept of a device file (internal file). The operating system binds the external file in the user program to an internal file in the system. Note: this is the origin of file system! Introduction to System Software Copyright: Teodor Rus p.25/54

Major limitations 1. The sequential nature of the tape does not allow the system to get direct access to various jobs waiting in the job file. 2. Hence, while a job performs I/O operations the processor can perform in parallel only computations of the same job: processor cannot execute computations of another job. Conclusion: I/O operations of one job cannot be performed in parallel with the processing operations of another job. Introduction to System Software Copyright: Teodor Rus p.26/54

Disk Operating System A disk system allows direct access to the jobs in a job files. Hence, DOS systems are created, where: 1. JDS recorded on cards are sent from the cards onto the disk. 2. Each job has in memory a Job Summary, JS. 3. The location of JDS image on disk is recorded in JS. Introduction to System Software Copyright: Teodor Rus p.27/54

Advances provided by DOS 1. I/O operations of a job can be overlapped with processing operations of another job. 2. I/O operations can be performed in parallel with processing operations, irrespective of the job they belong to. 3. While a job is processed, its I/O requests are satisfied by reading/writing a disk. 4. When a job is completed its actual output can be printed. Introduction to System Software Copyright: Teodor Rus p.28/54

SPOOLING The manner of the operation described above defines a job processing mode called Simultaneous Peripheral Operation On-Line (SPOOLING), depicted in Figure 3 Introduction to System Software Copyright: Teodor Rus p.29/54

Spooling, graphic Batch jobs Disk Execute CardReader Processor Print results Printer Figure 3: Spooling operation Introduction to System Software Copyright: Teodor Rus p.30/54

Advantages 1. The spooling operation uses a disk as a very large buffer. 2. Spooling is however capable of overlapping I/O operations for one job with processor operations for another job. This is the result of having direct access to the disk image of JDS. 3. The program which accumulates JDS-s in a job pool on disk is called an InSpooler. The program which prints the data accumulated into another pool is called an OutSpooler. Note: SPOOLING was first implemented at the Houston Computation Center of NASA under the name Houston Automatic Spooling Program (HASP) system. Introduction to System Software Copyright: Teodor Rus p.31/54

Multiprogramming The operation mode which overlaps processor activity for one job with the I/O operations requested by other jobs was called multiprogramming. Data structures that support multiprogramming are: 1. The job data structure kept on disk, directly accessible. 2. The job summary, JS, kept in main memory in a Job Summary Table (JST). Introduction to System Software Copyright: Teodor Rus p.32/54

Observations 1. The JS summarizes the computing activity supplied to the system and allows direct access to the job on disk. 2. A scheduling algorithm can schedule for execution various jobs in the JST according to a given policy (not necessarily FIFO). Note: computer user becomes a new computing abstraction. She needs to be codified and recorded in the system. Introduction to System Software Copyright: Teodor Rus p.33/54

User identification Computer users are represented by data-records consisting of their unique-names, priorities, jobs submitted, etc. Computer users are recorded in a user directory maintained by the system. The user directory allows the system to validate the user rights to submit jobs for execution and provides a billing mechanism. Introduction to System Software Copyright: Teodor Rus p.34/54

Scheduling information Common information in JS: struct JSentry { struct DirectoryEntry *User; char *JobName; int State; int Priority; int DiskAddress; int MemoryAddress; int RunningTime; int StartTime; int TerminateTime; }; Introduction to System Software Copyright: Teodor Rus p.35/54

User directory Common information in user directory entry: struct DirectoryEntry { char *UserName; char *AccountNumber; char *PassWord; int ProcessorTime; int I/O.Time; int OtherResources; }UserDirectory[MaxNumber]; Introduction to System Software Copyright: Teodor Rus p.36/54

Job summary table JST JST.Head Null Job1 Plk Nlk JS 1 User s name Job s name Job s state Job s priority Required time Start time Terminate time Disk address Memory address Job 2 Plk Plk Nlk JS 2 User s name Job s name Job s state Job s priority Required time Start time Terminate time Disk address Memory address JST.Tail Null Job k Nlk JS k User s name Job s name Job s state Job s priority Required time Start time Terminate time Disk address Memory address Introduction to System Software Copyright: Teodor Rus p.37/54

Observations 1. The list management system can again be used to implement this JST. 2. However, note that the value field of the objects managed by the list management system now are pointers to JSs which characterize the jobs present in the system at a given time. Introduction to System Software Copyright: Teodor Rus p.38/54

Implementation 1. Maintains two job pools called InPool and OutPool on disk and a job summary table JST, in main memory. 2. Job arrival is manipulated by a subsystem called InSpooler. 3. Job departure is manipulated by a subsystem called OutSpooler. 4. Job running is manipulated by yet another subsystem called Job Scheduler. Introduction to System Software Copyright: Teodor Rus p.39/54

InSpooler At job arrival the InSpooler performs: 1. Create a JS representing the job; 2. Link JS into the JST; 3. Send the job itself into the InPool on disk. Introduction to System Software Copyright: Teodor Rus p.40/54

Observations 1. The input operations during program execution can have as target any appropriate device (cards, tapes, disks, etc.). 2. The output operations initiated during program execution are performed by sending their results into the OutPool on disk. Introduction to System Software Copyright: Teodor Rus p.41/54

OutSpooler When a Job terminates the OutSpooler take care of its departure from the system performing: 1. Print the job s results present in the OutPool; 2. Free the disk area occupied by the job in the InPool and OutPool; 3. Update the JST accordingly by deleting the JS of departed job. Introduction to System Software Copyright: Teodor Rus p.42/54

Job Scheduler 1. Perform job transition from InPool to the memory when job s turn to execution comes (long-time scheduling). 2. Perform job scheduling for execution for the jobs already in memory (short-time scheduling). 3. Perform job transition from memory to the OutPool (when job terminates) or from memory to InPool (when its memory resources are required for other purposes) (long-time scheduling). Introduction to System Software Copyright: Teodor Rus p.43/54

Structuring JST Use three linked lists to implement JST: 1. The InList which accumulates JSs of new jobs arriving in the system; 2. The OutList which accumulates JSs of jobs waiting for termination; 3. The ReadyList which accumulates JSs of jobs in main memory waiting for execution. Introduction to System Software Copyright: Teodor Rus p.44/54

Scheduling InList, OutList, and ReadyList are managed by a long-term scheduler and a short-term scheduler. Long-term scheduler performs transitions: InList ReadyList and ReadyList OutList. Short-term scheduler performs transitions between running jobs on the processor, i.e. ReadyList switchcontext Processor Introduction to System Software Copyright: Teodor Rus p.45/54

Multiprogramming system Figure 5 illustrates the processing manner of a multiprogramming system. Job arrival InList Processor Main memory Long term Long term scheduler ReadyList scheduler Short term scheduling Job departure OutList Figure 5: Job processing by multiprogramming system Introduction to System Software Copyright: Teodor Rus p.46/54

Scheduling criteria Maximize processor utilization time. Maximize throughput of the system (i.e., maximize the number of jobs completed). Minimize turnaround time for each job (i.e., minimize the time between job arrival and job departure). Minimize the waiting time in the ReadyList. Introduction to System Software Copyright: Teodor Rus p.47/54

Scheduling algorithms First In First Out (FIFO), in which the first job arrived is first job serviced. Shortest Job First (SJF), in which the job requiring smallest time is serviced first. Priority scheduler, in which the highest priority job is serviced first. Introduction to System Software Copyright: Teodor Rus p.48/54

More scheduling algorithms Round-robin scheduler, in which each job is run for given time-slice after which processor is preempted and if not completed the job is rescheduled. Note: these algorithms can be implemented as preemptive or non-preemptive algorithms. Introduction to System Software Copyright: Teodor Rus p.49/54

Preemptive and NonPreemptive Scheduling With a non-preemptive scheduling algorithm the job which has acquired the processor keeps it until it is terminated. With a preemptive scheduling algorithm however, a job cannot use the processor longer than a given slice of time. Introduction to System Software Copyright: Teodor Rus p.50/54

Preemptive algorithms 1. Shortest job first implemented as the Shortest Remaining Time First (SRTF). 2. Round robin, giving equal time slices to each job in the ReadyList. 3. Multilevel queue in which a job s priority is decreased on a hierarchy of priority queues after each time-slice consumed. Introduction to System Software Copyright: Teodor Rus p.51/54

Multiprogramming summary 1. The operating system maintains various queues of jobs; jobs in these queues are in various stages of execution. 2. Operating system schedules the next job for execution according to some optimization criteria. 3. During execution time, a job may have to wait for some event to happen: a tape to be mounted, a command to be typed, an I/O operation to be completed, etc. 4. During waiting time operating system simply switches the processor to another job. Introduction to System Software Copyright: Teodor Rus p.52/54

Efficiency As long as there is some job to execute processor is not idle; When too many jobs compete for processor, this competition can degrade efficiency: processor becomes busy switching from one queue to another and from one job in a queue to another, in the detriment of user computations. This is called threshold state! Introduction to System Software Copyright: Teodor Rus p.53/54

Multiprogramming degree To maintain a high performance, the multiprogramming system needs to make efficient use of the processor and I/O devices; The number of jobs present in the system at a given time is called the multiprogramming degree; If multiprogramming degree is too large, the efficiency of the system is decreased rather than increased. Introduction to System Software Copyright: Teodor Rus p.54/54