0% found this document useful (0 votes)
10 views10 pages

Aim: Write An Awk Program Using Function, Which Convert Each Word in A Given Text Into Capital

The document outlines several experiments related to operating systems, focusing on programming with awk for text manipulation, process creation using C, and the concepts of virtualization and hypervisors. Each experiment includes objectives, procedures, and quizzes to assess understanding of key concepts like process management, virtualization benefits, and the functionality of different hypervisors. The document serves as a practical guide for students to learn and apply foundational operating system principles.

Uploaded by

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

Aim: Write An Awk Program Using Function, Which Convert Each Word in A Given Text Into Capital

The document outlines several experiments related to operating systems, focusing on programming with awk for text manipulation, process creation using C, and the concepts of virtualization and hypervisors. Each experiment includes objectives, procedures, and quizzes to assess understanding of key concepts like process management, virtualization benefits, and the functionality of different hypervisors. The document serves as a practical guide for students to learn and apply foundational operating system principles.

Uploaded by

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

Operating System 230170132035

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.
Operating System 230170132035
4. Output the Modified Line:
- After processing all words in the current line, print the modified line to the output.
Shellscript:-
echo "Enter a text:"
read input_text
echo "$input_text" | awk '
function to_uppercase(word) {
return toupper(word)
}
{
for (i = 1; i <= NF; i++) {
$i = to_uppercase($i)
}
print $0
}’
Output:-
Operating System 230170132035

- 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
Operating System 230170132035

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.
Operating System 230170132035
Observations:

Result: (Sufficient space to be provided)

Conclusion: (Sufficient space to be provided)


Shellscript:-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
pid_t pid;
// Create a child process using fork()
pid = fork();
if (pid < 0) {
// Error occurred
perror("fork failed");
exit(1);
}
else if (pid == 0) {
// This block will be executed by the child process
printf("Child Process: PID = %d\n", getpid());
printf("Child Process: Parent PID = %d\n", getppid());
// You can add any other child-specific code here.
}
else {
// This block will be executed by the parent process
printf("Parent Process: PID = %d\n", getpid());
printf("Parent Process: Child PID = %d\n", pid);
// You can add any other parent-specific code here.
}
return 0;
}
Output:-
Operating System 230170132035

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
Operating System 230170132035

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,
Operating System 230170132035
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
Operating System 230170132035

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.
Operating System 230170132035

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