Process Manager – Scheduler – Scheduling solution

$25.00

Original Work ?

Download Details:

  • Name: exercise03.zip
  • Type: zip
  • Size: 2.58 MB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (4 votes)

Modify MINIX scheduling such that it implements fair-share scheduling. With fairshare scheduling, the CPU is shared by a set of processes according to the group to
which they belong. For example, if there are three groups G1, G2 and G3. Each group
should get one third of the CPU time with fair-share scheduling. Let us suppose that
there is one process in G1, three processes in G2, and six processes in G3. The process
in group G1 should get 33% of the CPU time, each process in G2 should get 11% of the
CPU time and each process in G3 should get 5.5% of the CPU time.
Modify the scheduler such that all processes use fair-share scheduling. Group membership is determined by the process group identification (field mp procgrp of struct
mproc), file /usr/src/minix/servers/pm/mproc.h.
Use the following two test programs:
/* File: tester1.c
*
* A CPU-bound process (no children).
*/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
int i, j;
i = 1;
while (1) {
i = j; j = i;
}
}
/* File: tester2.c
*
* A CPU-bound process with one child.
*/
#include <stdio.h>
1
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
int i, j;
fork();
i = 1;
while (1) {
i = j; j = i;
}
}
Start each program in different terminals using ./tester1 & and ./tester2 &.
The command ps can be used to confirm that processes are created in two different
groups:
minix# ps -o pid,ppid,pgid,command
PID PPID PGID COMMAND
667 666 667 -sh
750 667 667 ./tester2
751 750 667 ./tester2
678 677 678 -sh
749 678 678 ./tester1
The field pgid stands for process group ID.
In original MINIX, the command top shows that each of the CPU-bound process
gets approximately one third of the CPU time.
The process associated with tester1 is one group. When started in a different terminal, the two processes associated with tester2 is another group. In MINIX together
with your implementation of fair-share scheduling, the command top should show that
each of the group gets approximately one half of the CPU time, while each of the two
processes in the second group should get approximately of fourth of the CPU time.
minix# ps -o pid,ppid,pgid,command
PID PPID PGID COMMAND
687 631 631 ./tester2
688 687 631 ./tester2
686 682 682 ./tester1
2
There are two groups. Each of them should get close to 50% of the CPU time, while
each of the two processes in the second group should get close to 25% of the CPU time.
Due date: February 4. This exercise must be done in the C programming language
under MINIX 3.4. Submit your work on cuLearn. Submit a single tar.gz file. Include a
README.txt file containing a report about your work (describe every change you made
to the system code and where you made it). Your are responsible for the completeness
of your submission. Your are responsible for submitting your work on time. Your
submission must include a screenshot showing evidence that you code is working (see
the attached example). Open three terminals, call the following sequence of commands:
1. date;uname -v;more tester1.c;./tester1
2. date;uname -v;more tester2.c;./tester2
3. top
3