Nothing Special   »   [go: up one dir, main page]

XV6 Assignment 2-2005736

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

NAME: NILABJA SANYAL; ROLL: 2005736

OS THEORY ASSIGNMENT 2
Implement Round Robin and Priority Scheduling technique both in the single
scheduler of xv6.

SOLUTION:
To accomplish the given task, we need to follow the given steps.

dpro.c
This is a dummy c program which creates a number of child process as mentioned by the user and
consumes CPU time for testing our system calls and scheduling.

Note: makefile edits are shown below in the “EXTRAS” section of this assignment
NAME: NILABJA SANYAL; ROLL: 2005736

proc.h
Before we make any modifications in proc.c scheduler function, we need to add the priority variable
in struct proc.

proc.c
Priority based Round-Robin CPU Scheduling algorithm is based on the integration of round-robin and
priority scheduling algorithm. It retains the advantage of round robin in reducing starvation and also
integrates the advantage of priority scheduling
NAME: NILABJA SANYAL; ROLL: 2005736

We also have to set the default priority of a process, here we set it to be 10.

exec.c
Child processes are given a default priority of 2.
NAME: NILABJA SANYAL; ROLL: 2005736

RUNNING XV6 IN LINUX TERMINAL

 sudo -s
 {enter your password}
 cd xv6
 make clean
 make
 make qemu-nox

OUTPUT:
 we have called dpro functions twice simultaneously which creates a process scenario
 Using the nice system call, we change the priority of the process with pid 9 to 1, thus making
it of a higher priority. Initially dpro was in a “RUNNABLE” state with a priority of 10, which is
highest.
 Now, when we call the “ps” command again, we see the process with pid 9 is in “RUNNING”
state and the previous running process comes into “RUNNABLE” state.
NAME: NILABJA SANYAL; ROLL: 2005736

EXTRAS:
In this assignment “nice” and “ps” systems calls have been used to demonstrate the workings of a
priority based round robin scheduler.

From here on out, implementation of the above mentioned system calls are shown.

syscall.h

defs.h
NAME: NILABJA SANYAL; ROLL: 2005736

user.h

proc.c
NAME: NILABJA SANYAL; ROLL: 2005736

sysproc.c

usys.S
NAME: NILABJA SANYAL; ROLL: 2005736

syscall.c

NOW, ADD THESE FILES

ps.c
NAME: NILABJA SANYAL; ROLL: 2005736

nice.c

FINALLY MAKE THESE CHANGES IN THE MAKEFILE

MAKEFILE

You might also like