0% found this document useful (0 votes)
2 views22 pages

Ritikos1 Merged (1)

The document outlines a case study on Linux installation, detailing the features of the Linux operating system and providing a step-by-step guide for installation. It also includes algorithms and source code for simulating CPU scheduling algorithms such as Round Robin, SJF, and FCFS. The document concludes with reminders for system updates and software installations post-Linux setup.

Uploaded by

rajatparkhe25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views22 pages

Ritikos1 Merged (1)

The document outlines a case study on Linux installation, detailing the features of the Linux operating system and providing a step-by-step guide for installation. It also includes algorithms and source code for simulating CPU scheduling algorithms such as Round Robin, SJF, and FCFS. The document concludes with reminders for system updates and software installations post-Linux setup.

Uploaded by

rajatparkhe25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Name – Ritik Yadav Operating System

Enrollment No – 0827CS231221 Subject Code: CS 405

EXPERIMENT – 03

Case Study: Linux Installation

The Linux System


 An operating system is a program that acts as an interface between
the user and the computer hardware and controls the execution of all
kinds of programs.
 The Linux open source operating system, or Linux OS, is a freely
distributable, cross-platform operating system based on UNIX.
 The Linux system consists of a kernel and some system programs.
There are also some application programs for doing work.
 The kernel is the heart of the operating system, which provides a set
of tools that are used by system calls.
 The defining component of Linux is the Linux kernel, an operating
system kernel first released on 5 October 1991 by Linus Torvalds.
 A Linux-based system is a modular Unix-like operating system. It
derives much of its basic design from principles established in UNIX.
 Such a system uses a monolithic kernel, which handles process
control, networking, peripheral access, and file system access.

Important Features of Linux Operating System


 Portable: Portability means software can work on different types of
hardware in the same way. Linux kernel and application programs
support their installation on any kind of hardware platform.
 Open Source: Linux source code is freely available and it is a
community-based development project.
 Multi-User & Multiprogramming: Linux is a multi-user system where
multiple users can access system resources like memory, RAM, and
application programs at the same time. It is also a multiprogramming
system, meaning multiple applications can run simultaneously.
 Hierarchical File System: Linux provides a standard file structure in
which system files and user files are arranged.
 Shell: Linux provides a special interpreter program, which can be
used to execute commands of the operating system.
 Security: Linux provides user security using authentication features
like password protection, controlled access to specific files, and
encryption of data.

Installing Linux on a Computer: Step-by-Step Case Study


 Step 1: Choose a Linux Distribution
- Research different Linux distributions and choose one that best fits
your needs.
- Popular options include Ubuntu, Fedora, Debian, and Linux Mint.
 Step 2: Download the Linux Distribution
- Go to the official website of the chosen Linux distribution and
download the installation ISO file.
- Make sure to select the appropriate version for your system
architecture (32-bit or 64-bit).
 Step 3: Create a Bootable USB Drive or DVD
- Prepare a USB drive with at least 4GB capacity or a blank DVD.
- Use a tool like Rufus (for Windows) or Etcher (for macOS and
Linux) to create a bootable USB drive using the downloaded ISO file.
- If using a DVD, burn the ISO file to the disc using DVD burning
software.
 Step 4: Backup Your Data (Optional)
- It is recommended to back up your important data to an external
storage device or cloud service before installation.
 Step 5: Boot from the Installation Media
- Insert the bootable USB drive or DVD into your computer.
- Restart the computer and access the boot menu (commonly
F12ESC, or Del key).
- Choose the USB drive or DVD as the boot device.
 Step 6: Start the Installation Process
- The Linux installer will load and present various options.
- Select your language and click "Install" or "Start Installation".
 Step 7: Configure Installation Settings
- Follow the on-screen instructions to configure language, keyboard
layout, time zone, and disk partitioning.
- New users can choose the default or guided partitioning option.
 Step 8: Create User Account
- Create a username and password. This account will have
administrative (sudo) access by default.
 Step 9: Begin the Installation
- Review all settings and click "Install" or "Begin Installation".
- The system will copy files, install packages, and configure itself
based on your choices.
 Step 10: Reboot the System
