0% found this document useful (0 votes)
27 views

Operating System: Semester 5

Uploaded by

bonemann074
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)
27 views

Operating System: Semester 5

Uploaded by

bonemann074
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
SEMESTER 5
UNIT - 1

HI COLLEGE
SYLLABUS
UNIT - 1

HI COLLEGE
INTRODUCTION

What is Operating System


An operating system (OS) is a program that manages a computer's hardware
resources and provides an easy-to-use interface for users. It handles tasks like
memory management, input/output processing, process scheduling, and
file/storage device management. The OS also offers services to running
applications, such as printing, networking, and security. The main goal of an OS
is to make the computer more efficient, dependable, and user-friendly.

Functions of Operating System


1. Process Management: The OS manages the execution of multiple processes
simultaneously by allocating CPU time, memory, and I/O resources to each
process.

2. Memory Management: The OS manages the computer's RAM by allocating


and deallocating memory to processes, swapping data between RAM and
secondary storage, and implementing virtual memory techniques.

3. Input/Output Management: The OS manages all input and output


operations, such as keyboard input, mouse clicks, and file access, by buffering
data, scheduling I/O requests, and controlling peripheral devices.

4. File Management: The OS manages the creation, deletion, and manipulation


of files by implementing a file system that organizes files into directories and
handles file permissions and access control.

5. Device Management: The OS manages all connected devices, such as


printers, scanners, and network adapters, by providing device drivers that
communicate with the hardware and handle device-specific functions.

6. Security Management: The OS implements various security measures to


protect the system and user data from unauthorized access or modification,
such as user authentication, access control lists (ACLs), and encryption
techniques.

7. Networking Management: The OS provides networking services to connect


the computer to other devices on a network or the internet by implementing
protocols for data transmission, routing, and addressing.

HiCollege Click Here For More Notes 01


8. Resource Allocation: The OS allocates system resources efficiently by
implementing scheduling algorithms for CPU time allocation, memory
allocation policies, and I/O scheduling techniques.

9. User Interface Management: The OS provides a user-friendly interface for


interacting with the computer by implementing graphical user interfaces
(GUIs), command-line interfaces (CLIs), or both.

Simple Batch Systems


A simple batch system is a type of computer system that processes a list of jobs
or tasks in batches. Each batch contains multiple jobs that are submitted to the
system and stored in a queue. The system processes the jobs in the order they
are received, without any interaction or feedback from the user.

1. What are the advantages of a simple batch system in operating systems?

Processes jobs in batches, reducing the risk of errors and improving system
stability.
Requires fewer resources and can handle a larger number of jobs
simultaneously, making it more cost-effective than interactive systems.
Provides simplicity and reliability since there is no user interaction during
job execution.

2. What are the disadvantages of a simple batch system in operating systems?

Longer wait times for users due to job processing in batches.


Lower throughput for critical jobs since jobs are processed in batches.
Limits the ability to perform interactive tasks or real-time processing due to
lack of immediate feedback or response from the system.

HiCollege Click Here For More Notes 02


Multi programmed Batch systems
A multi-programmed batch system is an advanced version of a simple batch
system. It allows the system to execute multiple jobs simultaneously by
dividing the CPU time into smaller segments called time slices. Each job is
assigned a time slice, and the CPU switches between jobs in a round-robin
fashion.

Improved resource utilization: By executing multiple jobs simultaneously,


the system can utilize CPU resources more efficiently, reducing wait times
for users and improving overall throughput.

Reduced response time: Since jobs are executed in shorter time slices, users
can receive faster responses and feedback, improving the overall
responsiveness of the system.

Better job prioritization: Multi-programmed batch systems allow for job


prioritization based on factors such as deadline, resource requirements, and
importance. This ensures that critical jobs receive the necessary resources
and are executed in a timely manner.

Increased system complexity: Multi-programmed batch systems are more


complex than simple batch systems due to the need for scheduling
algorithms, memory management techniques, and CPU resource allocation
strategies. This requires additional resources and expertise to implement
and maintain.

Time-Sharing Systems
In the context of operating systems, a time-sharing system is a type of
interactive system that allows multiple users to access the same computer
resources simultaneously. Here are some points about time-sharing systems:

1. User interaction: Time-sharing systems allow users to interact directly with


the system, providing immediate feedback and response times.

2. Resource sharing: Multiple users can access the same computer resources
simultaneously, including CPU time, memory space, and input/output devices.

HiCollege Click Here For More Notes 03


3. Virtualization: Time-sharing systems use virtualization techniques to provide
each user with a virtual machine that includes a virtual CPU, memory space,
and input/output devices. This allows multiple users to access the same
physical resources simultaneously without interfering with each other's work.

4. Multitasking: Time-sharing systems support multitasking, allowing users to


run multiple jobs or applications simultaneously.

5. Resource management: Time-sharing systems use resource management


techniques to allocate resources fairly among users and prevent resource
contention. This includes scheduling algorithms, memory management
techniques, and CPU resource allocation strategies.

6. Security: Time-sharing systems require strong security measures to protect


user data and prevent unauthorized access to system resources. This includes
user authentication, access control, and data encryption techniques.

Personal-computer systems
In the context of computing, a personal computer (PC) is a microcomputer
designed for individual use. Here are some points about personal-computer
systems:

1. Microprocessor: Personal computers use microprocessors, which are small,


fast-processing chips that can perform complex calculations and operations.

2. Input/output devices: Personal computers include input/output devices such


as a keyboard, mouse, monitor, and printer, allowing users to interact with the
system and produce output.

3. Operating system: Personal computers use an operating system to manage


system resources, provide user interfaces, and support applications. Common
operating systems for personal computers include Windows, macOS, and Linux.

4. Applications: Personal computers support a wide variety of applications,


including productivity software (such as word processors and spreadsheet
programs), gaming software, and multimedia software (such as video editors
and music players).

HiCollege Click Here For More Notes 04


5. Networking: Personal computers often include networking capabilities,
allowing users to connect to the internet, access network resources, and
communicate with other users over a network.

6. Storage: Personal computers use storage devices such as hard drives, solid-
state drives (SSDs), and flash memory to store data and programs.

7. Expandability: Personal computers are highly expandable, allowing users to


add additional hardware components such as RAM, graphics cards, and sound
cards to enhance system performance and functionality.

Parallel systems
In the context of computing, a parallel system is a computer system that can
perform multiple operations simultaneously. Here are some points about
parallel systems:

1. Multiple processors: Parallel systems use multiple processors, which are


separate computing units that can execute instructions independently.

2. Communication: Parallel systems use communication networks to allow


processors to share data and synchronize their operations.

3. Load balancing: Parallel systems use load balancing techniques to distribute


workloads across processors and prevent any one processor from becoming
overloaded.

4. Scalability: Parallel systems are highly scalable, allowing for the addition of
new processors as needed to increase system performance and capacity.

5. Applications: Parallel systems are commonly used in applications that


require high computational power, such as scientific simulations, financial
modeling, and machine learning.

6. Challenges: Parallel systems can be challenging to design and implement


due to the complexities of managing multiple processors and ensuring data
consistency and synchronization.

7. Performance: Parallel systems can offer significant performance


improvements over traditional single-processor systems, particularly for large-
scale computational workloads.

HiCollege Click Here For More Notes 05


Distributed Systems
In the context of computing, a distributed system is a network of computers
that work together to provide a coordinated and coherent response to user
requests. Here are some points about distributed systems:

1. Network: Distributed systems use a network to connect multiple computers,


allowing them to communicate and share resources.

2. Replication: Distributed systems use replication techniques to ensure data


consistency and availability across multiple nodes in the network.

3. Fault tolerance: Distributed systems are designed to be fault-tolerant,


meaning they can continue operating in the face of hardware or software
failures.

4. Scalability: Distributed systems are highly scalable, allowing for the addition
of new nodes as needed to increase system capacity and performance.

5. Applications: Distributed systems are commonly used in applications that


require high availability, such as online transaction processing, database
management, and web services.

6. Challenges: Distributed systems can be challenging to design and


implement due to the complexities of managing network communication,
synchronization, and resource allocation across multiple nodes.

7. Performance: Distributed systems can offer significant performance


improvements over traditional centralized systems, particularly for large-scale
workloads that require high availability and scalability.

Real-Time Systems
In the context of computing, a real-time system is a computer system that is
designed to respond to external events or inputs within a specified time
constraint. Here are some points about real-time systems:

1. Timeliness: Real-time systems prioritize timeliness over other system


characteristics such as resource utilization or throughput.

2. Determinism: Real-time systems are deterministic, meaning they produce


predictable and repeatable results for a given input.

HiCollege Click Here For More Notes 06


3. Hard real-time: Some real-time systems have hard real-time constraints,
meaning they must respond to inputs within a strict time limit or suffer
catastrophic consequences.

4. Soft real-time: Other real-time systems have soft real-time constraints,


meaning they prioritize timeliness but can tolerate some degree of latency or
jitter.

5. Applications: Real-time systems are commonly used in applications that


require fast and predictable responses, such as industrial automation, avionics,
and medical devices.

6. Challenges: Real-time systems can be challenging to design and implement


due to the complexities of managing resource allocation, scheduling, and
synchronization in the face of external events and inputs.

7. Performance: Real-time systems require high performance and low latency


to meet their strict time constraints, which can make them more expensive and
complex than traditional computing systems.

HiCollege Click Here For More Notes 07


INTRODUCTION TO LINUX: ARCHITECTURE OF
LINUX OS

Linux is an open-source operating system (OS) that is widely used in servers,


supercomputers, and embedded systems. Here's an introduction to the
architecture of the Linux OS:

1. Kernel: The Linux kernel is the core of the operating system. It manages
hardware resources, schedules processes, and provides system services such as
memory management, process management, and device drivers.

2. Init: The init process is responsible for starting other processes and services
when the system boots up. It also manages user sessions and handles system
shutdowns.

3. Shell: The shell is the user interface for interacting with the operating system.
It provides a command-line interface for executing commands and scripts.

4. Libraries: Linux provides a set of standard libraries for common


programming tasks such as input/output, math, and networking.

5. Utilities: Linux includes a wide range of utilities for managing files,


directories, processes, and system resources.

6. Applications: Linux supports a variety of applications, including web servers,


databases, text editors, and office suites.

7. Architecture: Linux supports multiple architectures, including x86, ARM,


PowerPC, and SPARC. It also supports multiple file systems, including ext4, XFS,
and Btrfs.

8. Community: Linux is an open-source project that is developed and


maintained by a global community of developers and users. This community
provides ongoing support and development for the operating system through
various channels such as mailing lists, forums, and wikis.

HiCollege Click Here For More Notes 08


BASIC DIRECTORY STRUCTURE OF LINUX

The directory structure of Linux is designed to make it easy to organize and


manage files and directories. Here's a basic overview of the Linux directory
structure:

1. Root directory (/): The root directory is represented by a single forward slash
(/) and contains all other directories and files in the system.

2. Home directories (/home): Each user has a home directory, which is created
automatically during the user account creation process. The home directory for
the root user is /root.

3. System directories (/dev, /etc, /lib, /opt, /proc, /sbin, /sys): These directories
contain system-specific files and configurations. Some of these directories are
hidden by default, but can be accessed using the ls -a command.

4. User directories (/usr): This directory contains user-specific files and


applications, such as documentation, games, and multimedia files.

5. Temporary directories (/tmp): This directory is used to store temporary files


and data that are deleted when the system is restarted or the user logs out.

6. Mount points (/media, /mnt): These directories are used to mount external
storage devices such as USB drives and CD/DVD drives.

7. Log files (/var/log): This directory contains log files generated by various
system services and applications.

8. Backup directories (/backup): Some Linux distributions provide a backup


directory for storing system backups.

9. Binaries (/bin, /sbin): These directories contain executable binaries for


commonly used commands and utilities. The binaries in /bin are available to all
users, while the binaries in /sbin are restricted to root or administrators only.

HiCollege Click Here For More Notes 09


Basic Commands
1. man: The man command is used to display the manual pages for a specific
command or function. To use man, simply type man followed by the command
you want to learn about. For example, man ls will display the manual page for
the ls command.

2. info: The info command is similar to man, but provides more detailed
information in a hypertext format. To use info, type info followed by the
command you want to learn about. For example, info ls will display the info
page for the ls command.

3. help: The help command is used to display help messages for built-in shell
commands. To use help, simply type help followed by the command you want
to learn about. For example, help cd will display the help message for the cd
command.

4. whatis: The whatis command is used to display a short description of a


specific command or function. To use whatis, type whatis followed by the
command you want to learn about. For example, whatis ls will display a short
description of the ls command.

5. apropos: The apropos command is used to search for commands related to a


specific keyword or phrase. To use apropos, type apropos followed by the
keyword or phrase you want to search for. For example, apropos backup will
display a list of commands related to backups.

6. cat: The cat command is used to display the contents of a file on the screen.
To use cat, simply type cat followed by the filename you want to view. For
example, cat myfile.txt will display the contents of myfile.txt on the screen.

7. mkdir: The mkdir command is used to create a new directory or folder. To use
mkdir, simply type mkdir followed by the name of the new directory or folder
you want to create. For example, mkdir mynewfolder will create a new
directory called mynewfolder in your current working directory.

8. rmdir: The rmdir command is used to delete an empty directory or folder. To


use rmdir, simply type rmdir followed by the name of the directory or folder you
want to delete. For example, rmdir mynewfolder will delete the directory called
mynewfolder if it is empty (contains no files or subdirectories).

HiCollege Click Here For More Notes 10


Basic Commands
9. cd: The cd command is used to change your current working directory or
folder. To use cd, simply type cd followed by the path or name of the new
directory or folder you want to move into (relative or absolute). For example, cd
mydirectory will move you into a directory called mydirectory in your current
working directory, while cd /home/user will move you into your home directory
(assuming your username is user).

10. mv: The mv command is used to move or rename files and directories within
your file system (local or remote). To use mv, simply type mv followed by the
name of the file or directory you want to move or rename (source), followed by
its new name or location (destination). For example, mv myfile.txt
/home/user/mynewfolder will move a file called myfile.txt into a directory called
mynewfolder in your home directory (assuming your username is user).
Alternatively, mv myfile1 myfile2 will rename a file called myfile1 to myfile2 in
your current working directory (assuming it's not already taken).

11. cp: The cp command is used to copy files and directories within your file
system (local or remote). To use cp, simply type cp followed by the name of the
file or directory you want to copy (source), followed by its new location
(destination). For example, cp myfile1 myfile2 will create a copy of a file called
myfile1 and save it as myfile2 in your current working directory (assuming it's
not already taken). Alternatively, cp -r /home/user/mydirectory
/media/backup/mybackupdirectory will copy an entire directory called
mydirectory from your home directory into a backup directory called
mybackupdirectory on an external storage device called /media/backup
(assuming your username is user and your backup device is mounted at
/media/backup).

12. rm: The rm command is used to delete files and directories within your file
system (local or remote). To use rm, simply type rm followed by the name of the
file or directory you want to delete (source). For example, rm myfile1 will delete
a file called myfile1 in your current working directory (assuming it exists).
Alternatively, rm -r /home/user/mydirectory will delete an entire directory
called mydirectory in your home directory (assuming your username is user and
it's empty). Use caution when using rm with directories as it will delete all files
and subdirectories contained within!

HiCollege Click Here For More Notes 11


Basic Commands
13. file: The file command is used to identify the type of a file based on its
contents and metadata (either binary or text). To use file, simply type file
followed by the name of the file you want to identify (source). For example, file
myfile1 will identify whether a file called myfile1 is binary or text-based based
on its contents and metadata (useful for determining whether an executable
binary can be opened using text editors like nano!).

14. pwd: The pwd command is used to display the full path and location of your
current working directory or folder (absolute). To use pwd, simply type pwd
without any arguments or options (just pwd). For example, pwd will display
something like /home/user if your username is user and you're currently
working in your home directory!

15. date: The date command is used to display the current date and time in
various formats (either local or UTC timezones). To use date, simply type date
followed by various options and arguments as needed (either with quotes
around them if they contain spaces!). For example, date +%Y-%m-%d_%H-%M-
%S will display something like 2021-06-04_14-05-06 if today's date and time are
June 4th 2021 at 2:05 PM UTC! Alternatively, date --utc --rfc-3339=date can be
used for UTC timezone formats that conform with RFC 3339 standards!

16. cal: The cal command is used to display various calendar views based on
different months and years (either local or UTC timezones). To use cal, simply
type cal followed by various options and arguments as needed (either with
quotes around them if they contain spaces!). For example, cal -y 2022 displays a
yearly calendar view for 2022 starting from January 1st through December 31st!
Alternatively, cal -m 6 displays a monthly calendar view for June 2022! Useful
for planning events and deadlines based on different months and years!

17. Echo: The echo command is used to display a message or string of text on
the screen. To use echo, simply type echo followed by the message or string you
want to display. For example, echo "Hello, world!" will display the message
"Hello, world!" on the screen.

HiCollege Click Here For More Notes 12


Basic Commands
18. Bc: The bc command is used to perform arithmetic and mathematical
calculations in a command-line environment. To use bc, simply type bc
followed by your calculations (either with quotes around them if they contain
spaces!). For example, bc <<< "10 * 5" will calculate the product of 10 and 5
(which is 50) and display it on the screen! Useful for quick calculations without
needing to open a text editor or spreadsheet program!

19. Ls: The ls command is used to list the contents of a directory or folder (either
with or without options and arguments as needed). To use ls, simply type ls
followed by the name of the directory or folder you want to view (either with
quotes around it if it contains spaces!). For example, ls mydirectory will display a
list of files and subdirectories contained within a directory called mydirectory in
your current working directory (assuming it exists)! Useful for quickly viewing
the contents of directories without needing to open a graphical file manager
program!

20. Who: The who command is used to display information about currently
logged-in users on your system (either with or without options and arguments
as needed). To use who, simply type who without any arguments or options
(just who). For example, who will display a list of currently logged-in users on
your system along with their login times and terminal sessions! Useful for
quickly checking who's currently logged into your system and what they're
doing!

21. Whoami: The whoami command is used to display your current username or
login ID (either with or without options and arguments as needed). To use
whoami, simply type whoami without any arguments or options (just whoami).
For example, whoami will display your current username or login ID (useful for
quickly checking what username you're currently logged into your system as)!

22. Hostname: The hostname command is used to display the hostname or


network name of your system (either with or without options and arguments as
needed). To use hostname, simply type hostname without any arguments or
options (just hostname). For example, hostname will display the hostname or
network name of your system (useful for quickly checking what network name
your system is currently using)!

HiCollege Click Here For More Notes 13


VI EDITOR
Vi Basics
1. Starting vi: To start vi, open your terminal and type `vi` followed by the
filename you want to edit or create. For example, `vi myfile.txt` will open a new
file called `myfile.txt` in vi. If the file already exists, vi will open it in edit mode. If
the file doesn't exist, vi will open it in create mode.

2. Moving around: In vi, you can move around the text using the following keys:

`h`: Move left one character.


`j`: Move down one line.
`k`: Move up one line.
`l`: Move right one character.
`0`: Move to the beginning of the current line.
`$`: Move to the end of the current line.
`G`: Move to the end of the file.
`gg`: Move to the beginning of the file.

3. Inserting text: To insert text in vi, press `i` to enter insert mode. You can then
type your text and press `Esc` to exit insert mode and return to command
mode.

4. Deleting text: To delete text in vi, use one of these methods:

`x`: Delete the character under the cursor.


`dd`: Delete the current line.
`D`: Delete from the cursor to the end of the line.
`C`: Change (replace) the current line with new text in insert mode.

5. Searching and replacing: To search for text in vi, use `/search_string`. To


replace text, use `:%s/old_string/new_string/g`. For example,
`:%s/old_string/new_string/g` will replace all occurrences of "old_string" with
"new_string" in the entire file (useful for making global replacements). To
search and replace interactively, use `:%s/old_string/new_string/gc`. This will
prompt you to confirm each replacement before making it (useful for
preventing accidental replacements).

HiCollege Click Here For More Notes 14


Vi Basics
6. Saving and exiting: To save your changes and exit vi, use `:wq`. If you want to
save your changes but stay in vi, use `:w`. If you want to exit vi without saving
your changes, use `:q!`. If you want to exit vi and overwrite an existing file
without being prompted, use `:wq!`. If you want to exit vi and overwrite an
existing file after being prompted, use `:wq!`.

Three modes of vi Editor


1. Command Mode: This is the default mode you enter when you start vi or
when you press the Esc key. In this mode, you can move around the file using
the arrow keys, Home, End, Page Up, and Page Down. You can also search for
text using the forward slash (/) and question mark (?) keys. To enter a command,
type a colon (:) followed by the command you want to execute.

2. Insert Mode: To enter Insert Mode, press the i key in Command Mode. In this
mode, you can type text just like you would in any other text editor. To exit
Insert Mode and return to Command Mode, press the Esc key.

3. Last Line Mode: This mode is entered automatically when you add a new line
to the file or when you move to the last line of the file. In this mode, you can
add text to the last line of the file without having to move back to it using
normal navigation commands. To exit Last Line Mode and return to Command
Mode, press the Esc key.

Note that some distributions of Linux may have different vi editors installed by
default, such as Vim or Nano, which may have additional modes or features
beyond these three basic modes.

HiCollege Click Here For More Notes 15


How to write, Save & execute a shell script in vi editor
1. Open the vi editor and create a new file by typing `vi myscript.sh` (replace
"myscript.sh" with the name you want to give your script).

2. Enter Insert Mode by pressing the `i` key.

3. Type in the shell commands you want to execute in your script. Make sure to
save the script with a `.sh` extension, as this is the standard extension for shell
scripts.

4. To save and exit vi, press `Esc` to enter Command Mode, then type `:wq` and
press Enter. This will save the changes you made and exit vi.

5. To execute the script, open a terminal window and navigate to the directory
where you saved the script. Then, type `bash myscript.sh` (replace "myscript.sh"
with the name of your script) and press Enter. This will execute the script using
the Bash shell.

Alternatively, you can make your script executable by adding a shebang line at
the beginning of the script, like this:

```sh
#!/bin/bash
```

Then, make the script executable by running `chmod +x myscript.sh` in your


terminal window, and you can run it simply by typing `./myscript.sh`.

HiCollege Click Here For More Notes 16

You might also like