OS LAB File
OS LAB File
Experiment name: Study of software and hardware requirements of various Operating Systems (Windows/Linux/Unix)
and Implementation of DOS commands on command prompt.
Page 1
Implementation of DOS commands on command prompt:-
Page 2
Experiment-2 Date: 07/04/2025
Program:
#include <stdio.h>
Page 3
printf("P%d\t%d\t\t%d\t\t%d\t\t%d\t\t%d\n", p[i], at[i], bt[i], ct[i], tat[i], wt[i]);
totalWT += wt[i];
}
int main() {
int n;
return 0;
}
Page 4
Experiment-3 Date: 21/04/2025
Program:
#include <stdio.h>
typedef struct {
int process_id;
int arrival_time;
int burst_time;
int completion_time;
int turnaround_time;
int waiting_time;
int response_time;
} Process;
Page 5
void printTable(Process processes[], int n) {
printf("\nProcess ID\tArrival Time\tBurst Time\tCompletion Time\tTurnaround Time\tWaiting Time\tResponse Time\n");
for (int i = 0; i < n; i++) {
printf("%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\n",
processes[i].process_id,
processes[i].arrival_time,
processes[i].burst_time,
processes[i].completion_time,
processes[i].turnaround_time,
processes[i].waiting_time,
processes[i].response_time);
}
}
int main() {
int n;
Process processes[n];
return 0;
}
Page 6
Page 7
Experiment-4 Date: 21/04/2025
Program:
#include <stdio.h>
typedef struct {
int process_id;
int arrival_time;
int burst_time;
int remaining_burst_time;
int completion_time;
int turnaround_time;
int waiting_time;
int response_time;
} Process;
// Find the process with the shortest remaining burst time that has arrived
for (int i = 0; i < n; i++) {
if (is_completed[i] == 0 && processes[i].arrival_time <= time && processes[i].remaining_burst_time > 0) {
if (processes[i].remaining_burst_time < min_remaining_time) {
min_remaining_time = processes[i].remaining_burst_time;
shortest_index = i;
}
}
}
Page 8
void calculateTimes(Process processes[], int n) {
for (int i = 0; i < n; i++) {
processes[i].turnaround_time = processes[i].completion_time - processes[i].arrival_time;
processes[i].waiting_time = processes[i].turnaround_time - processes[i].burst_time;
processes[i].response_time = processes[i].waiting_time; // Response time for STRF is the same as waiting time
}
}
int main() {
int n;
Process processes[n];
return 0;
}
Page 9
Page 10