OSV-Practical File
OSV-Practical File
B.E. Semester-IV
(Information Technology)
Certificate
This is to certify that Mr./Ms. << Student Name >> Enrollment No.<<…
>> of B.E. Semester 4th Information Technology of this Institute (GTU
Code:016) has satisfactorily completed the Practical work for the subject
Operating System and Virtualization (3141601) for the academic
year 2024.
Place: __________
Date: __________
Index
Date:
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.
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:
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:
Step-1: Select a Linux distribution: we are using Ubuntu Linux System.
1.
2.
Quiz:
1. Who developed the Linux operating system?
The Linux operating system was developed by Linus Torvalds in 1991.
2. Name any two popular distributions of Linux.
Two popular distributions of Linux are Ubuntu and Fedora.
3. What is the core of the Linux operating system called?
The core of the Linux operating system is called the Linux kernel.
4. Why do we need to create a bootable USB or DVD for the installation of Linux?
Creating a bootable USB or DVD is necessary for Linux installation because it allows the
computer to boot from the external media and initiate the installation process without
needing an already functioning operating system on the computer's hard drive.
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:
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.
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.
6. Start the Virtual Machine: Click 'Start' on Virtual Box to run the VM. The Linux installer
should boot up.
8. Install Guest Additions: After installation, for better performance and integration
features, it's recommended to install Virtual Box Guest Additions.
Observations:
Step-1: Download & Install Virtualization Software:
1.
2.
Step-4: Set Up Virtual Hard Disk:
1.
2.
Conclusion:
The successful installation of Linux as a guest OS on Windows using virtualization software
highlights the importance and practical application of virtualization in modern computing.
Participants gained valuable hands-on experience in setting up and managing virtualized
environments, enhancing their understanding of operating system concepts and architecture. This
exercise provided a solid foundation for further exploration and utilization of virtualization
technology in various computing scenarios.
Quiz:
1. What is the difference between a Host OS and a Guest OS in virtualization?
The Host OS (Operating System) is the main operating system installed directly on
the physical hardware of a computer, while the Guest OS is an operating system
running within a virtual machine (VM) on the Host OS.
2. Name one popular virtualization software used to run multiple operating systems
on a single machine.
One popular virtualization software used to run multiple operating systems on a
single machine is VMware.
3. Why is it recommended to install Guest Additions in Virtual Box after installing a
Linux guest OS?
It is recommended to install Guest Additions in VirtualBox after installing a Linux
guest OS because Guest Additions enhance the performance and usability of the
virtual machine by providing features such as better display resolution, mouse
integration, and improved file sharing between the guest and host operating
systems.
Suggested Reference:
Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 3
Date:
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.
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:
(2) Command : ls
Syntax : ls
Use : The ls command in linux is used to display a Directorys files and folders.
Example : ls
Output :
(3) Command : cd
Syntax : cd
Use : The cd command is used to change the current directory.
Example :
Output :
(6)Command : rm
Syntax : rm
Use : delete files
Output : remove regular file 'example.txt'?
(9) Command : mv
Syntax :mv file1_name file2_name
Use : to move one file to another file
Example : mv 1.sh 5.sh
Command : ps
Syntax : ps
Use : Display the processes in terminal
Output:
Result: Through the experiment, proficiency in essential Linux/UNIX commands such as ls,
cd, mkdir, rm, and grep was achieved, demonstrating foundational competence in navigating
the command line interface and performing basic file management tasks.
Conclusion:
Quiz:
1. What is the purpose of the Pwd command in Linux/UNIX?
The purpose of the ‘pwd’ command in Linux/UNIX is to print the current working
directory.
2. How can you view the manual or help page of a particular command?
You can view the manual or help page of a particular command by using the ‘man’
command followed by the command name. For example, to view the manual for
the ‘ls’ command, you would type ‘man ls’.
3. Which command is used to list all the running processes in the system?
The command used to list all the running processes in the system is ‘ps’.
4. How would you create a new directory named "Documents" using a command?
To create a new directory named "Documents" using a command, you would use
the ‘mkdir’ command followed by the directory name. So, the command would be
‘mkdir Documents’.
Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 4
Aim: Study of Advanced Commands and Filters of Linux/UNIX.
Date:
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.
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 (|).
Procedure:
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.
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:
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?
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:
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.
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.
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:
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?
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:
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.
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.
Observations:
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?
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:
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.
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
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 \).
Observations:
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?
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:
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.
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:
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.
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?
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:
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.
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:
Procedure:
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.
Observations:
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?
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:
Date:
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.
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
Observations:
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?
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:
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.
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:
5. Display Result:
- Print the sorted numbers.
6. End the script.
Observations:
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?
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:
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.
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.
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?
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:
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.
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.
Observations:
Result: (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?
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:
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.
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:
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?
Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 15
Aim: Study of UNIX Shell and Environment Variables.
Date:
Relevant CO: Evaluate the requirement for process synchronization and coordination
handled by operating system.
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.
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?
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:
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.
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.
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.
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?
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:
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.
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.
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?
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:
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.
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:
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?
Rubrics 1 2 3 4 5 Total
Marks
Experiment No: 19
Aim: Study the concepts of virtual machines and virtualization.
Date:
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.
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?
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:
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.
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.
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?
Rubrics 1 2 3 4 5 Total
Marks