- Once installation is complete, you'll be prompted to reboot.
- Remove the USB drive or DVD before rebooting.
 Step 11: Set Up Linux
- After rebooting, log in with the credentials created.
- Follow any additional prompts to configure settings such as Wi-Fi,
display resolution, and software updates.

Conclusion
 You have successfully installed Linux on your computer.
 Remember to:
- Update your system
- Install any required software
 Enjoy your new Linux experience!
 Note: Installation steps may slightly vary depending on the specific Linux
distribution. It is always best to refer to official documentation or user guides
provided by the Linux distribution for detailed instructions.
Name of Student: Ritik Yadav Class: B.Tech
Enrollment No: 0827CS231221 Batch B1
Date of Experiment: Date of Submission Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:

Algorithm:A program to simulate the Round Robin CPU scheduling algorithm.


Solution:

SOURCE CODE:
#include <stdio.h>
struct process {
int burst; // Total burst time
int wait; // Waiting time
int comp; // Completed time (how much CPU time given)
int f; // Flag to check if process is done (1 = not done, 0 = done)
} p[20];

int main() {
int n, i, j;
int totalwait = 0, totalturn = 0;
int quantum;
int flag = 1;
int time = 0;

printf("Enter the number of processes: ");


scanf("%d", &n);

printf("Enter the quantum time (in ms): ");


scanf("%d", &quantum);

for(i = 0; i < n; i++) {


printf("Enter the burst time (in ms) for process #%d: ", i + 1);
scanf("%d", &p[i].burst);
p[i].comp = 0;
p[i].wait = 0;
p[i].f = 1; // Process not finished
}
printf("\nOrder of execution:\n");
printf("Process\tStart Time\tEnd Time\tRemaining Time\n");
// Round Robin execution loop
while(flag == 1) {
flag = 0;
for(i = 0; i < n; i++) {
if(p[i].f == 1) { // Process not finished
Name of Student: Ritik Yadav Class: B.Tech
Enrollment No: 0827CS231221 Batch B1
Date of Experiment: Date of Submission Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
flag = 1;
int exec_time = quantum;
int remaining = p[i].burst - p[i].comp;

if(remaining > quantum) {


p[i].comp += quantum;
} else {
exec_time = remaining;
p[i].wait = time - p[i].comp; // Time spent waiting till now
p[i].comp = p[i].burst;
p[i].f = 0; // Mark process as finished
}
printf("P%-5d %-11d %-10d %-14d\n", i + 1, time, time + exec_time,
p[i].burst - p[i].comp);
time += exec_time;
}
}
}
printf("\n \n");
printf("Process\tWaiting Time\tTurnaround Time\n");

for(i = 0; i < n; i++) {


int turnaround = p[i].wait + p[i].burst;
printf("P%-7d %-14d %-14d\n", i + 1, p[i].wait, turnaround);
totalwait += p[i].wait;
totalturn += turnaround;
}
printf("\nAverage Waiting Time: %.2f ms\n", totalwait / (float)n);
printf("Average Turnaround Time: %.2f ms\n", totalturn / (float)n);

return 0;
}
Name of Student: Ritik Yadav Class: B.Tech
Enrollment No: 0827CS231221 Batch B1
Date of Experiment: Date of Submission Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
OUTPUT:
Name of Student: Ritik Yadav Class: B.Tech
Enrollment No: 0827CS231221 Batch: B-01
Date of Experiment:23/05/25 Date of Submission Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:

Algorithm:A program to simulate the SJF CPU scheduling algorithm.


Solution:

SOURCECODE:
#include<stdio.h>

