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

Week-3 Os Ass

Uploaded by

aniketmandre7
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)
30 views

Week-3 Os Ass

Uploaded by

aniketmandre7
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/ 17

WEEK-3 OPERTAING SYSTEM ASSIGNMENT

1.What is a File system ? Explain the Linux file system with a diagram ?

Linux File System

A Linux file system is a structured collection of files on a disk drive or a partition. A partition is a segment
of memory and contains some specific data. In our machine, there can be various partitions of the
memory. Generally, every partition contains a file system.

The general-purpose computer system needs to store data systematically so that we can easily access
the files in less time. It stores the data on hard disks (HDD) or some equivalent storage type. There may
be below reasons for maintaining the file system:

o Primarily the computer saves data to the RAM storage; it may lose the data if it gets turned off.
However, there is non-volatile RAM (Flash RAM and SSD) that is available to maintain the data
after the power interruption.

o Data storage is preferred on hard drives as compared to standard RAM as RAM costs more than
disk space. The hard disks costs are dropping gradually comparatively the RAM.

The Linux

file system contains the following sections:

o The root directory (/)

o A specific data storage format (EXT3, EXT4, BTRFS, XFS and so on)

o A partition or logical volume having a particular file system.

Linux File System Structure


 Linux file system has a hierarchal file structure as it contains a root directory and its
subdirectories. All other directories can be accessed from the root directory. A
partition usually has only one file system, but it may have more than one file system.
 A file system is designed in a way so that it can manage and provide space for non -
volatile storage data. All file systems required a namespace that is a naming and
organizational methodology. The namespace defines the naming process, length of
the file name, or a subset of characters that can be used for the file name. It also
defines the logical structure of files on a memory segment, such as the use of
directories for organizing the specific files. Once a namespace is described, a
Metadata description must be defined for that particular file.
The data structure needs to support a hierarchical directory structure; this structure is
used to describe the available and used disk space for a particular block. It also has the
other details about the files such as file size, date & time of creation, update, and last
modified.

Also, it stores advanced information about the section of the disk, such as partitions and
volumes.

The advanced data and the structures that it represents contain the information about the
file system stored on the drive; it is distinct and independent of the file system metadata.

Linux file system contains two-part file system software implementation architecture.
Consider the below image:

Linux File System Features


In Linux, the file system creates a tree structure. All the files are arranged as a tree and its
branches. The topmost directory called the root (/) directory. All other directories in
Linux can be accessed from the root directory.

Some key features of Linux

file system are as following:

o Specifying paths: Linux does not use the backslash (\) to separate the components; it uses
forward slash (/) as an alternative. For example, as in Windows, the data may be stored in
C:\ My Documents\ Work, whereas, in Linux, it would be stored in /home/ My Document/
Work.

o Partition, Directories, and Drives: Linux does not use drive letters to organize the drive
as Windows does. In Linux, we cannot tell whether we are addressing a partition, a network
device, or an "ordinary" directory and a Drive.

o Case Sensitivity: Linux file system is case sensitive. It distinguishes between lowercase and
uppercase file names. Such as, there is a difference between test.txt and Test.txt in Linux.
This rule is also applied for directories and Linux commands.

o File Extensions: In Linux, a file may have the extension '.txt,' but it is not necessary that a
file should have a file extension. While working with Shell, it creates some problems for the
beginners to differentiate between files and directories. If we use the graphical file manager,
it symbolizes the files and folders.

o Hidden files: Linux distinguishes between standard files and hidden files, mostly the
configuration files are hidden in Linux OS. Usually, we don't need to access or read the
hidden files. The hidden files in Linux are represented by a dot (.) before the file name (e.g.,
.ignore). To access the files, we need to change the view in the file manager or need to use a
specific command in the shell.

1. Ext, Ext2, Ext3 and Ext4 file system

The file system Ext stands for Extended File System. It was primarily developed for MINIX OS. The Ext
file system is an older version, and is no longer used due to some limitations.
Ext2 is the first Linux file system that allows managing two terabytes of data. Ext3 is developed through
Ext2; it is an upgraded version of Ext2 and contains backward compatibility. The major drawback of Ext3
is that it does not support servers because this file system does not support file recovery and disk
snapshot.

Ext4 file system is the faster file system among all the Ext file systems. It is a very compatible option for
the SSD (solid-state drive) disks, and it is the default file system in Linux distribution.

2. JFS File System

JFS stands for Journaled File System, and it is developed by IBM for AIX Unix. It is an alternative to the
Ext file system. It can also be used in place of Ext4, where stability is needed with few resources. It is a
handy file system when CPU

power is limited.

3. ReiserFS File System

ReiserFS is an alternative to the Ext3 file system. It has improved performance and advanced features. In
the earlier time, the ReiserFS was used as the default file system in SUSE Linux, but later it has changed
some policies, so SUSE returned to Ext3. This file system dynamically supports the file extension, but it
has some drawbacks in performance.

4. XFS File System

XFS file system was considered as high-speed JFS, which is developed for parallel I/O processing. NASA
still using this file system with its high storage server (300+ Terabyte server).

5. Btrfs File System

Btrfs stands for the B tree file system. It is used for fault tolerance, repair system, fun administration,
extensive storage configuration, and more. It is not a good suit for the production system.

6. Swap File System

The swap file system is used for memory paging in Linux operating system during the system
hibernation. A system that never goes in hibernate state is required to have swap space equal to
its RAM

2.Explain the dual modes of an Operating system ?

Dual Mode Operations in Operating System

The dual-mode operations in the operating system protect the operating system from
illegal users. We accomplish this defense by designating some of the system instructions as
privileged instructions that can cause harm. The hardware only allows for the execution of
privileged instructions in kernel mode. An example of a privileged instruction is the
command to switch to user mode. Other examples include monitoring of I/O, controlling
timers and handling interruptions.
To ensure proper operating system execution, we must differentiate between machine
code execution and user-defined code. Most computer systems have embraced offering
hardware support that helps distinguish between different execution modes. We have two
modes of the operating system: user mode and kernel mode.

Mode bit is required to identify in which particular mode the current instruction is
executing. If the mode bit is 1, it operates user mode, and if the mode bit is 0, it operates in
kernel mode.

Types of Dual Mode in Operating System


The operating system has two modes of operation to ensure it works correctly: u ser mode
and kerNAL

1. User Mode

When the computer system runs user applications like file creation or any other
application program in the User Mode, this mode does not have direct access to the
computer's hardware. For performing hardware related tasks, like when the user
application requests for a service from the operating system or some interrupt occurs, in
these cases, the system must switch to the Kernel Mode. The mode bit of the user mode is 1.
This means that if the mode bit of the system's processor is 1, then the system will be in
the User Mode
2. Kernel Mode

All the bottom level tasks of the Operating system are performed in the Kernel Mode. As the
Kernel space has direct access to the hardware of the system, so the kernel-mode handles
all the processes which require hardware support. Apart from this, the main functionality
of the Kernel Mode is to execute privileged instructions.
These privileged instructions are not provided with user access, and that's why these
instructions cannot be processed in the User mode. So, all the processes and instructions
that the user is restricted to interfere with are executed in the Kernel Mode of the
Operating System. The mode bit for the Kernel Mode is 0. So, for the system to function in
the Kernel Mode, the Mode bit of the processor must be equal to 0.

Example
With the mode bit, we can distinguish between a task executed on behalf of the operating
system and one executed on behalf of the user.
o When the computer system executes on behalf of a user application, the system is
in user mode.
o However, when a user application requests a service from the operating system via
a system call, it must transition from user to kernel mode to fulfill the request. As
we can say, this architectural enhancement is useful for many other aspects of
system operation.
o At system boot time, the hardware starts in kernel mode.
o The operating system is then loaded and starts user applications in user mode.
o Whenever a trap or interrupt occurs, the hardware switches from user
mode to kernel mode, changing the mode bit's state to 0.
o Thus, whenever the operating system gains control of the computer, it is in kernel
mode.
o The system always switches to user modeby setting the mode bit to 1 before
passing control to a user program.

Need for Dual-Mode Operations


Certain types of processes are to be made hidden from the user, and certain tasks that do
not require any type of hardware support. Using the dual mode of the OS, these tasks can
be deal with separately.

Also, the Operating System needs to function in the dual mode because the Kernel Level
programs perform all the bottom level functions of the OS like process management,
Memory management, etc. If the user alters these, then this can cause an entire system
failure. So, for specifying the access to the users only to the tasks of their use, Dual Mode is
necessary for an Operating system.

So, whenever the system works on the user applications, it is in the User mode. Whenever
the user requests some hardware services, a transition from User mode to Kernel mode
occurs, and this is done by changing the mode bit from 1 to 0. And for returning back into
the User mode, the mode bit is again changed to 1.

User Mode and Kernel Mode Switching


In its life span, a process executes in user mode and kernel mode. The user mode is a
normal mode where the process has limited access. However, the kernel-mode is the
privileged mode where the process has unrestricted access to system resources like
hardware, memory, etc. A process can access services like hardware I/O by executing
accessing kernel data in kernel mode. Anything related to process management, I/O
hardware management, and memory management requires a process to execute in Kernel
mode.

This is important to know that a process in Kernel mode get power to access any device
and memory, and same time any crash in kernel mode brings down the whole system. But
any crash in user mode brings down the faulty process only.

The kernel provides System Call Interface (SCI), which are entry points for use r processes
to enter kernel mode. System calls are the only way through which a process can go into
kernel mode from user mode. The below diagram explains user mode to kernel mode
switching in detail.
o When in user mode, the application process makes a call to Glibc, which is a library
used by software programmers.
o Glibc library knows the proper way of calling System Call for different architectures.
It set up passing arguments as per architecture's Application Binary Interface (ABI)
to prepare for System Call entry.
o Now Glibc calls Software Interrupt instruction for ARM, which puts the processor
into Supervisor mode by updating Mode bits of CPSR register and jumps to vector
address 0x08.
o Till now, process execution was in User mode. After SWI instruction execution, the
process is allowed to execute kernel code. Memory Management Unit (MMU) will
now allow kernel Virtual memory access and execution for this process.
o From Vector address 0x08, process execution loads and jumps to SW Interrupt
handler routine, vector_swi()for ARM.
o In vector_swi(), System Call Number (SCNO) is extracted from SWI instruction, and
execution jumps to system call function using SCNO as an index in system call
table sys_call_table.
o After System Call execution, in the return path, userspace registers are restored
before starting execution in User Mode.
Why do we need Switching?
There are two main reasons behind the switching between User mode and kernel mode,
such as:

1. If everything were to run in a single-mode, we would end up with Microsoft's issue


in the earlier versions of Windows. If a process were able to exploit a vulnerability,
that process then could control the system.
2. Certain conditions are known as a trap, an exception or a system fault typically
caused by an exceptional condition such as division by zero, invalid memory access,
etc. If the process is running in kernel mode, such a trap situation can crash the
entire operating system. A process in user mode that encounters a trap situation
only crashes the user-mode process.

So, the overhead of switching is acceptable to ensure a more stable, secure system.

Difference between User Mode and Kernel Mode


A computer operates either in user mode or kernel mode. The difference between User
Mode and Kernel Mode is that user mode is the restricted mode in which the applications
are running, and kernel-mode is the privileged mode the computer enters when accessing
hardware resources.

The computer is switching between these two modes. Frequent context switching can slow
down the speed, but it is impossible to execute all processes in the kernel mode. That is
because; if one process fails, the whole operating system might fail. Below are some more
differences between User mode and kernel mode, such as:

Terms User Mode Kernel Mode

Definition User Mode is a restricted mode, which the Kernel Mode is the privileged mode, which
application programs are executing and the computer enters when accessing
starts. hardware resources.

Modes User Mode is considered as the slave mode Kernel mode is the system mode, master
or the restricted mode. mode or the privileged mode.

Address In User mode, a process gets its own In Kernel Mode, processes get a single
Space address space. address space.
Interruptions In User Mode, if an interrupt occurs, only In Kernel Mode, if an interrupt occurs, the
one process fails. whole operating system might fail.

Restrictions In user mode, there are restrictions to In kernel mode, both user programs and
access kernel programs. Cannot access kernel programs can access.
them directly.

3.What are system program ? Highlight few characteristics of it.


