OS Practical File Final
OS Practical File Final
Before diving into the installation steps, it's crucial to emphasize the
importance of backing up your data. While the installation process typically
preserves existing files during an upgrade, a clean installation involves wiping
the drive, erasing all data. Therefore, creating a backup ensures you can
restore essential files and settings if needed.
Once you've prepared your USB bootable device and adjusted the boot order
in your computer's BIOS settings, you're ready to initiate the Windows
installation process. Follow these detailed steps to ensure a successful
installation:
Page 1 of 48
● Set the USB device as the first boot option to ensure the system
boots from the USB during startup.
● Save the changes and exit the BIOS settings.
2. Initial Setup:
Page 2 of 48
● Enter the product key if prompted. This key is typically included
with your Windows purchase or provided during the download
process.
● Select the edition of Windows you have purchased (e.g.,
Windows 10 Home, Windows 10 Pro) and proceed with the
installation.
4. Partitioning and Drive Selection:
Page 3 of 48
5. Partition Management:
Page 4 of 48
7. Finalization and Setup:
By following these steps carefully and ensuring proper backups, you can
successfully install Windows using a bootable USB device. This method
provides a reliable way to set up or upgrade your operating system while
maintaining data integrity and system stability. Enjoy your newly installed
Windows OS and explore its features with confidence!
Page 5 of 48
Ques 2. Installation of Linux OS.
1. Ubuntu:
● Ubuntu stands as one of the most widely used Linux distributions,
known for its user-friendly interface and robust features. It's
suitable for both novices and experienced Linux users. Download
Ubuntu from Ubuntu's official website.
2. Linux Mint:
● Designed with beginners in mind, Linux Mint offers a familiar
Windows-like graphical user interface (GUI) and comes preloaded
with multimedia applications for a seamless experience. Get
Linux Mint from their official website.
3. Red Hat Enterprise Linux (RHEL):
● Geared towards business use, RHEL is a commercial Linux
version offering customer support and tailored solutions.
Purchase RHEL from Red Hat's website.
4. Fedora:
● Based on RHEL, Fedora provides cutting-edge open-source
software and a platform for experimentation. Download Fedora
from the Fedora Project.
5. Kali Linux:
● Kali Linux targets security professionals, offering tools for network
penetration testing, security research, and computer forensics. It's
a popular choice among ethical hackers. Download Kali Linux
from their official website.
6. Arch Linux:
● Arch Linux is a lightweight distribution favored by advanced
users. It requires knowledge of Bash Terminal commands and
customization to create a personalized Linux environment.
Download Arch Linux from their official website.
Page 6 of 48
Installing Ubuntu Linux 12.04 LTS Alongside Windows:
Page 7 of 48
Exploring Ubuntu 12.04 LTS:
For advanced users, exploring Linux beyond basic installations opens doors to
customization, scripting, server management, and software development.
Delve into command-line tools, shell scripting, package management, and
system administration to harness Linux's full potential.
Conclusion:
Page 8 of 48
Ques 3. Dual boot installation of Operating systems.
Part 1:
proceeding with the installation of any other operating systems. Most other
Page 9 of 48
1. Downloading Rufus and Obtaining ISO Images:
Page 10 of 48
2. Installing Rufus and Acquiring OS Disk Images:
Page 11 of 48
4. Using Rufus to Create the Bootable Drive:
● Open Rufus, which features an intuitive interface resembling a
USB flash drive icon.
● Select your USB flash drive from the drop-down menu labeled
"Devices" within the Rufus application.
● Click on the "Select" button to navigate to and choose the ISO file
of the operating system you wish to install.
● Once the ISO file is selected, click on the "Start" button to initiate
the process of writing the ISO file to the USB drive. This process
may take some time, depending on the size of the ISO file and
the speed of your USB drive.
Before proceeding with the installation of a new operating system and creating
a new partition, it's crucial to safeguard any important data on your system.
While partitioning a disk drive and installing a new OS typically does not result
measure.
Page 12 of 48
1. Accessing Disk Management:
● Right-click on the Windows Start menu, usually located in the
lower-left corner of the taskbar, to reveal a context menu.
● From the context menu, select "Disk Management" to launch the
Disk Management utility within Windows.
2. Shrinking the Volume:
Page 13 of 48
4. Completing the Shrinkage Process:
● Confirm the allocation of space by clicking on the "Shrink" button,
which will prompt the system to create a new partition of
unallocated space on your hard drive.
● The new partition of unallocated space is now ready to be utilized
for installing the new operating system while preserving your
existing data and system configuration.
UEFI firmware.
Page 14 of 48
1. Disabling Fast Boot and Secure Boot:
● Fast Boot is a feature designed to expedite the system booting
process by minimizing startup time. However, it can sometimes
lead to compatibility issues, especially in dual-boot scenarios.
Disabling Fast Boot ensures smoother transitions between
operating systems.
● Secure Boot, on the other hand, is a security feature that
prevents the loading of unauthorized operating systems and
drivers during the boot process. While beneficial for security, it
can interfere with the installation of alternative operating systems.
Disabling Secure Boot is often necessary for successful dual-boot
setups.
2. Accessing BIOS/UEFI Settings:
● The process of accessing the BIOS or UEFI settings varies
depending on the manufacturer and model of your computer.
Commonly used keys during system startup to access these
settings include F1, F2, F9, F12, Esc, or Delete. Refer to your
computer's documentation or manufacturer's website for specific
instructions.
3. Changing Boot Order and Settings:
● Within the BIOS or UEFI settings, locate the Boot menu or Boot
Order section, which determines the sequence in which devices
are checked for bootable operating systems during startup.
● Adjust the boot order settings to prioritize booting from a USB
drive or the installation media (CD/DVD) if applicable. This
ensures that the system recognizes and boots from the device
containing the new operating system you intend to install.
4. Saving BIOS/UEFI Changes:
● After making the necessary adjustments to Fast Boot, Secure
Boot, and boot order settings, save the changes within the BIOS
or UEFI interface.
● Select the option to save and exit the BIOS/UEFI settings, which
will prompt the system to restart and apply the modified
configurations.
Page 15 of 48
Installing the New Operating System
Once you have created a bootable drive, prepared the partition, and adjusted
your computer's settings, you're ready to proceed with the installation of the
new operating system alongside your existing OS.
Page 16 of 48
3. Navigating the Installation Setup:
Page 17 of 48
6. Formatting and Partitioning:
Page 18 of 48
8. Rebooting and Switching Between Operating Systems:
● Upon successful completion of the installation, reboot your
computer to finalize the setup and apply the changes.
● During the boot process, you will now see a boot menu that
allows you to choose between the installed operating systems.
Use the arrow keys or mouse to select the desired OS and press
Enter to boot into it.
● You can switch between the installed operating systems by
rebooting your computer and selecting the appropriate OS from
the boot menu each time.
Page 19 of 48
Ques 4. Implementation of FCFS Scheduling algorithm
● First Come First Serve CPU Scheduling Algorithm shortly known as
FCFS is the first algorithm of CPU Process Scheduling Algorithm.
Basically, we aren’t assigning any priority to the process. Whosoever
comes first to the RAM will get the CPU first.
● It is a non-preemptive scheduling algorithm, that is, we shall not be
preempting any process in between. Whenever a process is scheduled
to the CPU, until completion that process will not be preemptied.
Important Abbreviations
1. CPU - - - > Central Processing Unit
2. FCFS - - - > First Come First Serve
3. AT - - - > Arrival Time
4. BT - - - > Burst Time
5. WT - - - > Waiting Time
6. TAT - - - > Turn Around Time
7. CT - - - > Completion Time
Page 20 of 48
C++ Program to Demonstrate the use of The FCFS Scheduling
Algorithm in Operating System
Page 21 of 48
findTurnAroundTime(processes, n, bt, wt, tat);
// Driver code
int main()
{
//process id's
int processes[] = { 1, 2, 3};
int n = sizeof processes / sizeof processes[0];
findavgTime(processes, n, burst_time);
return 0;
}
Page 22 of 48
Page 23 of 48
Page 24 of 48
Ques 5. Implementation of SJF Scheduling algorithm
● The shortest job first (SJF) or shortest job next, is a scheduling policy
that selects the waiting process with the smallest execution time to
execute next.
● Among arrived processes, process with least burst time (execution time)
will be given preference
● It is a non-preemptive scheduling algorithm
Advantages of SJF:
● SJF is better than the First come first serve(FCFS) algorithm as it
reduces the average waiting time.
● SJF is generally used for long term scheduling
Disadvantages of SJF:
● SJF may cause very long turn-around times or starvation.
● In SJF job completion time must be known earlier, but sometimes it is
hard to predict.
Page 25 of 48
C++ Program to Demonstrate the use of The SJF Scheduling Algorithm
in Operating System:
Page 26 of 48
Ques 6. Implementation of Round-Robin Scheduling algorithm
Round Robin is a CPU scheduling algorithm where each process is cyclically
assigned a fixed time slot. It is the preemptive version of the First come First
Serve CPU Scheduling algorithm.
● Round Robin CPU Algorithm generally focuses on Time Sharing
technique.
● The period of time for which a process or job is allowed to run in a
pre-emptive method is called time quantum.
Page 27 of 48
C++ Program to Demonstrate the use of The ROUNDROBIN Scheduling
Algorithm in Operating System:
Page 28 of 48
Page 29 of 48
Ques 7. Vi Editor & its commands
vi Editor
The default editor that comes with the Linux/UNIX operating system is called
vi (visual editor). Using vi editor, we can edit an existing file or create a new
file from scratch. we can also use this editor to just read a text file.
vi edit modes
The Vi editor has two modes: Command and Insert. When you first open a file
with Vi, you are in Command mode. Command mode means you can use
keyboard keys to navigate, delete, copy, paste, and do a number of other
tasks—except entering text.
To enter Insert mode, press i. In Insert mode, you can enter text, use the Enter
key to go to a new line, use the arrow keys to navigate text, and use vi as a
free-form text editor. To return to Command mode, press the Esc key once.
In Vi's Command mode, almost every letter on the keyboard has a function.
To save a file, you must first be in Command mode. Press Esc to enter
Command mode, and then type :wq to write and quit the file. The other,
quicker option is to use the keyboard shortcut ZZ to write and quit. In Vi, write
means save, and quit means exit. If you’ve made mistakes along the way
while editing and want to back out (abandon) all non-saved changes, enter
Command mode by pressing Esc and typing :q! This command quits without
saving any changes and exits Vi.
Vi shortcuts
The best way to learn Vi is to create a new file and try it out for yourself. Feel
free to use the common keyboard shortcut list below to help you learn Vi’s
extensive vocabulary. This list of shortcuts is by no means exhaustive, but
they will enable you to edit files and learn Vi in a short amount of time.
Page 30 of 48
● o — Open a new line below the current line
● :num — Display the current line’s line number
● dd — Delete an entire line
● / — Vi will move the cursor to the next occurrence of the pattern
● ? — Vi will move the cursor to the previous occurrence of the pattern
Page 31 of 48
Ques 8. Shell Commands
Shell
A shell is a special user program that provides an interface to the user to use
operating system services. Shell accepts human-readable commands from
the user and converts them into something which the kernel can understand. It
is a command language interpreter that executes commands read from input
devices such as keyboards or from files. The shell gets started when the user
logs in or starts the terminal.
Page 32 of 48
forward movement.
Page 33 of 48
2. File and Directory Manipulation Commands:
○ mkdir : Used to create a directory if not already exist. It accepts
the directory name as an input parameter.
○ cp : This command will copy the files and directories from the
source path to the destination path. It can copy a file/directory
with the new name to the destination path. It accepts the source
file/directory and destination file/directory.
Page 34 of 48
○ mv : Used to move the files or directories. This command’s
working is almost similar to cp command but it deletes a copy of
the file or directory from the source path.
Page 35 of 48
3. Extract, sort, and filter data Commands:
○ grep : This command is used to search for the specified text in a
file.
Page 36 of 48
○ cut : Used to cut a specified part of a file.
Page 37 of 48
Ques 9. Shell Scripting- Using variables
Shell Scripting
Shell scripting is the process of writing a series of commands for execution
within a Unix-like operating system's command-line interpreter, known as the
shell. The shell acts as an interface between the user and the operating
system, interpreting commands entered by the user or read from a script file
and executing them.
In shell scripting, commands are typically written in a simple text file, often
with the ".sh" extension, and then executed as a script. These scripts can
automate repetitive tasks, perform system administration tasks, or orchestrate
complex sequences of commands.
Modify the file permissions and allow execution of the script by using the
command : chmod u+x File_name.sh
chmod modifies the existing rights of a file for a particular user. We are adding
+x to user u.
Page 38 of 48
Run the script
Variables let you store data. You can use variables to read, access, and
manipulate data throughout your script.
In Bash, you can use and set the variable values in the following ways:
1. Assign the value directly: country=India
2. Assign the value based on the output obtained from a program or
command, using command substitution. Note that $ is required to
access an existing variable's value.
same_country=$country
This assigns the value of country to the new variable same country
Page 39 of 48
Ques 10. Shell Scripting- Input & Output
In shell scripting, input and output operations are fundamental for interacting
with users and processing data. Here's a detailed explanation of how to
handle input and output in a shell script:
1. Echo Command:
The `echo` command is used to print output to the terminal. It's also
commonly used to prompt users for input.
Syntax:
echo "What is your name?"
2. Read Command:
The `read` command is used to read input from the user and store it in a
variable.
Syntax:
read name
In the above line, the user's input will be stored in the variable `name`.
3. Printing Output:
Syntax:
In this line, the values of variables `name` and `age` will be inserted into the
output string.
Page 40 of 48
Ques 11. Shell Scripting- Data types
In shell scripting, variables don't have explicit data types like in some other
programming languages. Instead, they are treated as strings by default.
However, you can manipulate and interpret them in different ways depending
on the context. For example, you can perform arithmetic operations on
variables, and the shell will interpret them as numbers if they contain only
numeric values. Additionally, you can explicitly specify the data type or enforce
type checking through various methods, such as using commands like
`declare` or `typeset` with options like `-i` for integer variables.
1. Strings: Shell scripts handle text as strings. You can manipulate strings
using various operators and commands like echo, grep, sed, awk, etc.
2. Numbers: Shell scripts treat numbers as strings by default, but you can
perform arithmetic operations using special constructs like $((...)), expr,
and bc (a command-line calculator).
○ Using $((...)): This construct allows for arithmetic operations
directly within double parentheses. For example, result=$((5 + 3))
sets result to 8.
○ expr: This is an external command used for basic arithmetic. For
instance, result=$(expr 5 + 3) assigns 8 to result.
○ bc: For more advanced arithmetic, including floating-point
calculations, you can use bc. Example: result=$(echo "5.5 + 3.2" |
bc) sets result to 8.7.
3. Arrays: Shell scripting supports arrays, which can hold multiple values.
Arrays are indexed starting from 0, and you can access array elements
using their indices or iterate over them using loops.
#!/bin/bash
# String manipulation
name="Alice"
echo "Hello, $name!"
# Arithmetic operations
num1=10
num2=5
result=$((num1 + num2))
echo "The result of $num1 + $num2 is $result"
# Arrays
Page 41 of 48
fruits=("Apple" "Banana" "Orange")
echo "The first fruit is ${fruits[0]}"
echo "All fruits: ${fruits[@]}"
Hello, Alice!
The result of 10 + 5 is 15
The first fruit is Apple
All fruits: Apple Banana Orange
Page 42 of 48
Ques 12. Shell Scripting- Use of arithmetic operators
var=$((expression))
Fractions are not correctly calculated using the above methods and truncated.
For decimal calculations, we can use bc command to get the output to a particular
number of decimal places. bc (Bash Calculator) is a command line calculator that
supports calculation up to a certain number of decimal points.
echo "scale=2;22/7" | bc
Where scale defines the number of decimal places required in the output.
Page 43 of 48
Ques 13. Shell Scripting- if control statement programs
● if...then...fi statements
● if...then...else...fi statements
● if..elif..else..fi
● if..then..else..if..then..fi..fi.. (Nested Conditionals)
Syntax:
if [[ condition ]]
Then
statement
elif [[ condition ]]; then
statement
Else
do this by default
Fi
Page 44 of 48
Ques 14. Shell Scripting- while control statement
While loop
While loops check for a condition and loop until the condition remains true. We
need to provide a counter statement that increments the counter to control
loop
execution.
Running the script: Printing the numbers by providing starting and ending limit
using while loop
Page 45 of 48
Running the script: Infinity loop with user input using while loop
Page 46 of 48
Ques 15. Shell Scripting- for control statement
The for loop, just like the while loop, allows you to execute statements a
specific number of times. Each loop differs in its syntax and usage.
Running the script: Printing the numbers by providing starting and ending limit
using For loop
#!/bin/bash
#This is the basic example of 'for loop'.
Page 47 of 48
Running the Script: Finding Factorial using for loop.
Page 48 of 48