intmain(){
inti,j,n,temp;
intpno[10],bt[10],wt[10],tt[10]; float
sum = 0, at = 0;

printf("Enterthenumberofprocesses:"); scanf("%d",
&n);

//Inputbursttimesandinitializeprocessnumbers
printf("Enter the burst time of each process:\n");
for (i = 0; i < n; i++) {
printf("P%d:", i);
scanf("%d",&bt[i]);
pno[i]=i;//Initializeprocessnumber
}

//Sortbybursttime(SJF)
for(i=0;i< n-1;i++){
for(j=i+1;j<n;j++){ if
(bt[i] > bt[j]) {
//Swapbursttimes
temp = bt[i];
bt[i] = bt[j];
bt[j]=temp;

//Swapprocessnumbers temp
= pno[i];
pno[i]=pno[j];
pno[j] = temp;
}
}
}
Name of Student: Ritik Yadav Class: B.Tech
Enrollment No: 0827CS231221 Batch: B-01
Date of Experiment:23/05/25 Date of Submission Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
//Calculatewaitingtime
wt[0] = 0;
for(i=1;i<n;i++){
wt[i]=wt[i-1]+bt[i-1]; sum +=
wt[i];
}

//Calculateturnaroundtimeandtotalturnaroundtime
printf("\nProcessNo.\tBurstTime\tWaitingTime\tTurnaroundTime\n"); for
(i = 0; i < n; i++) {
tt[i]=bt[i]+wt[i]; at
+= tt[i];
printf("P%d\t\t%d\t\t%d\t\t%d\n",pno[i],bt[i],wt[i],tt[i]);
}

printf("\nAverage Waiting Time: %.2f", sum / n);


printf("\nAverageTurnaroundTime:%.2f\n",at/n);

return0;
}
Name of Student: Ritik Yadav Class: B.Tech
Enrollment No: 0827CS231221 Batch: B-01
Date of Experiment:23/05/25 Date of Submission Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:

OUTPUT:
Name of Student: Ritik Yadav Class: B.Tech
Enrollment No: 0827CS231221 Batch: B-01
Date of Experiment: 23/05/25 Date of Submission Submitted on: 30/05/25
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:

Algorithm:A program to simulate FCFS CPU scheduling algorithm.


Solution:

SOURCECODE:
#include <iostream>
#include <vector>
using namespace std;

struct Process {
int process_id;
int arrival_time;
int burst_time;
int start_time;
int completion_time;
int turnaround_time;
int waiting_time;

Process(int id, int at, int bt) {


process_id = id;
arrival_time = at;
burst_time = bt;
}
};

void fcfs_scheduling(vector<Process>& process_list) {


int current_time = 0;
for (auto& process : process_list) {
if (current_time < process.arrival_time) {
current_time = process.arrival_time;
}
process.start_time = current_time;
current_time += process.burst_time;
process.completion_time = current_time;
process.turnaround_time = process.completion_time - process.arrival_time;
process.waiting_time = process.turnaround_time - process.burst_time;
}

double avg_turnaround_time = 0;
double avg_waiting_time = 0;
Name of Student: Ritik Yadav Class: B.Tech
Enrollment No: 0827CS231221 Batch: B-01
Date of Experiment: 23/05/25 Date of Submission Submitted on: 30/05/25
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:

for (const auto& process : process_list) {


avg_turnaround_time += process.turnaround_time;
avg_waiting_time += process.waiting_time;
}

avg_turnaround_time /= process_list.size();
avg_waiting_time /= process_list.size();

cout << "FCFS Scheduling Results:" << endl;


for (const auto& process : process_list) {
cout << "Process " << process.process_id
<< ": Start=" << process.start_time
<< ", Completion=" << process.completion_time
<< ", Turnaround=" << process.turnaround_time
<< ", Waiting=" << process.waiting_time << endl;
}

cout << "Average Turnaround Time: " << avg_turnaround_time << endl;
cout << "Average Waiting Time: " << avg_waiting_time << endl;
}

int main() {
vector<Process> processes = {
Process(1, 0, 5),
Process(2, 1, 3),
Process(3, 2, 8),
Process(4, 3, 6),
Process(5, 4, 2)
};

fcfs_scheduling(processes);
return 0;
}
Name of Student: Ritik Yadav Class: B.Tech
Enrollment No: 0827CS231221 Batch: B-01
Date of Experiment: 23/05/25 Date of Submission Submitted on: 30/05/25
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:

OUTPUT:

You might also like