Week-3 Os Ass
Week-3 Os Ass
1.What is a File system ? Explain the Linux file system with a diagram ?
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
o A specific data storage format (EXT3, EXT4, BTRFS, XFS and so on)
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:
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.
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.
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.
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.
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).
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.
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
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.
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.
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.
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:
So, the overhead of switching is acceptable to ensure a more stable, secure system.
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:
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.
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.
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.
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.
Windows 10
Mac OS X
Ubuntu
Linux
Unix
Android
Anti-virus
Disk formatting
Computer language translators
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.
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.