You are on page 1of 48

A Laboratory Manual for

Operating System and


Virtualization
(3141601)

B.E. Semester-IV
(Information Technology)

Directorate of Technical Education, Gandhinagar,


Gujarat
Government Engineering College, Modasa

Certificate

This is to certify that Mr./Ms. ___________________________________


________ Enrollment No. _______________ of B.E. Semester _____
Information Technology of this Institute (GTU Code: _____ ) has
satisfactorily completed the Practical work for the subject Operating System
and Virtualization (3141601) for the academic year 2023-24.

Place: __________
Date: __________

Name and Sign of Faculty member

Head of the Department


Operating System and Virtualizations (3141601)

Preface

Main motto of any laboratory/practical/field work is for enhancing required skills as well as
creating ability amongst students to solve real time problem by developing relevant competencies
in psychomotor domain. By keeping in view, GTU has designed competency focused outcome-
based curriculum for engineering degree programs where sufficient weightage is given to
practical work. It shows importance of enhancement of skills amongst the students and it pays
attention to utilize every second of time allotted for practical amongst students, instructors and
faculty members to achieve relevant outcomes by performing the experiments rather than having
merely study type experiments. It is must for effective implementation of competency focused
outcome-based curriculum that every practical is keenly designed to serve as a tool to develop
and enhance relevant competency required by the various industry among every student. These
psychomotor skills are very difficult to develop through traditional chalk and board content
delivery method in the classroom. Accordingly, this lab manual is designed to focus on the
industry defined relevant outcomes, rather than old practice of conducting practical to prove
concept and theory.

By using this lab manual students can go through the relevant theory and procedure in advance
before the actual performance which creates an interest and students can have basic idea prior to
performance. This in turn enhances pre-determined outcomes amongst students. Each experiment
in this manual begins with competency, industry relevant skills, course outcomes as well as
practical outcomes (objectives). The students will also achieve safety and necessary precautions
to be taken while performing practical.

This manual also provides guidelines to faculty members to facilitate student centric lab activities
through each experiment by arranging and managing necessary resources in order that the
students follow the procedures with required safety and necessary precautions to achieve the
outcomes. It also gives an idea that how students will be assessed by providing rubrics.

Engineering Thermodynamics is the fundamental course which deals with various forms of
energy and their conversion from one to the another. It provides a platform for students to
demonstrate first and second laws of thermodynamics, entropy principle and concept of exergy.
Students also learn various gas and vapor power cycles and refrigeration cycle. Fundamentals of
combustion are also learnt.

Utmost care has been taken while preparing this lab manual however always there is chances of
improvement. Therefore, we welcome constructive suggestions for improvement and removal of
errors if any.
Operating System and Virtualizations (3141601)

Practical – Course Outcome matrix

Course Outcomes (COs):


CO-1: Learn and understand the concepts, core structure of Operating Systems and basic architectural components
involved in operating systems design.
CO-2: Understand the process management policies and scheduling of processes by CPU.
CO-3: Evaluate the requirement for process synchronization and coordination handled by operating system.
CO-4: Describe and analyze the memory management and its allocation policies.
CO-5: Analyze various device and resource management techniques for timesharing.
CO-6: Conceptualize the components involved in designing a contemporary Operating Systems.

Sr. No. Objective(s) of Experiment CO1 CO2 CO3 CO4 CO5

Study of Linux operating system, its variants and installation of


1. √
Linux Operating system
Installation of Linux Operating system as a Guest OS on Windows
2. √
Operating system using virtualization software
Study of Basic commands of Linux/UNIX.
3. √
Study of Advance commands and filters of Linux/UNIX.
4. √
Write a shell script to generate mark sheet of a student. Take Three
subjects, calculate and display total marks, percentage and Class
5. √
obtained by the student.

6. Write a shell script to display multiplication table of given number √

7. Write a shell script to find factorial of given number n √


Write a shell script which will accept a number b and display first
8. √
n prime numbers as output.
Write a shell script which will generate first n fibonnacci numbers
9. √
like: 1, 1, 2, 3, 5, 13,18
Write a menu driven shell script which will print the following
menu and execute the given task.
a. Display calendar of current month
10. b. Display today’s date and time √ √
c. Display usernames those are currently logged in the system
d. Display your name at given x, y position
e. Display your terminal number
Write a shell script to read n numbers as command arguments and
11. √
sort them in descending order

12. Write a shell script to display all executable files, directories and √
zero sized files from current directory

13. Write a shell script to check entered string is palindrome or not. √

14. Shell programming using filters (including grep, egrep, fgrep) √

15. Study of Unix Shell and Environment Variables. √


Operating System and Virtualizations (3141601)

Write a shell script to validate the entered date. (eg. Date format
16. √
is : dd-mm-yyyy).

17. Write an awk program using function, which convert each word √
in a given text into capital
Write a program for process creation using C. (Use of gcc
18. √
compiler)

19. Study about the virtual machine and virtualization √

Study about Hypervisors: VMWare ESXi , Microsoft Hyper-


20. √
V and Xen Server, and Java VM

Industry Relevant Skills

The following industry relevant competency are expected to be developed in the student by
undertaking the practical work of this laboratory.

Guidelines for Faculty members


1. Teacher should provide the guideline with demonstration of practical to the students
with all features.
2. Teacher shall explain basic concepts/theory related to the experiment to the students before
starting of each practical
3. Involve all the students in performance of each experiment.
4. Teacher is expected to share the skills and competencies to be developed in the
students and ensure that the respective skills and competencies are developed in the
students after the completion of the experimentation.
5. Teachers should give opportunity to students for hands-on experience after the
demonstration.
6. Teacher may provide additional knowledge and skills to the students even though not
covered in the manual but are expected from the students by concerned industry.
7. Give practical assignment and assess the performance of students based on task
assigned to check whether it is as per the instructions or not.
8. Teacher is expected to refer complete curriculum of the course and follow the
guidelines for implementation.

Instructions for Students


1. Students are expected to carefully listen to all the theory classes delivered by the faculty
members and understand the COs, content of the course, teaching and examination scheme,
skill set to be developed etc.
2. Students shall organize the work in the group and make record of all observations.
3. Students shall develop maintenance skill as expected by industries.
4. Student shall attempt to develop related hand-on skills and build confidence.
5. Student shall develop the habits of evolving more ideas, innovations, skills etc. apart from
those included in scope of manual.
6. Student shall refer technical magazines and data books.
Operating System and Virtualizations (3141601)

