Nachos Assignment#2 Priority Scheduling.

Slides:



Advertisements
Similar presentations
Module R2 Overview. Process queues As processes enter the system and transition from state to state, they are stored queues. There may be many different.
Advertisements

Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
Java Threads CS Introduction to Operating Systems.
Nachos Instructional OS and Project 1 CS 170, Tao Yang.
Welcome to the World of Nachos CPS 110 Spring 2004 Discussion Session 1.
Threads Many software packages are multi-threaded Web browser: one thread display images, another thread retrieves data from the network Word processor:
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
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.
1 Java Threads Instructor: Mainak Chaudhuri
Chapter 1 Process and Thread. 1.2 process The address space of a program – Text – Code – Stack – Heap A set of registers – PC – SP Other resources – Files.
1 RTOS Design Some of the content of this set of slides is taken from the documentation existing on the FreeRTOS website
Processes & Threads Bahareh Goodarzi. Single & Multiple Thread of control code files data code files data.
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
Nachos Project Assignment 2 CPU scheduling
Nachos Instructional OS CS 270, Tao Yang, Spring 2011.
Team Project 1 Dr. Sunny Jeong & M.H. Park. Priority Scheduling Define your own priority, at least two According to each priority, implements suitable.
Introduction to Threads Session 01 Java Simplified / Session 14 / 2 of 28 Objectives Define a thread Define multithreading List benefits of multithreading.
CS140 Project 1: Threads Slides by Kiyoshi Shikuma.
Java 3: Odds & Ends Advanced Programming Techniques.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Processor Scheduling Hank Levy. 22/4/2016 Goals for Multiprogramming In a multiprogramming system, we try to increase utilization and thruput by overlapping.
1 Lecture 6 “Nachos” n nachos overview n directory structure n nachos emulated machine n nachos OS n nachos scheduler n nachos threads.
NachOS Threads System Road Map through the Code Lab 3.
Threads b A thread is a flow of control in a program. b The Java Virtual Machine allows an application to have multiple threads of execution running concurrently.
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.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Tutorial 2: Homework 1 and Project 1
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Threaded Programming in Python
Processes and threads.
Process concept.
Process Management Process Concept Why only the global variables?
OPERATING SYSTEMS CS3502 Fall 2017
Networks and Operating Systems: Exercise Session 2
CS399 New Beginnings Jonathan Walpole.
April 6, 2001 Gary Kimura Lecture #6 April 6, 2001
Chapter 3: Processes.
Intro to Processes CSSE 332 Operating Systems
Nachos Threads and Concurrency
Process management Information maintained by OS for process management
Nachos Instructional OS
Introduction What is an operating system bootstrap
OverView of Scheduling
Multithreading.
Process & its States Lecture 5.
Multithreading 2 Lec 24.
PROCESS MANAGEMENT Information maintained by OS for process management
Multithreading.
Process Description and Control
CPU scheduling decisions may take place when a process:
Threads Chapter 5 2/17/2019 B.Ramamurthy.
Threads Chapter 5 2/23/2019 B.Ramamurthy.
Process Description and Control
Java Thread.
Still Chapter 2 (Based on Silberchatz’s text and Nachos Roadmap.)
Process Description and Control
Threads and Concurrency
Processor Scheduling Hank Levy 1.
Thomas E. Anderson, Brian N. Bershad,
Realizing Concurrency using Posix Threads (pthreads)
Uniprocessor scheduling
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
CS510 Operating System Foundations
CPU SCHEDULING CPU SCHEDULING.
Scheduling 21 May 2019.
Chapter 3: Processes Process Concept Process Scheduling
[Most of the details about queues are left for to read about and work out in Lab 6.] Def. As a data structure, a queue is an ordered collection of data.
Nachos Project Assignment 2 CPU scheduling
Threads CSE 2431: Introduction to Operating Systems
CS Introduction to Operating Systems
Presentation transcript:

Nachos Assignment#2 Priority Scheduling

Nachos scheduling policy :FIFO Jobs run to completion in order of arrival. In interactive systems, run until I/O; after I/O completes, put back at end of queue . Response time poor . Scheduling is handled by routines in the Scheduler object:

Scheduler The scheduler is invoked whenever the current thread wishes to give up the CPU For example, the current thread may have initiated an I/O operation and must wait for it to complete before executing further

Implement priority scheduling Add the method void Thread:SetPriority (int p) to set the priority of a thread. When the scheduler makes a decision as to next thread to run from the readyList,it selects the thread with the highest priority. The higher the value of p, the higher the priority.

Thread introduction Status: READY: RUNNING: BLOCKED: JUST_CREATED:

Thread introduction Some operations: Fork(VoidFunctionPtr func, int arg) Initialize the stack and put the thread on the ready queue void Yield() Suspend the calling thread and select a new one for execution

Class “thread” Add member data “priority” Add member function getPriority setPriority

Class “list” Original: Add following method (e.g.): void Prepend(T item); void Append(T item); Add following method (e.g.): Void SortedPrepend(); Void SortedAppend();

void ReadyToRun(Thread *thread): Make thread ready to run and place it on the ready list It simply changes its state to READY and places it on the ready list ReadyToRun is invoked, for example, by Thread::Fork() after a new thread has been created. Modify: readyList->Append(thread);

Thread *FindNextToRun(): Select a ready thread and return it. FindNextToRun simply returns the thread at the front of the ready list. Modify: return readyList->RemoveFront() //If priority of selected thread is lower,put it back and return NULL

void Run(Thread *nextThread): Do the dirty work of suspending the current thread and switching to the new one. Note that it is the currently running thread that calls Run(). A thread calls this routine when it no longer wishes to execute. Change the state of newly selected thread to RUNNING

Project grading policy Primary requirement Priority scheduling implementation :85% Documentation :15% Bonus How to verify your work?: +20%

Project Deadline 6/25 24:00 E-mail your project to r91050@im.ntu.edu.tw Use student id as file name.(one of the two group member) Ex:R91725050

Your files SHOULD include: Modified files Test files (Bonus) 5 page-report Do not put source code in your report. Explain why you chose to modify these files. Problems encountered and your solution Anything else. Package your files in .tar or .zip format.