Experiment-1 Date: 07/04/2025
Experiment name: Study of software and hardware requirements of various Operating Systems (Windows/Linux/Unix)
and Implementation of DOS commands on command prompt.
Operating System Software, Programming Languages and Hardware Requirements:-
Operating Minimum Hardware Recommended Supported Programming Supported
System Requirements Hardware Languages Platforms
Requirements
Windows - Processor: 1 GHz or - Processor: 2 GHz or - C, C++, C#, Java, Python, - Desktop, Laptop,
faster, 32-bit or 64-bit faster, 64-bit Ruby, JavaScript, Swift, Server, IoT
.NET
- RAM: 1 GB (32-bit), 2 - RAM: 4 GB or higher - PowerShell, PHP, Go, etc.
GB (64-bit)
- Storage: 16 GB (32- - Storage: 50 GB or
bit), 20 GB (64-bit) more
- Graphics: DirectX 9 or - Graphics: Dedicated
later with WDDM GPU (Optional)
driver
Linux - Processor: 1 GHz or - Processor: Multi-core - C, C++, Python, Java, - Desktop, Server,
faster processor Ruby, PHP, JavaScript, Mobile (via
Bash, Go, Rust Android)
- RAM: 512 MB - RAM: 4 GB or more - Perl, Swift, Rust, Kotlin
minimum
- Storage: 5 GB or more - Storage: 20 GB or
more
- Graphics: Integrated - Graphics: Dedicated
graphics (for desktop) GPU (optional for
gaming)
Unix - Processor: 1 GHz or - Processor: Multi-core - C, C++, Java, Perl, Python, - Server, High-end
higher processor Bash, Ruby systems, Embedded
- RAM: 512 MB - RAM: 2 GB or more
minimum
- Storage: 2 GB or more - Storage: 10 GB or
more
MacOS - Processor: Intel/Apple - Processor: M1/M2 - Swift, Objective-C, C, - MacBook, iMac,
Silicon (M1, M2) with more cores C++, Java, Python, Ruby, Mac Mini, Server
JavaScript, Go
- RAM: 4 GB minimum - RAM: 8 GB or more - AppleScript, Kotlin
- Storage: 35 GB or - Storage: 256 GB or
more more
- Graphics: Integrated - Graphics: Dedicated
graphics (Apple Silicon) GPU (for Pro devices)
Android - Processor: ARM- - Processor: ARM- - Java, Kotlin, C++, Python, - Smartphones,
based, 1 GHz or higher based, multi-core JavaScript, HTML, Dart, Go Tablets, Wearables
- RAM: 512 MB - RAM: 4 GB or more
minimum
- Storage: 8 GB or more - Storage: 16 GB or
more
- Graphics: OpenGL ES - Graphics: OpenGL ES
2.0 3.0 or higher
Page 1
Implementation of DOS commands on command prompt:-
Command Syntax Example
dir dir [path] dir C:\Users\YourUsername
cd cd [path] cd C:\Users\YourUsername\Documents
cls cls cls
echo echo [message] echo Hello, World!
mkdir mkdir [directory_name] mkdir MyFolder
rmdir rmdir [directory_name] rmdir MyFolder
del del [file_name] del myfile.txt
copy copy [source] [destination] copy C:\file.txt D:\Backup\
move move [source] [destination] move C:\file.txt D:\Documents\
rename rename [old_name] [new_name] rename file.txt newfile.txt
type type [file_name] type myfile.txt
exit exit exit
ipconfig ipconfig ipconfig
ping ping [hostname or IP] ping google.com
tasklist tasklist tasklist
taskkill taskkill /PID [process_id] taskkill /PID 1234
systeminfo systeminfo systeminfo
chkdsk chkdsk [drive:] chkdsk C:
format format [drive:] format D:
tree tree [path] tree C:\Users\YourUsername
attrib attrib [file_name] attrib +r myfile.txt
fc fc [file1] [file2] fc file1.txt file2.txt
date date date 04-21-2025
time time time 12:30:00
Page 2
Experiment-2 Date: 07/04/2025
Experiment name: Write a program to implement FCFS CPU Scheduling Algorithm.
Program:
#include <stdio.h>
// Function to sort processes by arrival time
void sortProcesses(int n, int p[], int at[], int bt[]) {
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (at[i] > at[j]) { // Swap based on arrival time
int temp;
// Swap arrival times
temp = at[i];
at[i] = at[j];
at[j] = temp;
// Swap burst times
temp = bt[i];
bt[i] = bt[j];
bt[j] = temp;
// Swap process IDs
temp = p[i];
p[i] = p[j];
p[j] = temp;
}
}
}
}
// Function to calculate completion time
void calculateCompletionTime(int n, int at[], int bt[], int ct[]) {
ct[0] = at[0] + bt[0];
for (int i = 1; i < n; i++) {
if (at[i] > ct[i-1]) {
ct[i] = at[i] + bt[i];
} else {
ct[i] = ct[i-1] + bt[i];
}
}
}
// Function to calculate turnaround time
void calculateTurnaroundTime(int n, int at[], int ct[], int tat[]) {
for (int i = 0; i < n; i++) {
tat[i] = ct[i] - at[i];
}
}
// Function to calculate waiting time
void calculateWaitingTime(int n, int tat[], int bt[], int wt[]) {
for (int i = 0; i < n; i++) {
wt[i] = tat[i] - bt[i];
}
}
// Function to display results
void displayResults(int n, int p[], int at[], int bt[], int ct[], int tat[], int wt[]) {
float totalWT = 0;
printf("\nProcess\tArrival Time\tBurst Time\tCompletion Time\tTurnaround Time\tWaiting Time\n");
for (int i = 0; i < n; i++) {
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];
}
printf("\nAverage Waiting Time: %.2f\n", totalWT / n);
}
int main() {
int n;
printf("Enter the number of processes: ");
scanf("%d", &n);
int p[n], at[n], bt[n], ct[n], tat[n], wt[n];
// Input process details
for (int i = 0; i < n; i++) {
p[i] = i; // Process IDs P0, P1, P2, etc.
printf("Enter Arrival Time and Burst Time for Process P%d: ", i);
scanf("%d %d", &at[i], &bt[i]);
}
// Sort processes based on arrival time
sortProcesses(n, p, at, bt);
// Compute scheduling times
calculateCompletionTime(n, at, bt, ct);
calculateTurnaroundTime(n, at, ct, tat);
calculateWaitingTime(n, tat, bt, wt);
// Display the results
displayResults(n, p, at, bt, ct, tat, wt);
return 0;
}
Page 4
Experiment-3 Date: 21/04/2025
Experiment name: Write a program to implement SJF CPU Scheduling Algorithm.
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;
void findCompletionTime(Process processes[], int n) {
int time = 0;
int completed = 0;
int min_burst_time, shortest_index;
int remaining_burst[n];
// Initialize remaining burst times
for (int i = 0; i < n; i++) {
remaining_burst[i] = processes[i].burst_time;
}
while (completed < n) {
min_burst_time = 999999;
shortest_index = -1;
// Find the process with the shortest burst time
for (int i = 0; i < n; i++) {
if (remaining_burst[i] > 0 && processes[i].arrival_time <= time) {
if (processes[i].burst_time < min_burst_time) {
min_burst_time = processes[i].burst_time;
shortest_index = i;
}
}
}
// If no process is ready to execute, move time forward
if (shortest_index == -1) {
time++;
continue;
}
// Execute the process
time += processes[shortest_index].burst_time;
processes[shortest_index].completion_time = time;
remaining_burst[shortest_index] = 0;
completed++;
}
}
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 SJF is same as waiting time
}
}
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;
// Input number of processes
printf("Enter the number of processes: ");
scanf("%d", &n);
Process processes[n];
// Input process details
for (int i = 0; i < n; i++) {
processes[i].process_id = i + 1;
printf("\nEnter Arrival Time and Burst Time for Process %d:\n", i + 1);
printf("Arrival Time: ");
scanf("%d", &processes[i].arrival_time);
printf("Burst Time: ");
scanf("%d", &processes[i].burst_time);
}
// Sort processes based on Arrival Time
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (processes[i].arrival_time > processes[j].arrival_time) {
Process temp = processes[i];
processes[i] = processes[j];
processes[j] = temp;
}
}
}
// Find the completion times of all processes
findCompletionTime(processes, n);
// Calculate Turnaround Time, Waiting Time, and Response Time
calculateTimes(processes, n);
// Print the results in tabular form
printTable(processes, n);
return 0;
}
Page 6
Page 7
Experiment-4 Date: 21/04/2025
Experiment name: Write a program to implement SRTF CPU Scheduling Algorithm.
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;
void findCompletionTime(Process processes[], int n) {
int time = 0;
int completed = 0;
int min_remaining_time, shortest_index;
int is_completed[n];
// Initialize completed status and remaining burst times
for (int i = 0; i < n; i++) {
is_completed[i] = 0;
processes[i].remaining_burst_time = processes[i].burst_time;
}
while (completed < n) {
min_remaining_time = 999999;
shortest_index = -1;
// 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;
}
}
}
// If no process is ready to execute, move time forward
if (shortest_index == -1) {
time++;
continue;
}
// Execute the process
processes[shortest_index].remaining_burst_time--;
time++;
// If the process is completed
if (processes[shortest_index].remaining_burst_time == 0) {
processes[shortest_index].completion_time = time;
is_completed[shortest_index] = 1;
completed++;
}
}
}
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
}
}
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;
// Input number of processes
printf("Enter the number of processes: ");
scanf("%d", &n);
Process processes[n];
// Input process details
for (int i = 0; i < n; i++) {
processes[i].process_id = i + 1;
printf("\nEnter Arrival Time and Burst Time for Process %d:\n", i + 1);
printf("Arrival Time: ");
scanf("%d", &processes[i].arrival_time);
printf("Burst Time: ");
scanf("%d", &processes[i].burst_time);
}
// Sort processes based on Arrival Time
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (processes[i].arrival_time > processes[j].arrival_time) {
Process temp = processes[i];
processes[i] = processes[j];
processes[j] = temp;
}
}
}
// Find the completion times of all processes using STRF
findCompletionTime(processes, n);
// Calculate Turnaround Time, Waiting Time, and Response Time
calculateTimes(processes, n);
// Print the results in tabular form
printTable(processes, n);
return 0;
}
Page 9
Page 10