7. Student should develop a habit of submitting the experimentation work as per the schedule
and s/he should be well prepared for the same.

Common Safety Instructions


1. Students are expected to carefully understand and apply the concepts.
Operating System and Virtualizations (3141601)

Index
(Progressive Assessment Sheet)

Date Sign. of
Date of Assess
Page of Teacher Remar
Sr. No. Objective(s) of Experiment submissi ment
No. perfor with ks
on Marks
mance date
Study of Linux operating system, its variants and installation
1.
of Linux Operating system
Installation of Linux Operating system as a Guest OS on
2.
Windows Operating system using virtualization software

3. Study of Basic commands of Linux/UNIX.

4. Study of Advance commands and filters of Linux/UNIX.


Write a shell script to generate mark sheet of a student. Take
5. Three subjects, calculate and display total marks, percentage
and Class obtained by the student.
Write a shell script to display multiplication table of given
6.
number

7. Write a shell script to find factorial of given number n

Write a shell script which will accept a number b and display


8.
first n prime numbers as output.
Write a shell script which will generate first n fibonnacci
9.
numbers like: 1, 1, 2, 3, 5, 13,18
Write a menu driven shell script which will print the
following menu and execute the given task.
a. Display calendar of current month
10. b. Display today’s date and time
c. Display usernames those are currently logged in the system
d. Display your name at given x, y position
e. Display your terminal number
Write a shell script to read n numbers as command arguments
11.
and sort them in descending order
Write a shell script to display all executable files, directories
12.
and zero sized files from current directory
Write a shell script to check entered string is palindrome or
13.
not.
Shell programming using filters (including grep, egrep,
14.
fgrep)

15. Study of Unix Shell and Environment Variables.

Write a shell script to validate the entered date. (eg. Date


16.
format is : dd-mm-yyyy).
Write an awk program using function, which convert each
17.
word in a given text into capital
Write a program for process creation using C. (Use of gcc
18.
compiler)
Operating System and Virtualizations (3141601)

19. Study about the virtual machine and virtualization

Study about Hypervisors: VMWare ESXi, Microsoft Hyper-


20.
V and Xen Server, and Java VM

Total
Experiment No: 1
Aim: Study of Linux operating system, its variants and installation of Linux Operating
system

Date:

Competency and Practical Skills: Understand the basics of the Linux OS , Identify major Linux
distributions and their applications, Install a Linux distribution as the sole operating system on a
computer.

Relevant CO: Learn and understand the concepts, core structure of Operating Systems and
basic architectural components involved in operating systems design

Objectives:
To understand the foundational concepts of the Linux operating system.
To recognize and differentiate between various Linux distributions.
To gain hands-on experience in the installation process of Linux as the primary OS.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
The Linux operating system is an open-source OS based on the UNIX architecture. It was
developed by Linus Torvalds in the early 1990s. The core of Linux, called the kernel, interacts
directly with the system hardware and provides services to the software applications.

Linux is known for its flexibility, security, and adaptability. Over time, several distributions
(or 'distros') have evolved, each designed for specific use-cases. Some popular Linux distributions
include Ubuntu, Fedora, Delian, CentOS, and Red Hat.

Installation:

1. Selecting a suitable distribution.


2. Acquiring the installation media, usually an ISO file.
3. Creating a bootable USB or DVD.
4. Booting from the created media.
5. Following the installation instructions.

Procedure:

1. Select a Linux distribution: For beginners, Ubuntu or Fedora is often recommended due to their
user-friendly interfaces.

2. Download the ISO File: Go to the official website of your chosen distribution and download the
ISO file.

3. Create a Bootable Media: Use tools like 'Rufus' or 'UNetbootin' to create a bootable USB.

4. Insert the Bootable Media: Plug the USB drive into the computer you want to install Linux on.

5.Reboot & Select Boot Media: Reboot the computer. During the startup, press the boot menu key
(usually F2, F10, or F12) and select the USB drive.

6. Follow Installation Instructions: Once booted from the USB, you'll be guided through various
steps like partitioning the hard drive, setting the time zone, and creating a user account.
7. Finish Installation: After all steps, Linux will be installed. Reboot the computer, and you should
boot into your new Linux OS.

Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. Who developed the Linux operating system?
2. Name any two popular distributions of Linux.
3. What is the core of the Linux operating system called?
4. Why do we need to create a bootable USB or DVD for the installation of Linux?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 2
Aim: Installation of Linux Operating System as a Guest OS on Windows Operating
System using virtualization software.

Date:

Competency and Practical Skills: Understand the concepts of virtualization and the
distinction between host and guest OS, Install and configure virtualization software on a
host system, Install a guest OS within the virtualized environment and understand its
isolated nature.

Relevant CO: Learn and understand the concepts, core structure of Operating Systems and
basic architectural components involved in operating systems design

Objectives:
To comprehend the principle of virtualization and its significance in modern
computing.
To differentiate between Host and Guest operating systems.
To master the process of setting up virtualization software on Windows.
To successfully install and run Linux as a guest OS inside a virtualized
environment.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
Virtualization refers to the act of creating a virtual version of something, including but not
limited to a virtual computer hardware platform, operating system (OS), storage device, or network
resources. By using virtualization software, one can run multiple operating systems on a single
physical computer. In this context, the system on which you're running the virtualization software
(Windows in this case) is known as the Host OS, and the OS you're installing inside the virtualized
environment is called the Guest OS.

One popular virtualization software is Virtual Box, which allows users to create and manage
virtual machines. These virtual machines can run various operating systems, providing a sandboxed
environment that operates independently of the host system.

Procedure:
1. Download & Install Virtualization Software: Download Oracle Virtual Box (or any other
preferred virtualization software) from its official website and install it on your Windows OS.

2. Download Linux ISO File: Go to the official website of your chosen Linux distribution and
download the ISO file.

3. Launch Virtual Box and Create New VM:


- Click on 'New' to create a new virtual machine.
- Name the VM, select the type as 'Linux', and choose the appropriate version.
- Allocate RAM. (Usually 1-2GB is sufficient for basic tasks, but allocate more if required).

4. Set Up Virtual Hard Disk:


- Create a virtual hard disk.
- Choose VDI (Virtual Box Disk Image) as the file type.
- Select whether the storage should be dynamically allocated or of a fixed size. (Dynamically
allocated storage grows as you use it).
5. Attach the Linux ISO:
- With the VM highlighted, click on 'Settings'.
- Go to 'Storage', click on the empty disk icon under the IDE controller, and on the right side,
click on the disk icon to choose a virtual optical disk file. Select the downloaded Linux ISO.

6. Start the Virtual Machine: Click 'Start' on Virtual Box to run the VM. The Linux installer
should boot up.

7. Follow Linux Installation Instructions: Go through the standard Linux installation procedure
within the virtual machine, just as you would on a physical machine.

8. Install Guest Additions: After installation, for better performance and integration features, it's
recommended to install Virtual Box Guest Additions.

Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. What is the difference between a Host OS and a Guest OS in virtualization?
2. Name one popular virtualization software used to run multiple operating systems on a
single machine.
3. Why is it recommended to install Guest Additions in Virtual Box after installing a Linux
guest OS?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 3

Aim: Study of Basic Commands of Linux/UNIX.

Date:

Competency and Practical Skills:


1. Understand the purpose and function of the Linux/UNIX shell.
2. Navigate the file system using basic commands.
3. Manage files and directories efficiently.
4. Access manual pages for detailed command usage.
5. Manage processes on a basic level.

Relevant CO: Learn and understand the concepts, core structure of Operating Systems and
basic architectural components involved in operating systems design

Objectives:
To familiarize students with the fundamental concepts of the Linux/UNIX command line.
To learn and practice essential file and directory management commands.
To understand process management at a basic level using command-line tools.
To leverage the built-in manual system to gain insights into various commands.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
Linux/UNIX commands are textual instructions given by users to interact with the operating system.
These commands can perform various tasks such as file management, process management,
hardware status, and more. The place where users input these commands is typically referred to as
the shell, and the most common shell used is called bash (Bourne Again SHell).

Procedure:
1. Accessing the Terminal: On most Linux systems, you can open the terminal by pressing Ctrl +
Alt + T. On UNIX-based systems or other Linux desktop environments, the terminal might be found
in the application menu.

2. Basic Commands:
- pwd: Prints the current working directory.
- ls: Lists the contents of the current directory.
- cd [directory_name]: Changes the directory to the specified one.
- touch [filename]: Creates a new empty file.
- mkdir [directory_name]: Creates a new directory.
- rm [filename]: Deletes a file.
- rmdir [directory_name]: Deletes an empty directory.
- cp [source] [destination]: Copies files or directories.
- mv [source] [destination]: Moves or renames files or directories.
- echo [text]: Displays a message or output to the screen.
- man [command_name]: Shows the manual page for the specified command.
- ps: Lists currently running processes.
- kill [process_id]: Kills a running process.

3. Practice: It's essential to practice these commands to get a feel for how they work. Start by
navigating through directories, creating files, and viewing processes.
Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. What is the purpose of the Pwd command in Linux/UNIX?
2. How can you view the manual or help page of a particular command?
3. Which command is used to list all the running processes in the system?
4. How would you create a new directory named "Documents" using a command?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 4
Aim: Study of Advanced Commands and Filters of Linux/UNIX.

Date:

Competency and Practical Skills:


1. Understand the power and flexibility of advanced Linux/UNIX commands.
2. Efficiently process and manipulate text data directly from the command line.
3. Combine multiple commands seamlessly using pipes for intricate tasks.
4. Utilize filters effectively for various data transformation needs.

Relevant CO:Learn and understand the concepts, core structure of Operating Systems and
basic architectural components involved in operating systems design

Objectives:
1. To delve deeper into the capabilities of the Linux/UNIX command line beyond basic operations.
2. To understand and master the use of advanced file and text manipulation commands.
3. To explore and utilize filters for processing text streams and files efficiently.
4. To learn the intricacies of combining multiple commands using pipes (|) for enhanced
functionality.
5. To practice and apply advanced commands and filters in real-world scenarios to optimize tasks
and processes.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
While basic Linux/UNIX commands help in daily tasks, advanced commands and filters facilitate
complex tasks, text processing, and efficient system management. Filters in UNIX/Linux allow for
data manipulation directly from the command line, which can be very powerful when combined
with other commands using pipes (|).

Advanced Commands and Filters:


- grep: Searches for a specific pattern within files.
- awk: A text pattern scanning and processing language.
- sed: A stream editor used for performing basic text transformations.
- sort: Sorts the contents of a text file line by line.
- cut: Removes sections from lines of files.
- tr: Translates or deletes characters.
- uniq: Reports or filters out repeated lines in a file.
- find: Searches for files in a directory hierarchy based on different criteria.

Procedure:

1. Access the Terminal: Open your Linux/UNIX terminal.

2. Using grep: To search for the word "example" in a file named "sample.txt", use grep "example"
sample.txt.

3. Text Manipulation with awk: For example, to print the second column of a file separated by
commas, you'd use awk -F',' '{print $2}' filename.

4. Editing Streams with sed: To replace all occurrences of "apple" with "orange" in a file: sed
's/apple/orange/g' filename.
5. Sorting Text: To sort the contents of "sample.txt": sort sample.txt.

6. Extracting Data with cut: To get the third column of a comma-separated file: cut -d',' -f3
filename.

7. Using find: To locate all .txt files in the current directory and its subdirectories: find . -name
"*.txt".

8. Practice: Combining commands using pipes can achieve complex tasks. For instance, to count
unique lines in a file: sort filename | uniq | wc -l.

Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. How would you use grep to search for the word "apple" in a file named "fruits.txt"?
2. What is the purpose of the awk command in Linux/UNIX?
3. How can the sort and uniq commands be combined to count the number of unique lines
in a file?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 5
Aim: Write a shell script to generate the mark sheet of a student. Take three subjects,
calculate and display total marks, percentage, and class obtained by the student.

Date:

Competency and Practical Skills:


1. Understand the flow and structure of shell scripting.
2. Design logic for computing and displaying student results.
3. Implement conditional statements in scripts for decision-making.
4. Develop skills for creating user-interactive scripts.

Relevant CO: Understand the process management policies and scheduling of processes by CPU.

