Starting from:
$35

$29

OS HW3 solution

Process Scheduling


    1. Shortest-Job-First (SJF)

    2. Shortest-Remaining-Time-First (SRTF)

    3. Round-Robin (RR)

    4. Multilevel Feedback Queue

Round-Robin (first layer) + Round-Robin (second layer) + Shortest-Job-First (third)

Shortest-Job-First (SJF)

The format of input file & output



    • Input file(Q1.txt):

    • First line is the total number of process

0 2 4 5    Second line is arrival time of each process

7 4 1 4    Third line is burst Time of each process


    • Output:

You should output the four things in a text file as the next page

        1. Waiting time for each process

        2. Turnaround time for each process

        3. Average waiting time

        4. Average turnaround time

The format of output file






















number space number \n



number \n

...

Shortest-Remaining-Time-First (SRTF)

The format of input file & output



    • Input file(Q2.txt):

    • First line is the total number of process

0 1 2 3    Second line is arrival time of each process

8 4 9 5    Third line is burst Time of each process


    • Output:

You should output the four things in a text file as the next page

        1. Waiting time for each process

        2. Turnaround time for each process

        3. Average waiting time

        4. Average turnaround time

The format of output file






















number space number \n



number \n

...

Round-Robin (RR)

The format of input file & output



    • Input file(Q3.txt):

    • First line is the total number of process

0 2 4 5    Second line is arrival time of each process

7 4 1 4    Third line is burst Time of each process

4Fourth line is the time quantum


    • Output:

You should output the four things in a text file as the next page 1. Waiting time for each process

2. Turnaround time for each process

3. Average waiting time

4. Average turnaround time

The format of output file






















number space number \n



number \n

...

Multilevel Feedback Queue





    • Processes in lower priority queue is selected if the higher queues are empty.

    • A new job enters high priority queue which is served RR. When it gains CPU, job receives t1 milliseconds. If it doesn’t finish in t1 milliseconds, job is moved to medium priority queue.

    • If high priority queue is empty, processes at medium priority queue is served RR and receives t2 additional milliseconds. If it still does not complete, it is preempted and moved to low priority queue which is served SJF; otherwise it is kept in the same queue.

Multilevel Feedback Queue

The format of input file & output


    • Input file(Q4.txt):

    • First line is the total number of process

0 1 2
Second line is arrival time of each process
1082
Third line is burst Time of each process
2 3
Fourth line is burst Time quantum for high priority Queue & medium priority Queue


    • Output:

You should output the four things in a text file as the next page

        1. Waiting time for each process

        2. Turnaround time for each process

        3. Average waiting time

        4. Average turnaround time

The format of output file






















number space number \n



number \n

...

Rest Time




































(PS: Process Queue is result, not scheduling.)

Rest Time

































(PS: Process Queue is result, not scheduling.)

Rest Time

































(PS: Process Queue is result, not scheduling.)

Rest Time

































(PS: Process Queue is result, not scheduling.)

Rest Time

































(PS: Process Queue is result, not scheduling.)

Rest Time































reference:https://www.youtube.com/watch?v=VM5BEiVEsvg&fbclid=IwAR2XVhAyA6bCHG7LZ01Hd6 6SneKGKZuRPDc3_SlqrzDagXviluTZnzjYiT4

Requirements


    1. You should write codes in c/c++


    2. Put all of *.cpp source files and report into same compressed file. The type of compressed file must be “zip”

    3. The name of your compressed file must have the form of “student ID_OS_hw3.zip”


    4. The name of .cpp file must in the form of “student ID_hw3-1.cpp” &

“student ID_hw3-2.cpp” & “student ID_hw3-3.cpp” & “student ID_hw3-4.cpp” (ex: ./Student ID_OS_hw3-1.out ./Q1.txt)

Grade


Total score: 100pts. COPY WILL GET A POINT!

    • HW3-1: 20pts

    • HW3-2: 20pts

    • HW3-3: 20pts

    • HW3-4: 20pts

    • Report: 20pts

    • Incorrect file form: -20 pts

(Including the names of compressed file, .cpp file and the output)

    • Deadline is 2018/11/18 midnight. Late submission will get 0 pts

More products