This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void fifo(int string[20],int n,int size) | |
{ | |
//Creating array for block storage | |
int frames[n]; | |
//Initializing each block with -1 | |
for (int i=0;i<n;i++) | |
frames[i]=-1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void lru(int string[20],int n,int size) | |
{ | |
//Creating array for block storage | |
int frames[n]; | |
//Initializing each block with -1 | |
for (int i=0;i<n;i++) | |
frames[i]=-1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void optimal(int string[20],int n,int size) | |
{ | |
//Creating array for block storage | |
int frames[n]; | |
//Initializing each block with -1 | |
for (int i=0;i<n;i++) | |
frames[i]=-1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void fifo(int string[20],int n,int size) | |
{ | |
//Creating array for block storage | |
int frames[n]; | |
//Initializing each block with -1 | |
for (int i=0;i<n;i++) | |
frames[i]=-1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void bestFit(int blockSize[],int m,int processSize[],int n) | |
{ | |
//Block allocations for process | |
int allocation[n]; | |
//Initially allocate the index of -1 to all allocation blocks | |
for (int i=0;i<n;i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void firstFit(int blockSize[],int m,int processSize[],int n) | |
{ | |
//Block allocations for process | |
int allocation[n]; | |
//Initially allocate the index of -1 to all allocation blocks | |
for (int i=0;i<n;i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void nextFit(int blockSize[],int m,int processSize[],int n) | |
{ | |
//Block allocations for process | |
int allocation[n]; | |
//Initially allocate the index of -1 to all allocation blocks | |
for (int i=0;i<n;i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void worstFit(int blockSize[],int m,int processSize[],int n) | |
{ | |
//Block allocations for process | |
int allocation[n]; | |
//Initially allocate the index of -1 to all allocation blocks | |
for (int i=0;i<n;i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <semaphore.h> | |
pthread_t *producers; | |
pthread_t *consumers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from threading import Thread, Condition, RLock | |
import time | |
# state | |
HUNGRY = 0 | |
EATING = 1 | |
THINKING = 2 | |
#Monitor class |
OlderNewer