Objectives:
1. To familiarize students with the logical flow and structuring of algorithms.
2. To help students comprehend the sequential steps involved in mark sheet generation.
3. To encourage students to think critically and develop their script based on the provided algorithm.
4. To instill a deep understanding of the relationship between user inputs, processing, and outputs
in scripting.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory: A shell script is a sequence of commands for a Unix-based operating system. It's a text file
that contains a series of shell commands and is a way to automate repetitive tasks. For the given
task, we will utilize the shell script's capability to gather inputs, process the data, and display
outputs, focusing on the logic behind generating a student's mark sheet.

Procedure:
1. Initialize:
- Begin the script.
- Declare variables for three subjects, total marks, percentage, and class.

2. Input Marks:
- Prompt the user to enter marks for the first subject and store in the respective variable.
- Prompt for the second subject and store.
- Prompt for the third subject and store.

3. Calculate Total and Percentage:


- Add the marks of the three subjects to get the total marks.
- Calculate the percentage by dividing the total marks by the maximum possible score (assuming
300 for three subjects) and then multiplying by 100.

4. Determine Class:
- If the percentage is 75% or above, assign "Distinction" to the class variable.
- If the percentage is between 60% and 74%, assign "First Class".
- If the percentage is between 40% and 59%, assign "Second Class".
- Otherwise, assign "Fail".

5. Display Results:
- Print the total marks out of 300.
- Display the calculated percentage.
- Show the class obtained by the student.
Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. In the algorithm for the mark sheet script, what's the maximum possible score assumed
for the three subjects?
2. How is the "class" of a student determined in the algorithm?
3. What are the key components of the mark sheet generation algorithm?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 6
Aim: Write a shell script to display the multiplication table of a given number.

Date:

Competency and Practical Skills:


1. Understand the flow and structure of shell scripting.
2. Design logic for computing and displaying student results.
3. Implement conditional statements in scripts for decision-making.
4. Develop skills for creating user-interactive scripts.

Relevant CO: Understand the process management policies and scheduling of processes by
CPU.

Objectives:
1. Understand how to take user input in a shell script.
2. Implement loops for repetitive tasks in scripts.
3. Manipulate and process user input to generate desired outputs.
4. Design and create scripts that serve practical utilities, like a multiplication table generator.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
Shell scripting is a powerful tool that allows users to automate tasks in Unix-based systems.
In this context, the script will automate the task of generating a multiplication table for a specified
number. The multiplication table helps in understanding the repeated addition of the same number.

Procedure:
1. Start the script.

2. Declare variables for the given number and an iterator for looping.

3. User Input:
- Prompt the user to enter a number for which they wish to see the multiplication table.
- Store this number in the respective variable.

4. Multiplication Table Generation:


- Initiate a loop (e.g., a "for" loop) that runs from 1 to 10 (standard multiplication tables go up to
10, but this can be adjusted based on requirements).
- For each iteration, multiply the given number by the current iterator value.
- Display the result in a formatted way, such as: "5 x 1 = 5" for the first iteration if the user input
was 5.

5. End the loop after 10 iterations.

6. Finish the script.

Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)


Quiz:
1.What is the main purpose of the shell script described in the practical?
2.How many times does our multiplication table loop to display results?
3.If a user enters the number "6", what would be the result displayed for the third iteration
of the multiplication table?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 7
Aim: Write a shell script to find the factorial of a given number n.

Date:

Competency and Practical Skills:


1. Understand the concept of factorial and its mathematical representation.
2. Implement loops in shell scripts to perform iterative calculations.
3. Take user input and process it to produce the desired output.
4. Design and create a script that performs a specific mathematical operation based on user
input.

Relevant CO: Understand the process management policies and scheduling of processes by
CPU.

Objectives:
1. To introduce students to the mathematical concept of factorials.
2. To demonstrate the use of loops in computing factorials using shell scripting.
3. To enhance the students' ability to design and implement scripts for specific mathematical tasks.
4. To highlight the versatility of shell scripting in handling a variety of computational problems.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less
than or equal to n. Mathematically, the factorial function n! can be defined by:

1 if n = 0
n * (n-1)! if n > 0

For instance, the factorial of 4 (4!) is 4 * 3 * 2 *1 = 24 .

Procedure:
1. Start the script.

2. Declare necessary variables: one for the input number \( n \) and another for storing the factorial
result.

3. User Input:
- Prompt the user to enter a number \( n \) for which they wish to find the factorial.
- Store this number.

4. Factorial Calculation:
- Initialize the factorial result variable as 1.
- Use a loop (e.g., a "while" or "for" loop) that runs from 1 to \( n \).
- In each iteration, multiply the factorial result variable by the current iterator value.
- After the loop completes, the factorial result variable will hold the factorial of \( n \).

5. Display Result:
- Print the factorial of \( n \).

6. End the script.


Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. What is the factorial of a number?
2. How is the factorial of 0 defined?
3. If the user inputs the number "5" for n, what value will the script compute?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 8
Aim: Write a shell script that accepts a number b and displays the first n prime
numbers as output.

Date:

Competency and Practical Skills:


1. Understand the concept of prime numbers.
2. Implement loops and nested loops in shell scripts.
3. Use conditional statements to determine the prime nature of a number.
4. Develop scripts that generate specific sequences or patterns based on user input.

Relevant CO:

Objectives:
1. To introduce students to the concept of prime numbers and their properties.
2. To demonstrate the use of loops and conditions in generating specific numeric sequences in shell
scripting.
3. To encourage logical thinking and problem-solving through algorithm design.
4. To provide hands-on experience in writing scripts that take user input and generate specific
outputs.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
A prime number is a natural number greater than 1 that is not a product of two smaller natural
numbers. In other words, it has only two distinct positive divisors: 1 and itself. For instance, the
first six prime numbers are 2, 3, 5, 7, 11, and 13. Shell scripts allow automation of such tasks where
repetitive checking or calculations, like checking for prime numbers, are needed.

Procedure:

1. Start the script.

2. Declare necessary variables: one for the input number b, a counter for found prime numbers, and
an iterator for checking each number.

3. User Input:
- Prompt the user to enter a number b indicating how many prime numbers they wish to see.
- Store this number.

4. Prime Number Generation:


- Start an indefinite loop until b prime numbers are found.
- For each number, check if it's prime:
- Initialize a 'is Prime' variable as true.
- Start a loop from 2 up to the square root of the current number.
- If the current number is divisible by any number in this loop, set 'is Prime' to false and break the
loop.
- If 'is Prime' remains true after the loop, display the current number as a prime number and
increment the prime counter.
- Continue the process until b prime numbers are displayed.

5. End the script.


Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. What is a prime number?
2. How many divisors does a prime number have?
3. If the user enters the number "4" for b, how many prime numbers will the script display?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 9
Aim: Write a shell script which will generate first n Fibonacci numbers like: 1, 1, 2, 3,
5, 13,18

Date:

Competency and Practical Skills:


1. Understand the nature and pattern of the Fibonacci sequence.
2. Implement loops in shell scripts to generate a number sequence.
3. Use arithmetic operations to calculate and update sequence values.
4. Design scripts that produce numeric patterns based on user input.

Relevant CO: Understand the process management policies and scheduling of processes by
CPU.

Objectives:
1. To teach students about the Fibonacci sequence and its properties.
2. To demonstrate the use of loops and arithmetic operations in generating the
Fibonacci sequence using shell scripting.
3. To instill logical and sequential thinking in algorithm design.
4. To offer a practical exercise in writing scripts for generating numeric patterns.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
The Fibonacci sequence is a series of numbers in which each number is the sum of the two
preceding ones. Typically, the sequence starts with 0 and 1. In mathematical terms, the sequence
F(n) is defined by the recurrence relation:

F(n) = F(n-1) + F(n-2)


with seed values:
F(0) = 0, F(1) = 1

Procedure:

1. Start the script.

2. Declare necessary variables: one for the input number n, and two initial seed numbers for the
Fibonacci sequence (0 and 1).

3. User Input:
- Prompt the user to enter a number n indicating how many Fibonacci numbers they wish to see.
- Store this number.

4. Fibonacci Number Generation:


- If n is 1, display the first Fibonacci number.
- If n is greater than 1, display the first two Fibonacci numbers.
- Initialize a loop that runs n - 2 times (since the first two numbers are already displayed).
- Calculate the next Fibonacci number as the sum of the two preceding ones.
- Display the calculated Fibonacci number.
- Update the two preceding Fibonacci numbers for the next iteration.

5. End the script.


Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. How is each number in the Fibonacci sequence generated?
2. What are the first two numbers in the Fibonacci sequence?
3. If the user inputs the number "6" for n, how many Fibonacci numbers will the script
display?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 10
Aim: Write a menu-driven shell script that presents the following options to the user
and executes the corresponding task:

a. Display calendar of the current month


b. Display today’s date and time
c. Display usernames that are currently logged in the system
d. Display your name at a given x, y position
e. Display your terminal number

Date:

Competency and Practical Skills:


1. Design and implement a menu-driven interface in a shell script.
2. Utilize built-in UNIX commands for various tasks.
3. Implement loops and conditional statements for user interaction and choice-based task
execution.
4. Understand the purpose and usage of commands like Cal, date, who, tput, and tty.

Relevant CO: Understand the process management policies and scheduling of processes by
CPU.

Objectives:
1. To teach students how to create interactive, menu-driven shell scripts.
2. To familiarize students with various built-in UNIX commands and their utilities.
3. To instill a practical understanding of how to use shell scripting to automate and streamline tasks.
4. To demonstrate the concept of loops and conditional statements in creating interactive scripts.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
A menu-driven program provides users with a selection of choices in the form of a menu. The user's
choice determines the action the program will take. In a shell script, such menu-driven interfaces
can be built using loops, conditional statements, and built-in commands.

Procedure:
1. Start the script.

2. Display Menu:
- Use a loop (e.g., a "while" loop) to repeatedly display the menu and prompt for user input until
the user chooses to exit.
- Display the options:
a. Display calendar of the current month
b. Display today’s date and time
c. Display usernames currently logged in the system
d. Display your name at a given x, y position
e. Display your terminal number
f. Exit

3. Get User Input:


- Prompt the user to select an option from the menu.

4. Execute Task Based on Choice:


- Use a conditional statement (e.g., "case" or "if-else ") to determine the user's choice.
- For option 'a', use the Cal command to display the current month's calendar.
- For option 'b', use the date command to display the current date and time.
- For option 'c', use the who command to list all logged-in users.
- For option 'd', prompt the user for x and y coordinates and then use the tput command to position
the cursor and echo the user's name.
- For option 'e', use the tty command to display the terminal number.
- For option 'f', exit the loop and end the script.

5. Loop back to step 2 until the user chooses to exit.

6. End the script.

Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. Which command is used to display the calendar of the current month?
2. How can you display the names of users currently logged in to the system?
3. What does the tty command display?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 11
Aim: Write a shell script to read n numbers as command arguments and sort them in
descending order

Date:

Competency and Practical Skills:


1. Understand and utilize command-line arguments in shell scripts.
2. Implement sorting algorithms, specifically the bubble sort in this context, in scripts.
3. Manipulate and process arrays in shell scripting.
4. Design and implement scripts that sort and display data based on user input.

Relevant CO: Evaluate the requirement for process synchronization and coordination
handled by operating system.

Objectives:
1. To familiarize students with the use of command-line arguments in shell scripts.
2. To introduce the concept of sorting and its implementation using loops.
3. To encourage the use of arrays in shell scripting for data processing.
4. To demonstrate the practical utility of shell scripts in processing and displaying sorted data.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory: Command-line arguments are a method of passing input to a script at the time of
execution. In shell scripting, these arguments can be accessed via special variables: $1, $2, $3, ...
representing the first, second, third argument, and so on. $# holds the count of total arguments
passed. Sorting is the process of arranging items systematically. For this task, we will arrange
numbers in descending order.

Procedure:

1. Start the script.

2. Check Argument Count:


- If no arguments are passed or only one is passed, print an appropriate message and exit. Sorting
requires at least two numbers.

3. Read Command-line Arguments:


- Read all numbers passed as command-line arguments into an array.

4. Sort the Numbers in Descending Order:


- Use a nested loop (e.g., a "for" loop inside another "for" loop) for sorting.
- In each iteration of the outer loop, traverse through the array using the inner loop.
- Compare adjacent elements of the array. If the current element is smaller than the next element,
swap them.
- Continue the process until the entire array is sorted in descending order.

5. Display Result:
- Print the sorted numbers.

6. End the script.

Observations:
Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. How can you access the first command-line argument in a shell script?
2. What special variable holds the total count of command-line arguments passed to a script?
3. Why is it necessary to have at least two numbers for sorting?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 12
Aim: Write a shell script to display all executable files, directories, and zero-sized files
from the current directory.

Date:

Competency and Practical Skills:


1. Understand file and directory permissions in UNIX-like operating systems.
2. Utilize shell commands to detect specific attributes of files and directories.
3. Implement conditional statements in scripts to filter and display files based on their
properties.
4. Design and implement scripts that provide insights into the content of directories.

Relevant CO: Evaluate the requirement for process synchronization and coordination
handled by operating system.

Objectives:
1. To educate students about the permission system of UNIX-like operating systems and its
significance.
2. To demonstrate the ability to filter and display directory content based on specific criteria using
shell scripting.
3. To encourage students to explore various commands and options that can be used to glean
information about files.
4. To provide a hands-on experience in creating scripts that present organized information based on
file attributes.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
In UNIX-like operating systems, files and directories have associated *permissions* that determine
who can read, write, or execute them. An executable file is one that has the execute permission set
for the user, group, or others. Directories with the execute permission can be accessed and traversed.
A zero-sized file, as the name suggests, has a size of 0 bytes.

Using the ls command with specific options and filters, one can list files based on their attributes.
Combined with if conditions, shell scripts can be used to detect and display files with specific
properties.

Procedure:
1. Start the script.

2. List and Filter Files:


- Iterate over all files and directories in the current directory.
- For each item:
a. If it's an executable file, display it under the "Executable Files" category.
b. If it's a directory, display it under the "Directories" category.
c. If it's a zero-sized file, display it under the "Zero-sized Files" category.

3. End the script.

Observations:

Result: (Sufficient space to be provided)


Conclusion: (Sufficient space to be provided)

Quiz:
1. How can you identify an executable file in a UNIX-like system?
2. What is the significance of the execute permission on a directory?
3. What size, in bytes, does a zero-sized file have?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 13
Aim: Write a shell script to check if the entered string is a palindrome or not.

Date:

Competency and Practical Skills:


1. Understand the concept of palindromes and their properties.
2. Implement string manipulation operations in shell scripts.
3. Use conditional statements to compare strings and determine their characteristics.
4. Design and implement scripts that analyze and provide feedback on user input.

Relevant CO: Evaluate the requirement for process synchronization and coordination
handled by operating system.

Objectives:
1. To introduce students to the concept of palindromes and how to programmatically identify them.
2. To teach students about string operations and comparisons in shell scripting.
3. To promote logical thinking and the utilization of string manipulation techniques.
4. To give students a hands-on experience in creating scripts that evaluate and provide feedback on
string-based user input.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
A palindrome is a word, phrase, number, or other sequences of characters that reads the same
forward and backward (ignoring spaces, punctuation, and capitalization). Examples of palindromic
words are "radar", "level", and "deified". In this practical, the focus will be on checking palindromic
words. To determine if a string is a palindrome, we compare the string to its reverse. If they are the
same, the string is palindromic.

Procedure:
1. Start the script.

2. User Input:
- Prompt the user to enter a string.
- Store this string.

3. Check if Palindrome:
- Reverse the entered string.
- Compare the reversed string with the original string.
- If they match, the string is a palindrome.
- If not, the string is not a palindrome.

4. Display Result:
- Print the result based on the comparison.

5. End the script.

Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)


Quiz:
1. What is a palindrome?
2. If the entered string is "MADAM", will the script categorize it as a palindrome?
3. What operation is primarily used to determine if a string is a palindrome?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 14
Aim: Introduction to shell programming using filters, with a focus on grep, egrep, and
fgrep.

Date:

Competency and Practical Skills:


1. Understand the function and application of filters in UNIX.
2. Utilize grep, egrep, and fgrep to search patterns and strings in files.
3. Differentiate between basic and extended regular expressions.
4. Combine filtering commands with other UNIX commands to produce desired outputs.

Relevant CO: Evaluate the requirement for process synchronization and coordination
handled by operating system.

Objectives:
1. To familiarize students with the concept of filters in UNIX and their applications.
2. To introduce students to the capabilities and uses of grep, egrep, and fgrep.
3. To encourage the use of filtering commands in processing and searching text data.
4. To provide insights into how pattern searching and regular expressions work in UNIX-like
systems.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
Filters in UNIX are commands that process text data, producing useful transformations on the input.
They are often combined with other commands using pipes | to process streams of data.

Among the many filters, grep and its variants (egrep and fgrep) are especially popular:

- grep: Stands for "global regular expression print." It searches the given file for lines containing a
match to the given pattern or string. By default, grep displays the matching lines.

- egrep: Stands for "extended grep". It functions the same as grep -E and treats patterns as extended
regular expressions.

- fgrep: Stands for "fixed grep". It functions the same as grep -F and treats patterns as fixed strings
(no special characters, etc.)

Procedure:
1. Using grep:
- Command: grep 'pattern' filename
- Use case: To search for a specific pattern in a file.

2. Using egrep:
- Command: egrep 'pattern1|pattern2' filename
- Use case: To search for lines containing either "pattern1" or "pattern2" in a file using extended
regular expressions.

3. Using fgrep:
- Command: fgrep 'pattern' filename
- Use case: To search for a string without treating any characters as special characters or regular
expressions.
Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. What does the grep command do in UNIX?
2. Which command treats patterns as extended regular expressions?
3. What is the primary difference between grep and fgrep?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 15
Aim: Study of UNIX Shell and Environment Variables.

Date:

Competency and Practical Skills:


1. Understand the role and functionality of the UNIX shell.
2. Recognize the differences and features of various UNIX shells.
3. Understand what environment variables are and their significance in Unix-like operating
systems.
4. Access, modify, and utilize environment variables in the shell.

Relevant CO: Evaluate the requirement for process synchronization and coordination
handled by operating system.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
1. Unix Shell:
- The Unix shell is both a command-line interface and a powerful scripting environment. It
provides an interface for users to interact with the Unix operating system.
- Various shells are available, such as the Bourne Shell (sh), Bourne Again Shell (bash), C Shell
(csh), and the Korn Shell (ksh), each with its own set of features and syntax.
- The shell reads commands typed by a user and translates them into a form that the operating
system can understand. It also provides functionalities such as variable substitution, loops, and
conditionals within shell scripts.

2. Environment Variables:
- Environment variables are a set of dynamic named values that can affect the way running
processes behave on a computer. They exist as part of the environment in which a process runs.
- These variables are used by the shell and other programs to get information about the
environment, like the home directory, current path, or the terminal type.
- Some common environment variables include PATH (which specifies directories where
executable programs are located), HOME (which indicates the home directory of the current user),
and LANG (which defines the system's language and character set).

Procedure:
1. Accessing Environment Variables:
- You can access an environment variable in the shell using the syntax $VARIABLE_NAME. For
instance, echo $HOME will display the home directory of the current user.

2. Setting Environment Variables:


- You can set an environment variable for the current session using the export command in many
shells. For example, export VAR_NAME=value.

3. Listing All Environment Variables:


- The printenv command (used without arguments) will list all environment variables. Specific
variables can be queried, like printenv PATH.

Observations:
Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. What is the role of the UNIX shell?
2. Name two common environment variables in Unix-like systems.
3. How can you display the value of an environment variable named VAR_NAME?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 16
Aim: Write a shell script to validate the entered date. (eg. Date format is: dd-mm-
yyyy).

Date:

Competency and Practical Skills:


1. Understand the complexities of date validation.
2. Implement conditional checks and string manipulations in shell scripts.
3. Utilize arithmetic operations and modularity checks to determine leap years.
4. Design and implement scripts that validate user input based on defined criteria.

Relevant CO: Understand the process management policies and scheduling of processes by
CPU

Objectives:
1. To introduce students to the concept of date validation and the intricacies associated with calendar
systems.
2. To teach students about the conditions that determine leap years and how they affect date
validation.
3. To encourage logical thinking and problem-solving through the implementation of validation
checks.
4. To provide hands-on experience in validating and processing user input in shell scripts.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
Date validation is the process of ensuring that a given date string matches a specified format
and represents a valid calendar date. In this context, the date format is "dd-mm-yyyy". Validation
needs to consider factors like the number of days in each month and leap years.

Procedure:
1. Start the script.

2. User Input:
- Prompt the user to enter a date in the format "dd-mm-yyyy".
- Store this date.

3. Break Date into Components:


- Extract day, month, and year from the entered date using string manipulation.

4. Validation:
- Check if the extracted day, month, and year are numeric values.
- Ensure the month is between 01 and 12.
- Ensure the day is between 01 and the maximum valid day for the given month (e.g., 01-31 for
January, 01-28 or 01-29 for February depending on whether the year is a leap year or not).
- A year is a leap year if:
- It is divisible by 4 and not divisible by 100 OR
- It is divisible by 400.

5. Display Result:
- If the date is valid, print a message confirming its validity.
- Otherwise, print an error message.
6. End the script.
Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. What is the primary reason February can have either 28 or 29 days?
2. How do you determine if a year is a leap year?
3. If a user enters "31-04-2023" as the date, is this valid?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 17
Aim: Write an awk program using function, which convert each word in a given text
into capital.

Date:

Competency and Practical Skills:


1. Understand the foundational concepts of the awk programming language and its
application in text processing.
2. Design custom functions within awk to achieve specific text manipulations.
3. Implement pattern matching and processing to transform input data.
4. Efficiently utilize awk's capabilities to capitalize and format text as desired.

Relevant CO: Understand the process management policies and scheduling of processes by
CPU

Objectives:
1. To introduce students to the capabilities and functionalities of the awk programming language,
especially in the realm of text processing.
2. To showcase the design and application of custom functions in awk.
3. To instill an understanding of pattern matching, data processing, and transformation using awk.
4. To provide a clear and structured approach to capitalizing text, emphasizing algorithmic thinking
and design.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
awk is a text-processing programming language that is particularly well-suited for structured
data and produces formatted reports. The language is data-driven and is used for pattern scanning
and processing. It provides a way to create small and simple programs to transform and report on
data within files.
A crucial aspect of awk is its ability to match patterns and perform actions on the matched
data. Functions, both built-in and user-defined, can further extend its capabilities. One such task is
to capitalize the first letter of each word in a text.

Procedure:
1. Define the Capitalize Function:
- Accept a string as input.
- Extract the first letter of the string and convert it to uppercase.
- Append the remainder of the string (from the second character onwards) to the uppercase letter
without changing its case.
- Return the combined result as the capitalized word.

2. Read Input Line by Line:


- For each line of the input text, split the line into individual words.

3. Process Each Word:


- For every word in the line:
- Apply the previously defined capitalize function.
- Replace the original word with the capitalized version in the line.

4. Output the Modified Line:


- After processing all words in the current line, print the modified line to the output.
- Move to the next line of the input text and repeat the process until all lines are processed.
Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)

Quiz:
1. What is awk primarily used for?
2. How does awk handle the processing of input data by default?
3. In the context of the provided algorithm, what is the main purpose of the capitalize
function?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 18
Aim: Write a program for process creation using C. (Use of gcc compiler)

Date:

Competency and Practical Skills:


1. Understand the UNIX process model and the concept of parent and child processes.
2. Utilize the fork() system call to create new processes.
3. Differentiate between parent and child processes based on the return value of fork().
4. Design and implement C programs that create and manage processes.

Relevant CO: Evaluate the requirement for process synchronization and coordination
handled by operating system

Objectives:
1. To introduce students to the fundamentals of process management in UNIX-like operating
systems.
2. To educate on the usage and significance of the fork() system call in creating new processes.
3. To demonstrate the creation and differentiation of parent and child processes in a C program.
4. To foster an understanding of how processes are managed and controlled in a UNIX environment.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
In UNIX-like operating systems, the creation of a new process is accomplished using the
fork() system call. When a process calls fork(), it creates a new process called the child process.
The original process is called the parent process.

The child process is an almost exact copy of the parent process. Both processes will continue
executing from the point of the fork() call. The main difference is the value returned by fork(). In
the child process, fork() returns 0, while in the parent, it returns the child's process ID.

This distinction can be utilized to differentiate the roles of the parent and child processes in the
program.

Procedure:
1. Begin the program.
2. Call the fork() function.
3. Check the return value of fork().
- If the return value is negative, the fork failed.
- If the return value is zero, the current code block is being executed by the child process.
- If the return value is positive, the current code block is being executed by the parent process.
4. In the child process, print a message indicating that it's the child process and display its process
ID.
5. In the parent process, print a message indicating that it's the parent process, display its process
ID, and also display the child's process ID.
6. End the program.

Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)


Quiz:
1. What is the primary function used to create a new process in UNIX-like systems?
2. How can you differentiate between the child and parent processes after the fork() call?
3. What does fork() return in the child process?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 19
Aim: Study the concepts of virtual machines and virtualization.

Date:

Competency and Practical Skills:


1. Understand the fundamental principles behind virtual machines and virtualization.
2. Differentiate between various types of virtualization.
3. Recognize the benefits and potential challenges of implementing virtualization in an IT
environment.
4. Conceptualize how hypervisors work and differentiate between Type 1 and Type 2
hypervisors.

Relevant CO: Evaluate the requirement for process synchronization and coordination
handled by operating system

Objectives:
1. To introduce students to the foundational concepts of virtual machines and the broader realm of
virtualization.
2. To impart knowledge about the advantages, challenges, and use cases of virtualization in modern
IT infrastructures.
3. To educate on the roles and functions of hypervisors in a virtualized environment.
4. To provide insights into various types of virtualization, enabling students to make informed
decisions in real-world applications.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
1. Virtual Machines (VM):
- A Virtual Machine (VM) is a software-based simulation of a physical computer. It runs in an
isolated environment on a host system with the help of virtualization software. A VM operates
similarly to a physical computer, having its own CPU, memory, disk space, and I/O.

2. Virtualization:
- Virtualization refers to the act of creating a virtual (rather than physical) version of computing
resources. It allows for the creation of multiple virtual environments on a single physical system.
- At the heart of virtualization is the *hypervisor*, a software layer or platform that manages the
distribution of the underlying hardware resources to the virtual machines. There are two types of
hypervisors:
a. Type 1 (Bare Metal): Runs directly on the system's hardware.
b. Type 2 (Hosted): Runs atop a conventional operating system.

Advantages of Virtualization:

1. Resource Efficiency: Multiple VMs can run on a single physical server, optimizing hardware
usage.
2. Isolation: VMs are isolated from each other. If one VM crashes, it doesn’t affect others.
3. Snapshot and Cloning: VMs can be snapshotted to capture their current state, allowing easy
rollback. They can also be cloned for quick deployment.
4. Flexibility and Testing: VMs can run different operating systems on the same physical host,
which is beneficial for application testing across different environments.
5. Cost Savings: Virtualization can reduce the need for physical hardware, leading to cost savings
in hardware procurement and energy consumption.
Types of Virtualization:
1. Hardware/Platform Virtualization: Creation of VMs which act like real computers with an
operating system.
2. Network Virtualization: Splitting available bandwidth in a network into independent channels
which can be assigned to particular servers or devices.
3. Storage Virtualization: Pooling physical storage from multiple devices and presenting it as a
single storage device.
4. Application Virtualization: Packaging an application along with its runtime environment to run
on any compatible underlying OS.

Observations:

Quiz:
1. What is the primary software component responsible for managing virtual machines and
their access to the physical hardware?
2. Name the two types of hypervisors.
3. Why might an organization opt to use virtualization in their data center?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 20
Aim: Study the concepts and functionalities of Hypervisors, focusing on VMWare
ESXi, Microsoft Hyper-V, Xen Server, and the Java Virtual Machine.

Date:

Competency and Practical Skills:


1. Understand the foundational principles and types of hypervisors.
2. Recognize the features, advantages, and potential use cases of VMWare ESXi,
Microsoft Hyper-V, and Xen Server in virtualized environments.
3. Understand the JVM's role in executing Java applications and its importance in platform-
independent computing.
4. Compare and contrast the functionalities of different hypervisors and the JVM.

Relevant CO: Describe and analyze the memory management and its allocation policies.

Objectives:
1. To familiarize students with the realm of virtualization and the role of hypervisors in creating
and managing virtual environments.
2. To introduce the features and functionalities of VMWare ESXi, Microsoft Hyper-V, and Xen
Server, enabling informed decision-making in IT infrastructures.
3. To impart the knowledge of the Java Virtual Machine's workings and its importance in the Java
ecosystem.
4. To encourage the exploration and comparison of various virtualization technologies,
understanding their strengths, weaknesses, and use cases.

Equipment/Software: PC/Laptop, Windows Operating System, Installation file of Linux OS

Theory:
1. Hypervisors:
- A hypervisor, often termed a Virtual Machine Monitor (VMM), is software, firmware, or
hardware that creates and runs virtual machines. It divides the host system's resources to allocate
them to the VMs.

2. VMWare ESXi:
- VMWare ESXi is a Type 1 hypervisor integrated into VMware's vSphere suite. It's a bare-metal
hypervisor that installs directly onto the physical server and doesn't require an underlying operating
system.
- It offers centralized management, automation, and scalability capabilities.

3. Microsoft Hyper-V:
- Microsoft Hyper-V is a hypervisor-based virtualization system, part of Windows Server editions.
It's available both as a standalone product and an integrated feature of the Windows OS.
- Hyper-V can create both VMs and containers, offering robustness and flexibility for different
virtualization needs.

4. Xen Server:
- Xen is an open-source Type-1 or bare-metal hypervisor, initially developed by the University of
Cambridge and now hosted by the Linux Foundation.
- Xen is used by many cloud providers and offers features like live migration, VM cloning, and a
high level of security.

5. Java VM (JVM):
- The JVM is a virtualization engine for running Java bytecode. It isn't a hypervisor in the same
sense as the others listed but acts as a virtual machine that provides a runtime environment to
execute Java applications.
- Java applications are compiled into bytecode, which is executed by the JVM. This allows Java
applications to be platform-independent, adhering to the "write once, run anywhere" (WORA)
principle.

Conclusion: (Sufficient space to be provided)

Quiz:
1. Which of the mentioned hypervisors is integrated into VMware's vSphere suite?
2. What distinguishes the Java Virtual Machine from hypervisors like ESXi and Hyper-V?
3. Why is the JVM crucial for Java's "write once, run anywhere" principle?

Suggested Reference: < to be provided by the faculty member>

References used by the students: (Sufficient space to be provided)

Rubric wise marks obtained:

Rubrics 1 2 3 4 5 Total
Marks

You might also like