System Programs in Operating System
System Programming can be defined as the act of building Systems
Software using System Programming Languages. According to
Computer Hierarchy, one which comes at last is Hardware. Then it is
Operating System, System Programs, and finally Application
Programs. Program Development and Execution can be done
conveniently in System Programs. Some of the System Programs are
simply user interfaces, others are complex. It traditionally lies between
the user interface and system calls.
So here, the user can only view up-to-the System Programs he can’t
see System Calls.
System Programs can be divided into these categories :

1. File Management –
A file is a collection of specific information stored in the memory
of a computer system. File management is defined as the
process of manipulating files in the computer system, its
management includes the process of creating, modifying and
deleting files.
 It helps to create new files in the computer system and
placing them at specific locations.
 It helps in easily and quickly locating these files in the
computer system.
 It makes the process of sharing files among different users
very easy and user-friendly.

 It helps to store files in separate folders known as


directories.
 These directories help users to search files quickly or to
manage files according to their types of uses.

 It helps users to modify the data of files or to modify the


name of files in directories.

2. Status Information –
Information like date, time amount of available memory, or disk
space is asked by some users. Others providing detailed
performance, logging, and debugging information which is more
complex. All this information is formatted and displayed on output
devices or printed. Terminal or other output devices or files or a
window of GUI is used for showing the output of programs.
3. File Modification –
For modifying the contents of files we use this. For Files stored
on disks or other storage devices, we used different types of
editors. For searching contents of files or perform transformations
of files we use special commands.

4. Programming-Language support –
For common programming languages, we use Compilers,
Assemblers, Debuggers, and interpreters which are already
provided to users. It provides all support to users. We can run
any programming language. All languages of importance are
already provided.

5. Program Loading and Execution –


When the program is ready after Assembling and compilation, it
must be loaded into memory for execution. A loader is part of an
operating system that is responsible for loading programs and
libraries. It is one of the essential stages for starting a program.
Loaders, relocatable loaders, linkage editors, and Overlay
loaders are provided by the system.

6. Communications –
Virtual connections among processes, users, and computer
systems are provided by programs. Users can send messages to
another user on their screen, User can send e-mail, browsing on
web pages, remote login, the transformation of files from one
user to another.

Some examples of system program in O.S. are –

 Windows 10
 Mac OS X
 Ubuntu
 Linux
 Unix

 Android
 Anti-virus

 Disk formatting
 Computer language translators

4.How are server systems classified? What is asymmetric


clustering?
symmetric Clustering System

In this system, one of the nodes in the clustered system is in hot


standby mode and all the others run the required applications. The hot
standby mode is a failsafe in which a hot standby node is part of the
system . The hot standby node continuously monitors the server and if
it fails, the hot standby node takes its place.

A diagram that demonstrates asymmetric clustering system is −


How Asymmetric Clustering Works
The following steps demonstrate the working of the asymmetric clustering system −

 There is a master node in asymmetric clustering that directs all the slaves nodes to
perform the tasks required. The requests are delegated by the master node.
 A distributed cache is used in asymmetric clustering to improve the performance of
the system.
 Resources such as memory, peripheral devices etc. are divided between the nodes of
the asymmetric clustering system at boot time.
Advantages of Asymmetric Clustering
The different advantages of asymmetric clustering are −

 Since many computer systems are connected together and the processors work in
parallel, this reduces the cost of having separate peripheral devices and memory.
 The asymmetric clustering system has increased reliability as even if one nodes fails,
the others can pick up the slack.
 All the nodes in the asymmetric clustering system have their own kernels and can
operate on different operating systems.
 All the processors in the asymmetric clustering system are independent and only share
memory for inter process communications.

Symmetric Clustering System


In symmetric clustering system two or more nodes all run applications as well as monitor each
other. This is more efficient than asymmetric system as it uses all the hardware and doesn't keep
a node merely as a hot standby
A diagram that demonstrates symmetric clustering system is −
Advantages of Symmetric Clustering System
The different advantages of symmetric clustering are −

 The symmetric clustering system is quite reliable. This is because if one nodes fails,
the others can pick up the slack.This will not not result in the failure of the system but
will lead to graceful degradation.
 Many computer systems are connected together and work in parallel in the symmetric
clustering system. This reduces the overall cost as there is shared peripheral devices
and memory.
 Symmetric clustering systems are quite scalable as it is easy to add a new node to the
system. There is no need to take the entire cluster down to add a new node.

You might also like