Implement an advanced scheduler

Assignment Help Programming Languages
Reference no: EM131277423

Overview

In this programming assignment, you'll implement priority scheduling algorithm in XV6.

The existing scheduler in xv6 is a Round-Robin (RR) scheduler. On each timer interrupts, the interrupt handler switches to the kernel scheduler, which then selects the next available process to run. This scheduler, while simple, is too primitive to do anything interesting.

Assignment

In this assignment, you'll implement an advanced scheduler that schedules processes based on their priorities. Each process has a priority, and the scheduler always picks the process with the highest priority. The scheduler does RR scheduling for processes with equal priorities. Note: to simplify the assignment, assume all processes are single-threaded.
To implement this scheduler you will need to implement the following system calls:

- int nice(int incr);
- int getpriority();
- int setpriority(int new_priority);

Your scheduler will support five possible priority classes, identified by integers 0, 1, 2, 3, 4. The smaller the integer, the higher the priority. For example, 0 represents the highest priority. nice(incr) system call increases or decreases the priority of the current process by incr. The argument incr may be either positive or negative. For example, if the priority of the current process is 1, and after calling nice(1), the priority will become 2. The system call, nice(incr) , should return 0 only when it successfully increases or decreases the priority of the current process, and should return -1 if the priority exceeds the priority range [0, 4] or upon any other failures.

The system call getpriority() retrieves the priority of the current process, and setpriority(new_priority) sets new priority for the current process. These system calls should return 0 only if it successfully sets the priority, and should return -1 otherwise.

Your implementation must satisfy the following requirements. Your scheduler uses multiple queues of processes. Each queue is associated with a priority class, and it contains all processes with this priority. Only the processes in the RUNNABLE state should be in one of the ready qeueus. On each timer interrupt or when the current process yields the CPU (e.g., via a call to yield()), the scheduler puts the current process to the back of the corresponding queue. It then schedules the process from the front of the ready queue with the highest priority. If the ready queue with the highest priority is empty, the scheduler goes to the next queue, and so on.

Your queues should only store processes in the RUNNABLE state. For example, if a process calls sleep(), it should not stay in the ready queue, until it is woken up. The scheduler should put processes just created or woken up to the back of the corresponding ready queue.

The init process will initially has priority 0 as it was spawned. When some process calls fork(), the child process should inherit the priority of the parent process

Note that to simplify this assignment, we do not ask you to implement per-CPU ready queues. In stead, you keep a global array of ready queues, and the scheduler running on each CPU all grab processes from this global array.

If you need a place to start looking to change the scheduler, look in the proc.c file.

Combining with part 1

The purpose of the first part of this assignment was to create a parallel processing environment that would adequately test the scheduler.

Now we need to change what we did in part 1 so that it uses priorities.

Change the low priority program from part 1 so that when it runs the first thing it does is set its own priority to the lowest priority. Do the same thing for the high priority program except that it is set for the highest priority.

When you run forkExecTest the behavior of the program should now be different from part 1 - specifically, instead of the low priority and high priority programs interweaving the high priority programs should interweave first then the low priority programs should interweave.

Make sure to take out the sleeps in both programs or your schedule may skip processes when they are in SLEEPING state.

What to turn in

For this assignment you will need to create a README file that details every file that you changed from the original XV6 source code. Specifically, have the README file have an entry for each file similar to the following:
- file name that was changed/created
- how that file was changed

With the README file inside the XV6 directory compress the directory - either zip it or tar it - and turn the compressed file.

I DO NOT recommend using "make dist" and "make tar" as there are some bugs that we need to sort out.

Before turning in your project uncompress the file in another directory and test it.

https://www.dropbox.com/s/n3e82cjslj6ye3i/xv6-part-1.zip?dl=0

Reference no: EM131277423

Questions Cloud

Determine the maximum allowable compression ratio : A compressor is to be designed for an industrial application in Los Angeles. If the compressor exit temperature is not to exceed 250°C for safety consideration, determine the maximum allowable compression ratio that is safe for all possible weathe..
Determine the rate of entropy generation in that power plant : Using these and other relevant data, determine the rate of entropy generation in that power plant.
What essential factors are taken into consideration : What essential factors are taken into consideration when statistical inference takes place?- How does parameter estimation for a mean differ from that for a percentage?
How this failure may be avoided in the future : The Repeat Offender", suggest the most likely cause for the employee failing to recognize the serious nature of the situation and how this failure may be avoided in the future. Provide support for your rationale.
Implement an advanced scheduler : Implement an advanced scheduler that schedules processes based on their priorities. Each process has a priority, and the scheduler always picks the process with the highest priority.
List the steps in statistical hypothesis testing : List the steps in statistical hypothesis testing. List the steps in "intuitive" hypothesis testing. How are they similar? How are they different?
Plot an enthalpyentropy diagram for water : Using EES (or other) software and actual property data, plot an enthalpyentropy diagram for water that includes the saturation lines. Also, sketch isothermal, isobaric, and constant volume processes on this diagram.
Appropriate design approaches for the selected : Develop a 700-word Executive Summary in which you identify appropriate design approaches for the selected product and service used in the Process Design Matrix.
Implications of finding for the alamo executives belief : About 500 are observed, and 30% are observed being returned to Alamo. What are the implications of this finding for the Alamo executives' belief?

Reviews

len1277423

11/15/2016 2:31:54 AM

Can you do this assignment using Linux ? This assignment is a second part. The first part solution is completed and is attached. Also the instruction for the second part and all what you need is attached.

Write a Review

Programming Languages Questions & Answers

  Implement sumpairs and sumof

Using SML writes a version of sumPairs that sums each component of the pairs separately, returning a pair consisting of the sumof the first components and the sum of the second components

  Determine proper lower bound and upper bound on ?nal value

Determine the proper lower bound and upper bound on the ?nal value of the shared variable tally output by this concurrent program.

  Write a web application which will give report of balance

Write a web application which will provide a report of the balance held in the visitor's account during the past several months.

  Use the linked stack class to support

Use the Linked stack class to support an application that tracks the status of an online auction. Budding begins at 1(dollars, pounds, euros, or whatever) and proceeds in increments of at least 1

  Write application to compute the total cost of new carpet

Write the application which computes the total cost of new carpet for a rectangular room. Application must first ask user for the current cost of the carpet per square foot. It then asks for both length.

  Direction and magnitude be integers or doubles

Design the program consider Will the direction and magnitude be integers or doubles - will the input vectors be passed by value, by reference, or by const reference?

  Create modular program to enter monthly costs

Create modular program which ask user to enter monthly costs for the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires, and maintenance.

  Create program that uses array of shape

Create a program that uses an array of Shape references to objects of each concrete class in the hierarchy. The program should print a text description of the object to which each array elements

  Apply the software development concepts, tools and design

You are expected to exercise good programming style and practices (i.e., follow the design guidelines, use meaningful variable names, indentation, blank lines and blank spaces to improve readability, and comments).

  Write a program to create an array called first

Write a program to create an array called first, initialized with your first name followed by a space, and then your last name in the ROM space. The main code should read each element of this array; convert it to uppercase and save it in an array ..

  Write a program with three functions upper lower and reverse

Write a program with three functions: upper, lower, and reverse. The upper function will accept a pointer to a string or C-string as an argument. It will step through each character in the string converting it to uppercase.

  Write program which demands user to enter ten numbers

Write the program which demands user to enter 10 numbers (using an input box) and prints (using a message box) message ‘negative' if number is less than zero.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd