0% found this document useful (0 votes)
156 views18 pages

DIPLOMA Os Lab Manual

The document serves as a lab manual for operating systems, detailing the installation and comparison of major OS features, process scheduling algorithms, and basic to advanced Unix commands. It includes commands for file editing using Vi, Vim, gedit, and gcc, as well as instructions for creating various shell scripts. The manual provides practical exercises for students to enhance their understanding of operating systems and command-line operations.

Uploaded by

Nikita parmar
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)
156 views18 pages

DIPLOMA Os Lab Manual

The document serves as a lab manual for operating systems, detailing the installation and comparison of major OS features, process scheduling algorithms, and basic to advanced Unix commands. It includes commands for file editing using Vi, Vim, gedit, and gcc, as well as instructions for creating various shell scripts. The manual provides practical exercises for students to enhance their understanding of operating systems and command-line operations.

Uploaded by

Nikita parmar
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/ 18

Operating system lab manual

1. Install & test different types of Operating

System & compare its features.


Here’s a comparison of three major operating systems (OS): Windows, macOS, and Linux.

Feature Windows macOS Linux


Open Source (e.g.,
Developer Microsoft Apple
Ubuntu, Fedora)
Paid (bundled with Paid (bundled with
Cost Free
devices) Apple devices)
Graphical, highly Sleek and uniform Varies by distribution
User Interface
customizable graphical UI (e.g., GNOME, KDE)
System Optimized for Apple Low to high (depending
Moderate to high
Requirements hardware on distribution)
Hardware Broad, supports a Exclusive to Apple Broad, but requires
Compatibility wide range devices configuration
Moderate (requires High (due to closed Very high (fewer viruses,
Security
third-party tools) ecosystem) open-source transparency)
Good with proper Excellent on Apple Excellent, especially on
Performance
hardware hardware lightweight distros
Customization High Low Very high
Extensive (wide Extensive (Apple App Good, but fewer
Software Support
range of apps) Store) proprietary apps
Excellent (broad Moderate (limited Moderate (Steam, Proton
Gaming
game library) gaming support) for compatibility)
Moderate to advanced
Ease of Use Beginner-friendly Beginner-friendly
(depends on distribution)
Frequent, sometimes Depends on distribution
Updates Regular and seamless
disruptive (rolling or scheduled)
General users, Creative professionals, Developers, tech
Target Audience
gamers, businesses Apple ecosystem users enthusiasts, servers
Examples of Use Office work, Video editing, design, Programming, servers,
Cases gaming, education music production embedded systems
Operating system lab manual

2. Compare various process scheduling algorithms.

Best Use
Algorithm Description Advantages Disadvantages
Case
Batch
First-Come, Processes are executed Long average wait
Simple to systems with
First-Served in the order they arrive time; suffers from
implement. long-running
(FCFS) (FIFO queue). the "convoy effect."
jobs.
Jobs where
Selects the process Minimizes Can lead to
Shortest Job execution
with the shortest CPU average wait starvation for longer
Next (SJN) time is
burst time. time. processes.
known.
Each process gets a
Fair to all
fixed time slice
Round Robin processes; High context Time-sharing
(quantum) to execute,
(RR) reduces response switching overhead. systems.
cycling through the
time.
queue.
Operating system lab manual

3. Test and run basic Unix commands.

1] Command: Pwd

Description: Print working directory.

Output:

2] Command: mkdir

Description: Create a directory

3] Command: ls

Description: List directory contents.

Output:

4] Command: cd

Description: Change the working directory.

Output:
Operating system lab manual

5] Command: rmdir

Description: Remove directories.

Output:

6] Command: touch

Description: Create empty file.

Output:

6] Command: rm
Description: Remove file.
Output:
Operating system lab manual

7] Command: cat

Description: Display the contents of a file.

Output:

8] Command: mv

Description: rename files.

Output:

9] Command: date

Description: Display Current Date and Time.

Output:
Operating system lab manual

10] Command: echo

Description: Display a String.

Output:
Operating system lab manual

4. Test and run Advanced Unix commands.

1] Command: find

Description: The find command is used to search for files or directories

within a specified path

Output:

2] Command: awk

Description: This command will print the columns of files.

Output:

3] Command: sed

Description: sed is a stream editor used to perform basic text

transformations on input stream (a file or input from a pipeline).

Output:

4] Command: chmod

Description: The chmod command changes the permissions of a file or

directory.
Operating system lab manual

Output:
Operating system lab manual

5] Command: lsof

Description: The lsof command lists information about files opened by

processes

Output:
Operating system lab manual

5. Test commands related with File editing with

Vi, Vim, gedit, gcc.

1. Vi and Vim Commands

Vi and Vim are terminal-based text editors. Vim is an improved version of Vi.

Command Description
vi filename Open a file in Vi editor.
vim filename Open a file in Vim editor.
i Enter insert mode to edit text.
Esc Exit insert mode.
:w Save changes to the file.
:q Quit the editor.
:wq Save and exit.
:q! Quit without saving changes.

2. gedit Commands
gedit is a graphical text editor available for Linux systems (GNOME-based).

Command Description

gedit filename Open a file in gedit.

Ctrl+S Save the file.

Ctrl+Q Quit gedit.

Ctrl+F Search for a specific word or pattern.

Ctrl+H Find and replace text in the file.

Ctrl+Z Undo the last action.

Ctrl+Y Redo the last undone action.

3. gcc Commands
gcc is a compiler for C and C++ programming languages.
Operating system lab manual

Command Description

gcc filename.c -o output Compile a C file into an executable named output.

./output Run the compiled executable.

gcc -Wall filename.c Compile the file with all warnings enabled.

gcc -g filename.c -o output Compile the file with debugging symbols.

gcc -O2 filename.c -o output Compile the file with optimization level 2.

gcc -c filename.c Compile only, generating an object file (filename.o).

gcc file1.c file2.c -o output Compile multiple C files into one executable.
Operating system lab manual

6. Create a shell script to print”Hello”.

Script:

Output:
Operating system lab manual

7. Create a Shell script to read and display

content of a file.

Script:

Output:
Operating system lab manual

8. Create a Shell script to read from command

line.

Script:

Output:
Operating system lab manual

9. Create a Shell script to append content of one

file to another

Script:

Output:
Operating system lab manual

10. Create a Shell script to accept a string in lower case


letters from a user & convert to upper case letters.

Script:

Output:
Operating system lab manual

11. Create a Shell script to find numbers of characters,


words & lines of a given input file
Script:

Output:

12. Create a Script to reverse a string and

display it.

13. Create a Script to check a string is

palindrome.
Operating system lab manual

14. Create a Shell script to add two numbers.

15. Create a shell script to reverse the digits of a given 5-


digit number. (For eg. if the no. is 57429 then answer is
92475).

You might also like