0% found this document useful (0 votes)
34 views62 pages

OS-Unit 1 2023

Uploaded by

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

OS-Unit 1 2023

Uploaded by

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

Introduction to

Operating Systems
UNIT 1

DR. SHIVANI VATS


Operating Systems[ BCA 301]
• TEXT BOOK: Silbersachatz and Galvin, “Operating System Concepts”,
Pearson, 10th Ed., 2018
• SYLLABUS OVERVIEW: Refer Lesson Plan

 PRE-REQUISITE:
• TYPES OF SOFTWARES
• UNITS OF MEMORY
• TYPES OF MEMORY
• BASICS OF ALGORITHMS

Note: Refer classroom notes for numerical and more


conceptual examples.
DR. SHIVANI VATS
PYQ’s: 2024

Q2. a) Explain multi-programming, time-sharing, distributed system


and real time systems in terms of memory management, process
management and processor scheduling. (6)
b)Write a shell program to find the factorial of a number accepted
from user. (6.5)

DR. SHIVANI VATS


PYQ’s: 2024

• Explain the role of operating system. Give example of each type of


operating system. (2)
• Explain the three modes of vi editor. Explain how to write, save and
execute a shell script in vi editor. (2)

DR. SHIVANI VATS


PYQ’s: 2024

Q3 a) Explain the Linux Architecture with diagram. Describe the basic


directory structure of Linux. (6)
b) Explain the following Linux commands with syntax and the output of
the command. (6.5)
i) Cat iv) pwd
ii) Mv v) tty
iii) Who vi) apropos

DR. SHIVANI VATS


What is Operating System?

• An operating system is a program that manages a computer’s


hardware.
• It also provide a basic for application programs and acts as an
intermediary between the computer user and the computer
hardware.

DR. SHIVANI VATS


DEFINATION

• In simple terms, an operating system is the interface between the


user and the machine.

DR. SHIVANI VATS


What operating system Do?
• A computer system can be divided into four components : the
hardware, the operating system, the application programs and the
users.
• The hardware –the central processing unit, the memory and the
input/output devices provides the basic computing resources for the
system.
• The application programs-such as word processors, spreadsheets,
compilers and we browsers-define the ways in which these
resources are used to solve user’s computing problem.

DR. SHIVANI VATS


What operating system Do?

• The operating system controls the hardware and coordinates its use
among the various application programs for the various users.

DR. SHIVANI VATS


Two Views of Operating System

1. User's View
2. System View

DR. SHIVANI VATS


Operating System: User View
• The user view of the computer refers to the interface being used.
• In these cases, the operating system is designed mostly for ease of use,
with some attention paid to performance, and none paid to resource
utilization.

DR. SHIVANI VATS


Operating System: System View
• Operating system can be viewed as a resource allocator also.
• A computer system consists of many resources like - hardware and
software - that must be managed efficiently.
• The operating system acts as the manager of the resources, decides
between conflicting requests, controls execution of programs etc.

DR. SHIVANI VATS


Following are some of important
functions of an operating System.
1. Memory Management
2. Processor Management
3. Device Management
4. File Management

DR. SHIVANI VATS


1. Memory Management
• An Operating System does the following activities for memory
management :
1. Keeps tracks of primary memory, i.e., what part of it are in use by
whom, what part are not in use.
2. In multiprogramming, the OS decides which process will get memory
when and how much.
3. Allocates the memory when a process requests it to do so.
4. De-allocates the memory when a process no longer needs it or has
been terminated.

DR. SHIVANI VATS


2. Processor Management
• Keeps tracks of processor and status of process.
• The program responsible for this task is known as traffic controller.
• Allocates the processor (CPU) to a process.
• De-allocates processor when a process is no longer required.

DR. SHIVANI VATS


3. Device Management
• An OS manages device communication via their respective drivers.
• It performs the following activities for device management.
• Keeps tracks of all devices connected to system. designates a program
responsible for every device known as the Input/output controller.
• Decides which process gets access to a certain device and for how long.
• Allocates devices in an effective and efficient way.
• Deallocates devices when they are no longer required.

DR. SHIVANI VATS


4. File Management
• A file system is organized into directories for efficient or easy navigation
and usage.
• These directories may contain other directories and other files.
• An Operating System carries out the following file management
activities.
• It keeps track of where information is stored, user access settings and
status of every file and more
• These facilities are collectively known as the file system.

DR. SHIVANI VATS


Types of Operating System

1. Batch Operating system


2. Multiprogrammed Operating System
3. Multitasking Operating System
4. Multiprocessing Operating System

DR. SHIVANI VATS


1. Simple Batch Systems
• In the era of 1970s, the Batch processing was very popular.
• The Jobs were executed in batches.
• People were used to have a single computer which was called
mainframe.
• In Batch operating system, access is given to more than one person; they
submit their respective jobs to the system for the execution using punch
cards.
• The system put all of the jobs in a queue on the basis of first come first
serve and then executes the jobs one by one.
• The users collect their respective output when all the jobs get executed
using punch cards.

DR. SHIVANI VATS


DR. SHIVANI VATS
Advantages of Batch Operating
System
• It is easy to manage large work repeatedly in batch systems

DR. SHIVANI VATS


Disadvantages of Batch
Operating System
• The other jobs will have to wait for an unknown time if any job fails.
• CPU was ideal for most of the time because when job need I/O then it
was not shifted other jobs rather CPU remains idle till I/O job is
completed

DR. SHIVANI VATS


2. Multiprogramming Batch
Systems
• CPU will never be ideal because it always has at least one job to
execute.
• Whenever process needs I/O then CPU is switched to other process.
• In multiprogramming OS non-primpitive scheduling was present i.e. any
process can’t pre-empt the CPU from another process.

DR. SHIVANI VATS


Disadvantage

• User interaction was not allowed in multi programmed OS because


user interaction need pre-emptive scheduling.
• If a user want to run different programs simultaneously than it is not
possible.

DR. SHIVANI VATS


3. Time Sharing Systems
• Each task is given some time to execute, so that all the tasks work
smoothly.
• Each user gets time of CPU as they use single system.
• These systems are also known as Multitasking Systems.
• The task can be from single user or from different users also.
• The time that each task gets to execute is called quantum.
• After this time interval is over OS switches over to next task.

DR. SHIVANI VATS


3. Time Sharing Systems

DR. SHIVANI VATS


Advantages of Time-Sharing OS

• Each task gets an equal opportunity


• Less chances of duplication of software
• CPU idle time can be reduced

DR. SHIVANI VATS


Distributed Operating System
• Various autonomous interconnected computers communicate each
other using a shared communication network.
• Independent systems possess their own memory unit and CPU.
• These are referred as loosely coupled systems or distributed systems

DR. SHIVANI VATS


• These system’s processors differ in size and function.
• The major benefit of working with these types of operating system is
that
• It is always possible that one user can access the files or software
which are not actually present on his system but on some other system
connected within this network i.e., remote access is enabled within the
devices connected in that network.
• Autonomous means that these are independent computer and work
independently even if network fails.

DR. SHIVANI VATS


Network

System 5 System 3 System 4

Disk

System 1 System 2

Disk

DR. SHIVANI VATS


Advantages Distributed
Operating System
1. As there are multiple systems involved, user at one site can utilize the
resources of systems at other sites for resource-intensive tasks.
2. Fast processing.
3. Less load on the Host Machine.

• Examples of Distributed Operating System are- LOCUS etc.

DR. SHIVANI VATS


Disadvantages of Distributed
Operating System:
• Failure of the main network will stop the entire communication

DR. SHIVANI VATS


Real Time Operating System
• Real time system are used in those case where we have strict time
boundation like missile systems, air traffic control systems, robots etc.
• Real time system are used in embedded system.
• Real time system is defined as a system in which job has deadline, job
has to finished by the deadline (strictly finished).
• If a result is delayed, huge loss may happen.

DR. SHIVANI VATS


Two types of Real-Time Operating
System which are as follows:
1. Hard Real-Time Systems:
• These OSs are meant for the applications where time constraints are
very strict and even the shortest possible delay is not acceptable.
• These systems are built for saving life like automatic parachutes or
air bags which are required to be readily available in case of any
accident.
• Virtual memory is almost never found in these systems

DR. SHIVANI VATS


1. Hard Real-Time Systems

• Input device: Sensors are used to bring to data to CPU.


• There is no hard disk.
• RAM and ROM are used.
• Example : Flight controller system, ventilators

DR. SHIVANI VATS


2. Soft Real-Time Systems
• These OSs are for applications where time-constraint is less strict.
• We assign priorities to critical task.
• So they are completed in real time and never starve for CPU.
• Secondary Memory are present.
• Example : Video game, movie, windows Operating system.

DR. SHIVANI VATS


Multiprocessor
• A Multiprocessor is a computer system with two or more central
processing units (CPUs) share full access to a common RAM.
• The main objective of using a multiprocessor is to boost the system’s
execution speed
• There are two types of multiprocessors, one is called shared memory
multiprocessor and another is distributed memory multiprocessor.
• In shared memory multiprocessors, all the CPUs shares the common
memory but in a distributed memory multiprocessor, every CPU has its
own private memory.

DR. SHIVANI VATS


Benefits of using a
Multiprocessor
• Enhanced performance.
• Multiple applications.
• High throughput and responsiveness.
• Hardware sharing among CPUs.

DR. SHIVANI VATS


DR. SHIVANI VATS
Linux

DR. SHIVANI VATS


Linux

• Linux was developed by Linus Torvalds in 1991.


• The name Linux comes from Linus + Unix
• Linux is an open-source and community-developed operating system
for computers.
• Linux is flexible, reliable and secure.
• Linux is a multi-programming, multi-user operating system, it means
the same system can be used by different users with different access
rights and simultaneously many applications can be run on it.

DR. SHIVANI VATS


Characteristics of Linux

• Linux can work on different types of hardware, so Linux is portable.


• Linux is open source, so it is free to use and users can also work on
enhancing features of the Linux operating system.
• It is multi-use operating system, that means multiple users can access
the system.
• Linux is secure as it provide password protection and encryption of
data.
• Linux is multi-programming as multiple application can be run at
same time.

DR. SHIVANI VATS


Advantages of Linux

• Linux is compatible with large number of file format.


• Linux is free of cost so it is easily available for users to download and
use.
• It is enhancing day by day as users can make changes in the Linux
operating system.
• Linux system rarely crashes as they are very stable.
• Linux does not collect much user data, so it ensures privacy of user.
• No reboot is needed thus increasing system speed.
• No Anti-Virus software is needed to be installed in Linux Operating
System.

DR. SHIVANI VATS


Disadvantages of Linux

• Linux does not provide some hardware drivers which is drawback of


Linux.
• Command line interface of Linux is difficult to use for beginners.
• Some graphic tools are not available for Linux operating system.
• Linux does not have standard versions, which makes difficult for users
to choose best version for their needs.

DR. SHIVANI VATS


Linux VS Unix

• Unix is licensed and Linux is open sourced.


• Linux is inspired by Unix and is designed to be Unix like.

DR. SHIVANI VATS


Architecture of Linux system

DR. SHIVANI VATS


Kernel

• The kernel is the central component of the Linux operating system


architecture.
• It manages system resources and provides services to applications and
processes running on the system.
• The Linux kernel is a monolithic kernel, which means that it contains all the
core operating system functionality in a single executable file.
• It is highly modular and configurable, supporting a wide range of hardware
devices and system configurations.
• The kernel provides system calls, which allow applications and processes to
interact with the operating system, including access to file management,
process management, network communication, and hardware device
control.

DR. SHIVANI VATS


Device drivers

• Device drivers are an essential part of the Linux architecture,


enabling the operating system to communicate with various
hardware components and provide support for a wide range of
devices.
• These act as an interface between the operating system and
hardware devices, enabling communication between the two.
• The drivers translate commands and instructions from the operating
system into a language that the device can understand.
• Linux supports two types of device drivers: character device drivers
and block device drivers.
• Character device drivers enable data transfer in a stream, while block
device drivers manage the transfer of data in fixed-size blocks.

DR. SHIVANI VATS


System libraries

• System libraries in the Linux architecture are pre-written code


modules that can be used by applications to perform common
functions.
• There are two types of libraries in Linux, static and dynamic, with
dynamic libraries being preferred as they can be shared between
multiple applications, reducing the memory footprint of the system.
• The use of system libraries in Linux allows for efficient and robust
application development by leveraging pre-existing and optimized
code. By providing a standard set of libraries, Linux ensures greater
interoperability and consistency across the system

DR. SHIVANI VATS


System calls

• System calls allow applications to interact with the kernel and


manage system resources like memory, file systems, and devices.
• They are implemented as functions within the kernel that are called
by applications through a standardized interface defined by the
POSIX standard. The interface includes system call numbers that
identify specific system calls.
• Common system calls in Linux
include open(), read(), write(), close(), fork(), and exec().
• System calls are essential for managing system resources, allowing
applications to request access to resources and interact with them in
a standardized way.

DR. SHIVANI VATS


Shell

• Shell is a command-line interface that allows users to interact with


