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<pthread.h> | |
struct parameter_t{ | |
int data1; | |
int data2; | |
}structure; | |
void* pthread_func(void* arg){ |
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<pthread.h> | |
#include<semaphore.h> | |
sem_t mutex,writeblock; | |
int data = 0,rcount = 0; | |
void *reader(void *arg) | |
{ | |
int f; |
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<unistd.h> | |
int main() | |
{ | |
pid_t pid; | |
int i,j,k,n; | |
int esum=0,osum=0,tsum=0; | |
printf("\nBefore Call of fork "); |
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<semaphore.h> | |
#include<pthread.h> | |
#define N 5 | |
#define THINKING 0 | |
#define HUNGRY 1 | |
#define EATING 2 | |
#define LEFT (ph_num+4)%N | |
#define RIGHT (ph_num+1)%N | |
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
1 0 3 | |
2 1 3 | |
3 2 2 |
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> | |
int main() | |
{ | |
int i,p[20],a[20],b[20],br[20],tat[20],gantt[100][2],n1,n2,n3,c,d,e=0,f=0,g,time=0,t1,t2,t3,t4,t5,t6; | |
float v1=0.0,v2=0.0; | |
FILE *fp; | |
fp=fopen("sjf.txt","r"); | |
while (fscanf(fp,"%d%d%d",&n1,&n2,&n3)!=EOF) | |
{ | |
p[e]=n1; |
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 bt[20],p[20],wt[20],tat[20],pr[20],i,j,n,total=0,pos,temp,avg_wt,avg_tat; | |
printf("Enter Total Number of Process:"); | |
scanf("%d",&n); | |
printf("\nEnter Burst Time and Priority\n"); | |
for(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 main() | |
{ | |
int bt[20],p[20],wt[20],tat[20],i,j,n,total=0,pos,temp; | |
float avg_wt,avg_tat; | |
printf("Enter number of process:"); | |
scanf("%d",&n); | |
printf("\nEnter Burst Time:\n"); |
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 display(); | |
void getInput(); | |
void calculateWaitTime(); | |
void turnAroundTime(); | |
int n, a[100],b[100]; | |
int main(){ |
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 <iostream> | |
#include <fstream> | |
#include <string> | |
using namespace std; | |
class FileHandling{ | |
public: | |
void read(string name){ | |
string line; | |
ifstream myfile(name.c_str()); |