Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 fcfs(int arr[],int n,int cur_block) | |
{ | |
//First print the current block | |
printf("%d ",cur_block); | |
for(int i=0;i<n;i++) | |
{ | |
cur_block=arr[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
#Question available at https://www.programminggeek.in/2016/08/codevita-2016-round-2-question-mystery.html#.X4Z9AObitPY | |
#Question available at https://www.programminggeek.in/2016/08/codevita-2016-round-2-question-mystery.html#.X4Z9AObitPY | |
import datetime | |
days_in_week={'Sunday':0,'Monday':1,'Tuesday':2,'Wednesday':3,'Thursday':4,'Friday':5,'Saturday':6} | |
t=int(input()) | |
def calc_stars(diff,year,day,dobj): |
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 main() | |
{ | |
int a[10],b[10],x[10]; | |
int waiting[10],turnaround[10],completion[10]; | |
int i,j,smallest,count=0,time,n; | |
double avg=0,tt=0,end; | |
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> | |
//Sorting in increasing order of arrival time | |
void arrangeArrival(int num, int mat[][6]) | |
{ | |
for(int i=0; i<num; i++) | |
{ | |
for(int j=0; j<num-i-1; j++) | |
{ | |
if(mat[j][1] > mat[j+1][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> | |
// Function to find the waiting time for all | |
// processes | |
void findWaitingTime (int processes [], int n, int bt [], int wt []) | |
{ | |
// waiting time for first process is 0 | |
wt [0] = 0; | |
// calculating waiting time |
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 |
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
#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++) | |
{ |
NewerOlder