CS 241 (03/07/12). MP #5 Exam Reminders  We still have a few students that still need to take the conflict.  Thanks for not discussing it on Piazza.

Slides:



Advertisements
Similar presentations
Scheduling Algorithems
Advertisements

ASSIGNMENT NO # 01 INTRODUCTION TO OPERATING SYSTEM Submitted to: Miss Sana.
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
G53OPS Operating Systems Graham Kendall Q Exam.
Topic : Process Management Lecture By: Rupinder Kaur Lecturer IT, SRS Govt. Polytechnic College for Girls,Ludhiana.
Process Control Management Prepared by: Dhason Operating Systems AICT
CS 149: Operating Systems February 3 Class Meeting
OS, , Part II CPU Scheduling Department of Computer Engineering, PSUWannarat Suntiamorntut.
Monday, 11/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Monday, 11/11/02  Questions? HW 04 due today at 5.  Today – Lists and an introduction to searching.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 17 Scheduling III.
Operating Systems Chapter 6
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating Systems CPU Scheduling. Agenda for Today What is Scheduler and its types Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Processes and Their Scheduling.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Operating Systems (CSCI2413) Lecture 4 Process Scheduling phones off (please)
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
What we will cover…  CPU Scheduling  Basic Concepts  Scheduling Criteria  Scheduling Algorithms  Evaluations 1-1 Lecture 4.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 6: CPU Scheduling
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Example of SJF ProcessArrival TimeBurst Time P P P
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Operating Systems Process Management.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
CPU Scheduling Algorithms Simulation using Java Kaushal Sinha CSC 4320 Spring 2007.
3.1 : Resource Management Part2 :Processor Management.
CE Operating Systems Lecture 7 Threads & Introduction to CPU Scheduling.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
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.
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
Week 3: CPU Scheduling CS 162. Today’s Section Administrivia (2 min) Quiz (5 min) Review lecture 8 (10 min) Worksheet and Discussion (33 min)
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
CS 241 Discussion Section (02/02/2012). MP2 Overview  Task is simple  Reimplement malloc(), calloc(), realloc() and free()  A contest will be running.
Introduction to Operating System Created by : Zahid Javed CPU Scheduling Fifth Lecture.
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
Lecture 5 Scheduling. Today CPSC Tyson Kendon Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
CPU Scheduling Algorithms CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
ICS143a 2017 Programming Assignment
CPU SCHEDULING.
Kernel Stack Desirable for security: e.g., illegal parameters might be supplied.
CPU Scheduling Algorithms
Scheduling (Priority Based)
CPU Scheduling.
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Process management Information maintained by OS for process management
ICS 143 Principles of Operating Systems
ICS 143 Principles of Operating Systems
Module 5: CPU Scheduling
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter 6: CPU Scheduling
Lesson Objectives Aims Key Words
Process Management Scheduling
Shortest-Job-First (SJR) Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
EECE.4810/EECE.5730 Operating Systems
Module 5: CPU Scheduling
CS444/544 Operating Systems II Scheduler
Presentation transcript:

CS 241 (03/07/12)

MP #5

Exam Reminders  We still have a few students that still need to take the conflict.  Thanks for not discussing it on Piazza.  We will discuss only one exam problem today (doesn’t appear on the conflict version of the midterm).  Grades on Compass 2g on Friday.

MP5 In MP5, you will add code to a simulator for a CPU scheduler.  We provide you with the code for the simulator.  You don’t need to understand this code to understand this MP.  You should consider the simulator a ‘black box’

MP5 In MP5, you will add code to a simulator for a CPU scheduler.  We provide you with the code for the simulator.  You don’t need to understand this code to understand this MP.  You should consider the simulator a ‘black box’  You need to implement these algorithms:  fcfs: First Come First Serve  pri: Priority Scheduling  ppri: Preemptive Priority Scheduling  sjf: Shortest Job First  psjf: Preemtive Shortest Job First (by Remaining Time)  rr#: Round Robin

MP5  Every modern scheduler uses a priority queue to prioritize what task to run next.  [Part 1] requires you to implement a priority queue library, libpriqueue.

MP5  libpriqueue contains nine required functions:  State-related functions:  priqueue_init(), priqueue_destroy()  priqueue_size()

MP5  libpriqueue contains nine required functions:  State-related functions:  priqueue_init(), priqueue_destroy()  priqueue_size()  Adding and removing elements:  priqueue_offer()  priqueue_remove(), priqueue_remove_at()

MP5  libpriqueue contains nine required functions:  State-related functions:  priqueue_init(), priqueue_destroy()  priqueue_size()  Adding and removing elements:  priqueue_offer()  priqueue_remove(), priqueue_remove_at()  Accessing elements:  priqueue_peek(), priqueue_poll()  priqueue_at()

MP5  The priqueue_init() function takes in a comparer function:  void priqueue_init( priqueue_t *q, int(*comparer)(const void *, const void *) )  This comprarer function is the same function as qsort().  Compares two elements, returns the an int if one element is less than, equal to, or greater than the other element.  We’ll look into programming this later.

MP5 priqueue_t q; priqueue_init(&q, comparer); int i10 = 10, i20 = 20, i30 = 30; priqueue_offer(&q, &i20); priqueue_offer(&q, &i30); priqueue_offer(&q, &i10); for (i = 0; i < priqueue_size(&q); i++) printf("%d ", *((int *)priqueue_at(&q, i)) ); printf("\n"); priqueue_destroy(&q);

MP5 priqueue_t q; priqueue_init(&q, comparer); int i10 = 10, i20 = 20, i30 = 30; priqueue_offer(&q, &i20); priqueue_offer(&q, &i30); priqueue_offer(&q, &i10); for (i = 0; i < priqueue_size(&q); i++) printf("%d ", *((int *)priqueue_at(&q, i)) ); printf("\n"); priqueue_destroy(&q);

MP5 int compare(const void *a, const void *b) { }

MP5 int compare(const void *a, const void *b) { int i1 = *((int *)a); int i2 = *((int *)b); }

MP5 int compare(const void *a, const void *b) { int i1 = *((int *)a); int i2 = *((int *)b); if (i1 < i2) return -1; else if (i1 == i2) return 0; else return 1; } // Sample Output: //

MP5 int compare(const void *a, const void *b) { int i1 = *((int *)a); int i2 = *((int *)b); if (i1 > i2) return -1; else if (i1 == i2) return 0; else return 1; } // Sample Output: //

MP5  You now have a priority queue that can prioritize elements based on any function you program.  Now, it should be simple to implement a scheduler. In [Part 2], you’ll implement a second library: libscheduler.

MP5  You need to fill in 3 scheduling functions:  scheduler_new_job()  scheduler_job_finished()  scheduler_quantum_expired() Note that these are the only times that the scheduler needs to make a decision!  Two helper functions:  scheduler_start_up()  scheduler_clean_up() Called at the beginning and end, for your convenience.

MP5  Example Workload:  Algorithm: FCFS  Cores: 1 core Job NumberArrival TimeRunning TimePriority

[start]: scheduler_start_up() Job NumberArrival TimeRunning TimePriority

[start]: scheduler_start_up() [t=0]: ?? Job NumberArrival TimeRunning TimePriority

[start]: scheduler_start_up() [t=0]: _new_job(id=0, time=0, run=8, pri=1)  _new_job() returns what core the new job should be running on, or -1 if it should not run on a core. Job NumberArrival TimeRunning TimePriority

[start]: scheduler_start_up() [t=0]: _new_job(id=0, time=0, run=8, pri=1)  returns 0, job(id=0) should run on core(id=0) Job NumberArrival TimeRunning TimePriority

[start]: scheduler_start_up() [t=0]: _new_job(id=0, time=0, run=8, pri=1) = 0 [t=1]: ?? Job NumberArrival TimeRunning TimePriority

[start]: scheduler_start_up() [t=0]: _new_job(id=0, time=0, run=8, pri=1) = 0 [t=1]: _new_job(id=1, time=1, run=8, pri=1) = ?? Job NumberArrival TimeRunning TimePriority

[start]: scheduler_start_up() [t=0]: _new_job(id=0, time=0, run=8, pri=1) = 0 [t=1]: _new_job(id=1, time=1, run=8, pri=1) = -1 Job NumberArrival TimeRunning TimePriority

[start]: scheduler_start_up() [t=0]: _new_job(id=0, time=0, run=8, pri=1) = 0 [t=1]: _new_job(id=1, time=1, run=8, pri=1) = -1 [t=2]: ?? Job NumberArrival TimeRunning TimePriority

[start]: scheduler_start_up() [t=0]: _new_job(id=0, time=0, run=8, pri=1) = 0 [t=1]: _new_job(id=1, time=1, run=8, pri=1) = -1 [t=2]: (Nothing happens, no calls to your program) Job NumberArrival TimeRunning TimePriority

[t=2]: (Nothing happens, no calls to your program) [t=3]: ?? Job NumberArrival TimeRunning TimePriority

[t=2]: (Nothing happens, no calls to your program) [t=3]: _new_job(id=2, time=3, run=4, pri=2) = ?? Job NumberArrival TimeRunning TimePriority

[t=2]: (Nothing happens, no calls to your program) [t=3]: _new_job(id=2, time=3, run=4, pri=2) = -1 Job NumberArrival TimeRunning TimePriority

[t=2]: (Nothing happens, no calls to your program) [t=3]: _new_job(id=2, time=3, run=4, pri=2) = -1 [t=??]: (Next this that happens?) Job NumberArrival TimeRunning TimePriority

[t=3]: _new_job(id=2, time=3, run=4, pri=2) = -1 [t=8]: _job_finished(core=0, job=0, time=8)  _ job_finished() is called when the CPU has ran a job to completion… returns the next job number that should be ran on the core. Job NumberArrival TimeRunning TimePriority

[t=3]: _new_job(id=2, time=3, run=4, pri=2) = -1 [t=8]: _job_finished(core=0, job=0, time=8) = 1 Job NumberArrival TimeRunning TimePriority

[t=3]: _new_job(id=2, time=3, run=4, pri=2) = -1 [t=8]: _job_finished(core=0, job=0, time=8) = 1 [t=16]: _job_finished(core=0, job=1, time=16) = 2 [t=20]: _job_finished(core=0, job=1, time=20) = -1 [Done with scheduling!]:

MP5  You also need to fill in 3 statistics functions:  float scheduler_average_response_time()  float scheduler_average_wait_time()  float scheduler_average_turnaround_time() These are called at the end of the simulation.  We also provide one function debug-related function: scheduler_show_queue().  After every call our simulator makes, we’ll call this function and you can print out any debugging information you want.

[Done with scheduling!]: scheduler_average_waiting_time() --> returns (20/3) == scheduler_average_turnaround_time() --> returns (40/3) == scheduler_average_response_time() --> returns (20/3) == scheduler_clean_up() [Done!]

MP5  For success on this MP:  We provide queuetest.c, a program to help you test [Part 1] independent of [Part 2].  We provide 54 example output files and a program, examples.pl, to run all 54 examples at once and report any errors.  Requires a good understanding of data structures, scheduling, and pointers all in one MP. Good luck!

Announcements  No more class this week for CS 241  No sections tomorrow  No class on Friday (EOH)  MP5: Due in 6 days and ~12 hours.  Tuesday, March 13, 2012 at 11:59pm  Look for exam grades on Friday on Compass 2g