NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

The tasks of our group is:
1- Applying Scheduling Algorithm SJF preemptive and RR priority non preemptive,
Number of processes 5 - P1, P2, P3, P4, P5,
Arrival time in order as 0, 2, 4, 5, 7,
Burst time in ms as 3, 4, 2, 12, 8,
Priority 4, 3, 1, 5, 2 (lowest value highest priority), quantum to be selected by you, Contact switch 2ns,
Find: Awt, Tat, Total (explain findings).

2- Print in C++ Generalities of all member groups
#include <iostream>
using namespace std;
int main()
{
cout<< "Operating System FINAL PROJECT n";
cout << " ----------------------------- n";
cout << "Members --From Go1. SE--:n ";
cout << "Dorian Agalli n " ;
cout << "Lutfie Spahui n " ;
cout << "Rudina Himallari n";
cout << "Members --From Go1. CE--:n ";
cout << "Ema Dorzi n";

return 0;
}
3- Print in C++ or Java one from the above scheduling algorithms.
#include <bits/stdc++.h>
using namespace std;
const int N=100005;
int n;
struct process
{
int id;
int burst_time;
int arrival_time;
int waiting_time;
int finishing_time;
int turn_around_time;
};
process P[N];

void SJF()
{
int complete,current_time,index,minimum;
double total_waiting_time = 0.0;
double total_turn_around_time = 0.0;

index = -1;
complete = 0;
current_time = 0;
minimum = INT_MAX;

while(complete < n)
{
for(int i=0; i<n; i++)
{
if(P[i].arrival_time <= current_time)
{
if(P[i].burst_time < minimum && P[i].finishing_time == 0)
{
index = i;
minimum = P[i].burst_time;
}
}
}

if(index >= 0)
{
complete++;
minimum = INT_MAX;
current_time += P[index].burst_time;
P[index].finishing_time = current_time;
P[index].turn_around_time = P[index].finishing_time - P[index].arrival_time;
P[index].waiting_time = P[index].turn_around_time- P[index].burst_time;

total_waiting_time += P[index].waiting_time;
total_turn_around_time += P[index].turn_around_time;

index = -1;
}
else
{
current_time++;
}
}

cout<<fixed<<setprecision(2);
cout<<"Average Waiting Time: "<<(total_waiting_time/n)<<"n";
cout<<"Average Turn Around Time: "<<(total_turn_around_time/n)<<"n";
}

int main()
{
cout<<"Number of Processes: ";
cin>>n;

cout<<"Process Ids:n";
for(int i=0; i<n; i++) cin>>P[i].id;

cout<<"Process Burst Times:n";
for(int i=0; i<n; i++) cin>>P[i].burst_time;

cout<<"Process Arrival Times:n";
for(int i=0; i<n; i++) cin>>P[i].arrival_time;

SJF();

return 0;
}

4- Code a simulator for SJF preemptive scheduling algorithm. (Not mandatory but will be considered for additional scores)
Processes Arrival Time Burst Time Priority
P1 0 3 4
P2 2 4 3
P3 4 2 1
P4 5 12 5
P5 7 8 2
SJF preemptive:
https://educativesite.com/shortest-job-first-sjf-scheduling-algorithm-in-c-and-c-with-gantt-chart/



     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.