Nachos Project Assignment 2 CPU scheduling

Slides:



Advertisements
Similar presentations
Scheduling Introduction to Scheduling
Advertisements

Tutorial 4 Scheduling. Why do we need scheduling? To manage processes according to requirements of a system, like: –User responsiveness or –Throughput.
G53OPS Operating Systems Graham Kendall Q Exam.
Topic : Process Management Lecture By: Rupinder Kaur Lecturer IT, SRS Govt. Polytechnic College for Girls,Ludhiana.
Operating Systems Process Scheduling (Ch 3.2, )
Operating Systems: Introduction n 1. Historical Development n 2. The OS as a Resource Manager n 3. Definitions n 4. The Process.
CPU Scheduling Section 2.5.
Operating System Process Scheduling (Ch 4.2, )
Operating System I Process Scheduling. Schedulers F Short-Term –“Which process gets the CPU?” –Fast, since once per 100 ms F Long-Term (batch) –“Which.
Project 2 – solution code
Operating Systems (CSCI2413) Lecture 4 Process Scheduling phones off (please)
Preemptive Minithreads Tom Roeder CS sp. Multi-level Feedback Queues Quantum = 2 Quantum = 4 Quantum = 8 Quantum = 16 Lowest priority Highest priority.
Operating Systems Process Scheduling (Ch 4.2, )
Operating System Process Scheduling (Ch 4.2, )
1 User-Level Processes Needed to test the system call you implement The “Noff” format file required –Look at the Makefile in test MIPS “syscall” instruction.
Nachos Project Assignment 2 CPU scheduling
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Welcome to the World of Nachos CPS 110 Spring 2004 Discussion Session 1.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
1 Process States (1) Possible process states –running –blocked –ready Transitions between states shown.
Nachos Project 1 Start-up and System call
CS1550 Assignment 5 Multiprogramming Implementation notes Matt Craven.
Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21.
Nachos Assignment#1 System calls implementation. What are system calls? Enable you to interact with OS kernel. A switch from User Mode to Kernel Mode.
Scheduling Basic scheduling policies, for OS schedulers (threads, tasks, processes) or thread library schedulers Review of Context Switching overheads.
Scheduling Strategies Operating Systems Spring 2004 Class #10.
1 CSE451 Scheduling Autumn 2002 Gary Kimura Lecture #6 October 11, 2002.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
1 Scheduling The part of the OS that makes the choice of which process to run next is called the scheduler and the algorithm it uses is called the scheduling.
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
CPU Scheduling Algorithms Simulation using Java Kaushal Sinha CSC 4320 Spring 2007.
Project 2: Initial Implementation Notes Tao Yang.
Nachos Project 4 Lecturer: Hao-Hua Chu TA: Chun-Po Wang (Artoo) Date: 2008/10/25.
Nachos Tutorial Courtesy: University of Waterloo.
What Every Developer Should Know about the Kernel Dr. Michael L. Collard 1.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 5 Processor Scheduling Introduction Processor (CPU) scheduling is the sharing of the processor(s) among the processes in the ready queue.
Uniprocessor Scheduling
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Nachos Project Assignment 3
Scanf n, a, b /* I-O wait */ for (i=1; i
ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Processor Scheduling Hank Levy. 22/4/2016 Goals for Multiprogramming In a multiprogramming system, we try to increase utilization and thruput by overlapping.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
1 Lecture 6 “Nachos” n nachos overview n directory structure n nachos emulated machine n nachos OS n nachos scheduler n nachos threads.
Nachos Project 2 Lecturer: Hao-Hua Chu TA: Chun-Po Wang (Artoo) Date: 2008/10/14 Material Provided by Yuan-Hao Chang, Yung-Feng Lu.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
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.
Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
REAL-TIME OPERATING SYSTEMS
Networks and Operating Systems: Exercise Session 2
April 6, 2001 Gary Kimura Lecture #6 April 6, 2001
Process management Information maintained by OS for process management
Introduction What is an operating system bootstrap
Outline Announcements Process Management – continued
Nachos Assignment#2 Priority Scheduling.
Processes and Threads Part III
Operating systems Process scheduling.
Outline Scheduling algorithms Multi-processor scheduling
Process Management Scheduling
February 5, 2004 Adrienne Noble
Processor Scheduling Hank Levy 1.
Outline Announcement Process Scheduling– continued
Shortest-Job-First (SJR) Scheduling
Chapter 5: CPU Scheduling
Nachos Project Assignment 2 CPU scheduling
Presentation transcript:

Nachos Project Assignment 2 CPU scheduling 2010/11/18

Nachos Assignment 2 Abstract You have already learned how OS schedules processes, so this assignment is to implement one by yourself. Implement a system call – Sleep() Non-preemptive shortest job first scheduler

System Call - Sleep Please implement Sleep(int x) system call block the thread which called this system call, and return to READY state after x timer interrupts.

System Call - Sleep - Hints Please study userprog/exception.cc userprog/syscall.h test/start.s to realize how system calls are implemented.

System Call - test/start.s Assembly language assist to make system calls to the Nachos kernel. Define System call stubs system call code -- r2 arg1 -- r4 arg2 -- r5 arg3 -- r6 arg4 -- r7 The result of the system call, if any, must be put back into r2.

System Call - test/start.s Take System call PrintInt as an example .globl PrintInt .ent PrintInt PrintInt: addiu $2,$0,SC_PrintInt // put system call number in register 2 syscall /* all parameter of this system call will be stored in register4, 5, 6, and 7 by MIPS machine automatically. */ j $31 .end PrintInt

Declare a new system call – userprog/syscall.h Define a new system call ID. Declare the interface for Nachos system calls, which will be called by the user program.

ExceptionHandler - userprog/exception.cc Fetch system call number in Register 2 Add new case to the exception handler case SyscallException: switch(type) { … }

System Call - Sleep (Hint) Modify exception.cc, syscall.h, start.s Modify thread/alarm.cc, thread/alarm.h to implement WaitUntil(int x) to handle Sleep(int x) system call Add a new class to manage these threads blocked by calling Sleep(x).

Nachos Scheduling Policy The Nachos scheduling policy is simple: threads reside on a single, unprioritized ready list, and threads are selected in a round-robin fashion. That is, threads are always appended to the end of the ready list, and the scheduler always selects the thread at the front of the list.

SJF Scheduling Default Nachos scheduling algorithm is Round-Robin,we are going to implement another non-preemptive SJF scheduling Use n+1 = tn + (1- )n to predict next CPU burst n : nth predicted CPU burst length tn : nth actual CPU burst length  : set to 0.5 (one timer interrupt means CPU burst plus 1)

SJF Hint Begin Running Per timer interrupt: 1.Record actual CPU burst Invoke Sleep(x) Per timer interrupt: 1.Record actual CPU burst 2.Wake up next threads 1.Set next predicted CPU burst 2.Insert this thread to Sleeping thread lists 3.Invoke thread->Sleep

SJF Hint You need to modify schedule.cc, alarm.cc and the other related files,and you may add a new class to manager those threads that blocked by calling Sleep(x). Begin Running Invoke Sleep(x) Per timer interrupt: 1.Record actual CPU burst 2.Wake up next threads 1.Set next predicted CPU burst 2.Insert this thread to Sleeping thread lists 3.Invoke thread->Sleep

Assignment Requirements 1.Implement system call “Sleep” 2.Implement Shortest-Job-First scheduling 3.Design several test case to proof your result

Assignment Requirements Assignment Report (12/23 on the class) Please compress the following in a .zip. modified source code(s) with path presentation power-point final report E-mail your .zip (project1_b99901000_b99901001.zip) to TA. Deadline: 2010/12/23 23:59

Grading Policy Correct Result 50% Report 50%