Sunday, 30 August 2015

Implement Best-Fit memory management schemes.

#include<iostream>
using namespace std;

typedef struct Process
{
    int process_id;
    int processSize;
    int allocatedHole;
}Process;

typedef struct Hole
{
    int hole_id;
    int holeSize;
    bool allocated;
}Hole;

Implement First-Fit memory management schemes.

#include<iostream>
using namespace std;

typedef struct Process
{
    int process_id;
    int processSize;
    int allocatedHole;
}Process;

typedef struct Hole
{
    int hole_id;
    int holeSize;
    bool allocated;
}Hole;

int main()
{
    int n,m,i,j,flag=0;
    cout<<"Enter the number of holes : ";
    cin>>m;
    Hole hole[m+1];
    for(i=1;i<=m;i++)

Implement the Priority scheduling for, Given the list of processes, their CPU burst times and arrival times, print the Gantt chart for Priority and also compute and print the average waiting time and average turnaround time.

#include<stdio.h>

main()

{

float avgwt,avgtt;

char pname[10][10],c[10][10];

int wt[10],tt[10],bt[10],pt[10],t,q,i,n,sum=0,sbt=0,ttime,j,ss=10; printf("\n\n Enter the number of processes : "); scanf("%d",&n);

printf("\n\n Enter the NAME and BURSTTIME "); for(i=0;i<n;i++)

{

printf("\n\n NAME : "); scanf("%s",&pname[i]); printf("\n\n BURSTTIME : "); scanf("%d",&bt[i]);

}


printf("\n\n Enter the priorities of the processes "); for(i=0;i<n;i++)

{

printf("\n\n Priority of process%d : ",i+1); scanf("%d",&pt[i]);

}

for(i=0;i<n;i++)

for(j=i+1;j<n;j++)

Implement the Round Robin scheduling for, Given the list of processes, their CPU burst times and arrival times, print the Gantt chart for RR and also compute and print the average waiting time and average turnaround time.

#include<stdio.h>

main()

{

int pt[10][10],a[10][10],at[10],pname[10][10],i,j,n,k=0,q,sum=0;

float avg;

printf("\n\n Enter the number of processes : "); scanf("%d",&n);

for(i=0;i<10;i++)

{

for(j=0;j<10;j++)