the system through a set of commands.
• The most popular shell in Linux is the Bash shell, which
communicates with the kernel to execute commands and manage
system resources.
• The shell provides a set of built-in commands and the ability to
execute external programs.

DR. SHIVANI VATS


Applications

• Applications in the Linux architecture are software programs that run


on top of the operating system and interact with its components.
• Linux offers a wide range of applications that cover almost every
aspect of computing, including web browsers, office suites, media
players, graphics editors, and text editors.
• These applications are developed using various programming
languages and are designed to work efficiently and effectively

DR. SHIVANI VATS


Linux Directory Structure

• In Linux/Unix operating system everything is a file even directories


are files, files are files, and devices like mouse, keyboard, printer, etc
are also files.

DR. SHIVANI VATS


Types of files in the Linux
system
• General Files – It is also called ordinary files. It may be an image,
video, program, or simple text file. These types of files can be in ASCII
or Binary format. It is the most commonly used file in the Linux
system.
• Directory Files – These types of files are a warehouse for other file
types. It may be a directory file within a directory (subdirectory).
• Device Files – In a Windows-like operating system, devices like CD-
ROM, and hard drives are represented as drive letters like F: G: H
whereas in the Linux system devices are represented as files. As for
example, /dev/sda1, /dev/sda2, and so on.

DR. SHIVANI VATS


In a Windows-like operating system, files are stored in different folders
on different data drives like C: D: E: whereas in the Linux/Unix
operating system files are stored in a tree-like structure starting with
the root directory.
The Linux/Unix file system hierarchy base begins at the root and
everything starts with the root directory.

DR. SHIVANI VATS


/ – The root directory

• All the files and directories, in Linux are located under ‘root’
represented by ‘/’.
• /root is the user's home directory & is not the same as /. Both are
different.
• In other words, the / is the starting point in the Linux directory
structure.
• Only the root user has full access to this directory.

DR. SHIVANI VATS


/bin — Essential User Binaries
• It holds the executable files of numerous basic shell commands like
cp, ls, cd,cat, mkdir and other such commands.

/boot — Static Boot Files


• Booting is an essential process that involves various hardware and
operating system files to start the computer and load the operating
system into working mode.
• The files required for the system to boot are located in the /boot
directory.

DR. SHIVANI VATS


/dev — Device Files
• The /dev directory contains device files such as dev/sda1, dev/sda2, etc.
• These files represent the device.

/etc — Configuration Files


• All the system's core configuration file resides in this directory.
• The system administrator & various other internal core services like the
networking or password files use configuration files from here.
• If the admin wants to configure the system in any way (for example:
changing the hostname) they would have to work with config files located
in this directory.

DR. SHIVANI VATS


/home — Home Folders
• In the Linux directory structure, each user gets a home directory,
which is the user's directory.
• This directory holds user-specific configuration files and other user
data.
• As a Linux user, you can put all your files, programs, notes, etc., in
this home directory.
/lib — Essential Shared Libraries
• A library is a group of pre-compiled programs that binaries can utilize.
• All libraries required by the binaries( /bin Linux directory) are located
in the /lib Linux directory.

DR. SHIVANI VATS


/lost+found — Recovered Files
• Each Linux directory structure has a lost+found directory.
• It is a critical Linux directory that stores corrupted files when your
system crashes.
• If your file system crashes, the Linux operating system will perform a
check at the next boot.
• During boot-up, all the corrupt files will get stored in the lost+found
directory. From this directory, users can recover the majority of their
data.

DR. SHIVANI VATS


/opt — Optional Packages
• The /opt directory helps install & store the files of various third-party
apps.

/tmp — Temporary Files


• Numerous applications and third-party software generate the
temporary file(s) when they start executing. Those temporary files
reside in the /tmp directory. These files get deleted automatically
when the user restarts the system or uses utilities like "tmpwatch" to
delete those temporary files after a fixed duration.

DR. SHIVANI VATS


/usr - User Binaries & Read-Only Data
• It is another important directory in the Linux directory structure.
• It contains various files and apps that the user or the systems use.
• For instance, all the non-essential files and apps reside in
the /usr/bin directory rather than the /bin directory.
/var — Variable Data Files
• Applications store runtime data in the /var directory, including system
logging, caches, user tracking, and other files that system programs
generate and maintain.
• Variable stands for Var.
• System administrators can get information on their system's behavior
in this location since the data kept there is not automatically wiped up.

DR. SHIVANI VATS

You might also like