Event Based Simulation of The Backfilling Algorithm OOP tirgul No

Slides:



Advertisements
Similar presentations
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Advertisements

Operating Systems (CSCI2413) Lecture 4 Process Scheduling phones off (please)
6/25/2015Page 1 Process Scheduling B.Ramamurthy. 6/25/2015Page 2 Introduction An important aspect of multiprogramming is scheduling. The resources that.
Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
3.1 : Resource Management Part2 :Processor Management.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems with Multi-programming Chapter 4.
Operating System Principles And Multitasking
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
UNIT–II: Process Management
OPERATING SYSTEMS CS 3502 Fall 2017
Planning & System installation
CPU SCHEDULING.
Lecture 12: Real-Time Scheduling
Dan C. Marinescu Office: HEC 439 B. Office hours: M, Wd 3 – 4:30 PM.
Process Management Process Concept Why only the global variables?
Process Description and Control
Algorithm and Data Structure Part III Dr. Naimah Yaakob
Process Scheduling B.Ramamurthy 9/16/2018.
OPERATING SYSTEM OVERVIEW
CPU Scheduling.
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Operating Systems CPU Scheduling.
Process management Information maintained by OS for process management
Chapter 5: CPU Scheduling
CS 143A - Principles of Operating Systems
Process Scheduling B.Ramamurthy 11/18/2018.
Processor Management Damian Gordon.
CPU Scheduling Basic Concepts Scheduling Criteria
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Operating System Concepts
3: CPU Scheduling Basic Concepts Scheduling Criteria
Process Scheduling B.Ramamurthy 12/5/2018.
Operating Systems.
Chapter5: CPU Scheduling
Chapter 5: CPU Scheduling
A Simulator to Study Virtual Memory Manager Behavior
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 5: CPU Scheduling
Lecture 2 Part 3 CPU Scheduling
Process Scheduling B.Ramamurthy 2/23/2019.
Process Scheduling B.Ramamurthy 2/23/2019.
Process Scheduling B.Ramamurthy 2/23/2019.
Process Scheduling B.Ramamurthy 4/11/2019.
Process Scheduling B.Ramamurthy 4/7/2019.
Uniprocessor scheduling
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Process Scheduling B.Ramamurthy 4/19/2019.
Process Scheduling B.Ramamurthy 4/24/2019.
CPU SCHEDULING SIMULATION
Shortest-Job-First (SJR) Scheduling
Chapter 6: CPU Scheduling
Chapter 4: Simulation Designs
Module 5: CPU Scheduling
Process Scheduling B.Ramamurthy 5/7/2019.
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
Chapter 6: CPU Scheduling
Processor Management Damian Gordon.
CPU Scheduling: Basic Concepts
Module 5: CPU Scheduling
Presentation transcript:

Event Based Simulation of The Backfilling Algorithm OOP tirgul No

Outline The CPU allocation task – revisited The Backfilling algorithm Simulation – implementation issues

The CPU Allocation Task Task components –Parallel computing machine with N CPUs –A stream of request for running jobs Input for each job –Id, arrival time, num of CPUS estimated run time The task –Continuously decide which jobs to start and when to start

First Come First Served Revisited Simple algorithm Non optimal resource usage time now processors

Exploiting Free Resources Start small tasks right now Do not delay tasks ahead in the queue time now processors

Aggressive Backfilling (EASY) time now processors Start small tasks right now Do not delay the first task in the queue Runs on real parallel machines

EASY Scheduler - Overview Main data structures: –waitQueue: a queue of waiting jobs –runList: a list of running jobs Calculate status parameters –shadow time –free CPUs Find a backfill job

Data Structures WaitQueue –Sorted according to arrival time –For each job maintain Number of requested CPUs Estimated run time RunList – sorted by termination time timenow processors 1st2nd3rd4th

The Status Parameters shadow time The expected time in which the first job in the queue can run – assuming no delays free CPUs: The minimum of : –number of expected free CPUs after 1 st job in queue starts –the CPUs that are currently free timenow processors 1st2nd3rd4th Shadow timefree CPUs (in the initial stage)

Calculating Status Parameters set expCapacity = capacity // current # free CPUs while expCapacity < firstJob.numCPUs currJob = next job in runList expCapacity = expCapacity + currJob.numCPUs shadowTime = currJob.ExpectedFinishTime freeCPUs = min ( expCapacity-firstJob.numCPUs, capacity ) timenow processors 1st2nd3rd4th Shadow timefree CPUs (in the initial stage)

Decision to Run a New Job – Including Backfilling timenow processors 1st2nd3rd4th Shadow timefree CPUs (in the initial stage) Loop on jobs in waitQueue in arrival order if ( job.numCPUs > capacity) continue else if ( job is 1 st in waitQueue || estTermTimeIfStartsNow <= shadow || job.numCPUs <= freeCPUs ) start job and update freeCPUs

Simulation of a Scheduler Goal – analyze different schedulers –Use records of running processes Input for each job –Traces (log file) of real processes running on real machines –Id, arrival time, num of CPUS estimated run time, actual runtime Output –Various statistics on waiting time for each algorithm (average wait time and slow down in our exercise)

Log File - Example Id Arrival time Run time # CPUs Expected Time

Implementation Using event based simulation principles Main modules: –Simulator Maintains a priority queue of events Types of events: job arrival, job termination –Scheduler Maintains status of currently running jobs Maintains the wait queue Schedules jobs – instructs the simulator when to start

Scheduler – Implementation Issues Two types of schedulers –Consider common and distinct features –Simulator should work with different schedulers Note – scheduler can instruct initiation of several processes simultaneously See Strategy pattern in design patterns

Parsing Log Files Scanner is too slow for reading complete large files Solution –Use BufferedReader and FileReader –Read each line using Scanner –Integers can be read using nextInt method of Scanner

Implementing a Priority Queue Can be implemented using a heap (required in the exercise) Assume heap size is not known in advance → Handle memory allocation carefully Initialize an array with a reasonable size Inserting a new element to a ‘full’ heap How do we expand the heap?