0% found this document useful (0 votes)
26 views159 pages

Bestpractice 17183611833

The document provides an overview of operating systems, including their history, evolution, types, advantages, and disadvantages. It discusses various operating systems such as Windows, UNIX/Linux, and real-time systems, detailing their functions and applications. Additionally, it covers the generations of operating systems and the importance of learning about them for effective computer management.

Uploaded by

felix29grey
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)
26 views159 pages

Bestpractice 17183611833

The document provides an overview of operating systems, including their history, evolution, types, advantages, and disadvantages. It discusses various operating systems such as Windows, UNIX/Linux, and real-time systems, detailing their functions and applications. Additionally, it covers the generations of operating systems and the importance of learning about them for effective computer management.

Uploaded by

felix29grey
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/ 159

Operating System

MODULE 1

Introduction to operating system: what is operating system? History and


Evolution of OS, Basic OS functions, Resource Abstraction, Types of operating
Systems- Batch Systems, Multiprogramming Systems, Multiprocessing
Systems, Time Sharing Systems, Distributed OS, Real time systems. Operating
System for Personal Computers, Workstations and Hand-held Devices.
Applications of various operating system in real world. Some prevalent
operating systems - windows, UNIX /Linux, Android, MacOS, Blackberry OS,
Symbian, Bada etc.

History and Evolution of Operating Systems


The first computers did not have operating systems. Each program that was
running on these first computers had to include all the code needed to run on the
computer, communicate with the connected hardware and perform the
calculation that the program was intended to perform. This situation made even
the simplest programs become very complex.
In response to this problem, the owners of the central computers began to
develop system software that facilitated the writing and execution of the
programs included in the computer, and thus the first operating systems were
born.
The first operating system was created by General Motors in 1956 to run a
single IBM central computer. In the 1960s, IBM was the first computer
manufacturer to take on the task of developing operating systems and began
distributing operating systems included in its computers.
The first operating systems were developed in the 1950s, when computers
could only run one program at a time. Later in the following decades, computers
began to include more and more software programs, sometimes called libraries,
that came together to create the start of today’s operating systems.
In the late 1960s, the first version of the Unix operating system was
developed. Written in programming language C, and available for free during
its early years. Unix easily adapted to the new systems and quickly achieved
wide acceptance.
Many modern operating systems, including Apple OS X and all different
versions of Linux, date back or rely on the Unix OS.
Microsoft Windows was developed in response to an IBM request for an
operating system to run its range of personal computers or PCs.
The first operating system created by Microsoft was not called Windows,
it was called MS-DOS and it was built in 1981 when it bought the 86-DOS
operating system from Seattle Computer Products and modified it to meet IBM
requirements.
The Windows name was first used in 1985 when a graphical user
interface was created and paired or joined with the MS-DOS.
Today Apple, OS X, Microsoft Windows and the various forms of Linux
(including Android) dominate the vast majority of the modern operating
systems market, as we saw earlier.
Most software programs are designed to work with the operating system
of a single company, for example only Windows (Microsoft) or only macOS
(Apple).
A software will clearly indicate what operating systems it supports and
will be very specific if necessary including the version or versions of that OS it
supports. For example, a video production software program might say that it is
compatible with Windows 10, Windows 8 and Windows 7, but is not
compatible with earlier versions of Windows such as Windows Vista and XP.
Software developers also usually release additional versions of their
software that work with other operating systems or different versions. Returning
to the example of the video production program, that company could also
launch another version of the program with exactly the same features but to
work with macOS, the place with Windows.

It is also important to know if your operating system is 32-bit or 64-bit. It’s a


common question that they ask you when downloading software Below you can
see how to know if your computer is 32bit or 64bit in Windows.

Generations of Operating System

The First Generation (1940 to early 1950s)

When the first electronic computer was developed in 1940, it was created
without any operating system. In early times, users have full access to the
computer machine and write a program for each task in absolute machine
language. The programmer can perform and solve only simple mathematical
calculations during the computer generation, and this calculation does not
require an operating system.

The Second Generation (1955 - 1965)

The first operating system (OS) was created in the early 1950s and was known
as GMOS. General Motors has developed OS for the IBM computer. The
second-generation operating system was based on a single stream batch
processing system because it collects all similar jobs in groups or batches and
then submits the jobs to the operating system using a punch card to complete all
jobs in a machine. At each completion of jobs (either normally or abnormally),
control transfer to the operating system that is cleaned after completing one job
and then continues to read and initiates the next job in a punch card. After that,
new machines were called mainframes, which were very big and used by
professional operators.

The Third Generation (1965 - 1980)

During the late 1960s, operating system designers were very capable of
developing a new operating system that could simultaneously perform multiple
tasks in a single computer program called multiprogramming. The introduction
of multiprogramming plays a very important role in developing operating
systems that allow a CPU to be busy every time by performing different tasks
on a computer at the same time. During the third generation, there was a new
development of minicomputer's phenomenal growth starting in 1961 with the
DEC PDP-1. These PDP's leads to the creation of personal computers in the
fourth generation.

The Fourth Generation (1980 - Present Day)

The fourth generation of operating systems is related to the development of the


personal computer. However, the personal computer is very similar to the
minicomputers that were developed in the third generation. The cost of a
personal computer was very high at that time; there were small fractions of
minicomputers costs. A major factor related to creating personal computers was
the birth of Microsoft and the Windows operating system. Microsoft created the
first window operating system in 1975. After introducing the Microsoft
Windows OS, Bill Gates and Paul Allen had the vision to take personal
computers to the next level. Therefore, they introduced the MS-DOS in 1981;
however, it was very difficult for the person to understand its cryptic
commands. Today, Windows has become the most popular and most commonly
used operating system technology. And then, Windows released various
operating systems such as Windows 95, Windows 98, Windows XP and the
latest operating system, Windows 7. Currently, most Windows users use the
Windows 10 operating system. Besides the Windows operating system, Apple is
another popular operating system built in the 1980s, and this operating system
was developed by Steve Jobs, a co-founder of Apple. They named the operating
system Macintosh OS or Mac OS.

Advantages of Operating System

• It is helpful to monitor and regulate resources.


• It can easily operate since it has a basic graphical user interface to
communicate with your device.
• It is used to create interaction between the users and the computer
application or hardware.
• The performance of the computer system is based on the CPU.
• The response time and throughput time of any process or program are
fast.
• It can share different resources like fax, printer, etc.
• It also offers a forum for various types of applications like system and
web application.

Disadvantage of the Operating System

• It allows only a few tasks that can run at the same time.
• It any error occurred in the operating system; the stored data can be
destroyed.
• It is a very difficult task or works for the OS to provide entire security
from the viruses because any threat or virus can occur at any time in a
system.
• An unknown user can easily use any system without the permission of the
original user.
• The cost of operating system costs is very high.

Operating System
An operating system (OS) is a collection of software that manages computer
hardware resources and provides common services for computer programs. The
operating system is a vital component of the system software in a computer
system. This tutorial will take you through step by step approach while learning
Operating System concepts.

Why to Learn Operating System?

An Operating System (OS) is an interface between a computer user and


computer hardware. An operating system is a software which performs all the
basic tasks like file management, memory management, process management,
handling input and output, and controlling peripheral devices such as disk drives
and printers.

Some popular Operating Systems include Linux Operating System, Windows


Operating System, VMS, OS/400, AIX, z/OS, etc.

Following are some of important functions of an operating System.

Memory Management

Processor Management

Device Management

File Management

Security

Control over system performance

Job accounting

Error detecting aids

Coordination between other software and users

Applications of Operating System

Following are some of the important activities that an Operating System


performs −
Security − By means of password and similar other techniques, it prevents
unauthorized access to programs and data.

Control over system performance − Recording delays between request for a


service and response from the system.

Job accounting − Keeping track of time and resources used by various jobs and
users.

Error detecting aids − Production of dumps, traces, error messages, and other
debugging and error detecting aids.

Coordination between other softwares and users − Coordination and assignment


of compilers, interpreters, assemblers and other software to the various users of
the computer systems.

Operating systems are there from the very first computer generation and they
keep evolving with time. In this chapter, we will discuss some of the important
types of operating systems which are most commonly used.

Batch operating system

The users of a batch operating system do not interact with the computer directly.
Each user prepares his job on an off-line device like punch cards and submits it
to the computer operator. To speed up processing, jobs with similar needs are
batched together and run as a group. The programmers leave their programs
with the operator and the operator then sorts the programs with similar
requirements into batches.

The problems with Batch Systems are as follows −

Lack of interaction between the user and the job.

CPU is often idle, because the speed of the mechanical I/O devices is slower
than the CPU.

Difficult to provide the desired priority.

Time-sharing operating systems


Time-sharing is a technique which enables many people, located at various
terminals, to use a particular computer system at the same time. Time-sharing or
multitasking is a logical extension of multiprogramming. Processor's time which
is shared among multiple users simultaneously is termed as time-sharing.

The main difference between Multiprogrammed Batch Systems and Time-


Sharing Systems is that in case of Multiprogrammed batch systems, the
objective is to maximize processor use, whereas in Time-Sharing Systems, the
objective is to minimize response time.

Multiple jobs are executed by the CPU by switching between them, but the
switches occur so frequently. Thus, the user can receive an immediate response.
For example, in a transaction processing, the processor executes each user
program in a short burst or quantum of computation. That is, if n users are
present, then each user can get a time quantum. When the user submits the
command, the response time is in few seconds at most.

The operating system uses CPU scheduling and multiprogramming to provide


each user with a small portion of a time. Computer systems that were designed
primarily as batch systems have been modified to time-sharing systems.

Advantages of Timesharing operating systems are as follows −

Provides the advantage of quick response.

Avoids duplication of software.

Reduces CPU idle time.

Disadvantages of Time-sharing operating systems are as follows −

Problem of reliability.

Question of security and integrity of user programs and data.

Problem of data communication.

Distributed operating System

Distributed systems use multiple central processors to serve multiple real-time


applications and multiple users. Data processing jobs are distributed among the
processors accordingly.
The processors communicate with one another through various communication
lines (such as high-speed buses or telephone lines). These are referred as loosely
coupled systems or distributed systems. Processors in a distributed system may
vary in size and function. These processors are referred as sites, nodes,
computers, and so on.

The advantages of distributed systems are as follows −

With resource sharing facility, a user at one site may be able to use the
resources available at another.

Speedup the exchange of data with one another via electronic mail.

If one site fails in a distributed system, the remaining sites can potentially
continue operating.

Better service to the customers.

Reduction of the load on the host computer.

Reduction of delays in data processing.

Network operating System

A Network Operating System runs on a server and provides the server the
capability to manage data, users, groups, security, applications, and other
networking functions. The primary purpose of the network operating system is
to allow shared file and printer access among multiple computers in a network,
typically a local area network (LAN), a private network or to other networks.

Examples of network operating systems include Microsoft Windows Server


2003, Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell
NetWare, and BSD.

The advantages of network operating systems are as follows −

Centralized servers are highly stable.


Security is server managed.

Upgrades to new technologies and hardware can be easily integrated into the
system.

Remote access to servers is possible from different locations and types of


systems.

The disadvantages of network operating systems are as follows −

High cost of buying and running a server.

Dependency on a central location for most operations.

Regular maintenance and updates are required.

Real Time operating System

A real-time system is defined as a data processing system in which the time


interval required to process and respond to inputs is so small that it controls the
environment. The time taken by the system to respond to an input and display of
required updated information is termed as the response time. So in this method,
the response time is very less as compared to online processing.

Real-time systems are used when there are rigid time requirements on the
operation of a processor or the flow of data and real-time systems can be used
as a control device in a dedicated application. A real-time operating system
must have well-defined, fixed time constraints, otherwise the system will fail.
For example, Scientific experiments, medical imaging systems, industrial
control systems, weapon systems, robots, air traffic control systems, etc.

There are two types of real-time operating systems.

Hard real-time systems

Hard real-time systems guarantee that critical tasks complete on time. In hard
real-time systems, secondary storage is limited or missing and the data is stored
in ROM. In these systems, virtual memory is almost never found.

Soft real-time systems

Soft real-time systems are less restrictive. A critical real-time task gets priority
over other tasks and retains the priority until it completes. Soft real-time
systems have limited utility than hard real-time systems. For example,
multimedia, virtual reality, Advanced Scientific Projects like undersea
exploration and planetary rovers, etc.

Batch processing

Batch processing is a technique in which an Operating System collects the


programs and data together in a batch before processing starts. An operating
system does the following activities related to batch processing −

The OS defines a job which has predefined sequence of commands, programs


and data as a single unit.

The OS keeps a number a jobs in memory and executes them without any
manual information.

Jobs are processed in the order of submission, i.e., first come first served
fashion.

When a job completes its execution, its memory is released and the output for
the job gets copied into an output spool for later printing or processing.

Advantages

• Batch processing takes much of the work of the operator to the computer.
• Increased performance as a new job get started as soon as the previous
job is finished, without any manual intervention.
Disadvantages

• Difficult to debug program.


• A job could enter an infinite loop.
• Due to lack of protection scheme, one batch job can affect pending jobs.

Multitasking

• Multitasking is when multiple jobs are executed by the CPU


simultaneously by switching between them. Switches occur so frequently
that the users may interact with each program while it is running. An OS
does the following activities related to multitasking −
• The user gives instructions to the operating system or to a program
directly, and receives an immediate response.
• The OS handles multitasking in the way that it can handle multiple
operations/executes multiple programs at a time.
• Multitasking Operating Systems are also known as Time-sharing systems.
• These Operating Systems were developed to provide interactive use of a
computer system at a reasonable cost.
• A time-shared operating system uses the concept of CPU scheduling and
multiprogramming to provide each user with a small portion of a time-
shared CPU.
• Each user has at least one separate program in memory.

• A program that is loaded into memory and is executing is commonly


referred to as a process.
• When a process executes, it typically executes for only a very short time
before it either finishes or needs to perform I/O.
• Since interactive I/O typically runs at slower speeds, it may take a long
time to complete. During this time, a CPU can be utilized by another
process.
• The operating system allows the users to share the computer
simultaneously. Since each action or command in a time-shared system
tends to be short, only a little CPU time is needed for each user.
• As the system switches CPU rapidly from one user/program to the next,
each user is given the impression that he/she has his/her own CPU,
whereas actually one CPU is being shared among many users.

Multiprogramming

• Sharing the processor, when two or more programs reside in memory at


the same time, is referred as multiprogramming. Multiprogramming
assumes a single shared processor. Multiprogramming increases CPU
utilization by organizing jobs so that the CPU always has one to execute.
• The following figure shows the memory layout for a multiprogramming
system.

• An OS does the following activities related to multiprogramming.


• The operating system keeps several jobs in memory at a time.
• This set of jobs is a subset of the jobs kept in the job pool.
• The operating system picks and begins to execute one of the jobs in the
memory.
• Multiprogramming operating systems monitor the state of all active
programs and system resources using memory management programs to
ensures that the CPU is never idle, unless there are no jobs to process.

Advantages

• High and efficient CPU utilization.


• User feels that many programs are allotted CPU almost simultaneously.

Disadvantages

• CPU scheduling is required.


• To accommodate many jobs in memory, memory management is
required.

Interactivity

• Interactivity refers to the ability of users to interact with a computer


system. An Operating system does the following activities related to
interactivity −
• Provides the user an interface to interact with the system.
• Manages input devices to take inputs from the user. For example,
keyboard.
• Manages output devices to show outputs to the user. For example,
Monitor.
• The response time of the OS needs to be short, since the user submits and
waits for the result.

Real Time System

• Real-time systems are usually dedicated, embedded systems. An


operating system does the following activities related to real-time system
activity.
• In such systems, Operating Systems typically read from and react to
sensor data.
• The Operating system must guarantee response to events within fixed
periods of time to ensure correct performance.

Distributed Environment

• A distributed environment refers to multiple independent CPUs or


processors in a computer system. An operating system does the following
activities related to distributed environment −
• The OS distributes computation logics among several physical
processors.
• The processors do not share memory or a clock. Instead, each processor
has its own local memory.
• The OS manages the communications between the processors. They
communicate with each other through various communication lines.

Spooling

• Spooling is an acronym for simultaneous peripheral operations on line.


Spooling refers to putting data of various I/O jobs in a buffer. This buffer
is a special area in memory or hard disk which is accessible to I/O
devices.
• An operating system does the following activities related to distributed
environment −
• Handles I/O device data spooling as devices have different data access
rates.
• Maintains the spooling buffer which provides a waiting station where
data can rest while the slower device catches up.
• Maintains parallel computation because of spooling process as a
computer can perform I/O in parallel fashion. It becomes possible to have
the computer read data from a tape, write data to disk and to write out to a
tape printer while it is doing its computing task.
Advantages

• The spooling operation uses a disk as a very large buffer.


• Spooling is capable of overlapping I/O operation for one job with
processor operations for anotherjob.

OS for Personal Computers

Personal computer operating system provides a good interface to a single user.


Personal computer operating systems are widely used for word processing,
spreadsheets and Internet access.
Personal computer operating system are made only for personal.
You can say that your laptops, computer systems, tablets etc. are your personal
computers and the operating system such as windows 7, windows 10, android,
etc. are your personal computer operating system.
And you can use your personal computer operating system for your personal
purposes, for example, to chatting with your friends using some social media
sites, reading some articles from internet, making some projects through
microsoftpowerpoint or any other, designing your website, programming
something, watching some videos and movies, listening to some songs and
many more.

OS for Work stations

Windows
Our first choice would be the most common OS used on a workstation:
Microsoft Windows. The three versions of Windows most likely to be
considered are Microsoft Windows 98SE, Windows NT 4.0 Workstation, and
Windows 2000 Professional.
Advantages:-

It has a virtually unlimited amount of software available, supports a large


number of hardware components depending on which version is chosen, and
most people are familiar with the interface.

Disadvantages:-

Windows has a tendency to crash often, it can be expensive even with


upgrades, and none of the OS is open source.

Mac OS
Mac OS has made great strides over the past few years, and is once again
becoming a popular OS among end users in company environments. At the
moment, the operating system is at version 9, but Apple plans to release the next
version, Mac OS X, soon.

Advantages:-

It is designed for ease of use, is great for word processing or graphics


manipulation.

Disadvantages:-

There is very little software support, Apple computers carry a small share of the
computer market as compared to the PC, and there is limited hardware available
that has been designed for the Mac (though this is changing).

Linux/UNIX
One of the fastest growing operating systems could possibly become one of the
most popular workstations, if it can meet the needs of companies. Because the
OS is open source, companies are seriously considering using it to help save
cash that would otherwise be used for licensing other operating systems.

Advantages:-

It is an open source operating system, it includes free software such as


spreadsheet programs and word processors found throughout the Internet, and it
has a large developer base that helps the platform continue to grow on a daily
basis.

Disadvantages:- There is a lack of vital support for companies that download


the software over the Internet, many programs released for the OS can often be
buggy, and users often have to wait an extensive period of time before a kernel
release so that new items can be implemented (e.g., USB and FireWire).

Of course, there are other workstation operating systems out there as well.

Operating systems for hand held devices: -


When you purchase a mobile device the manufacturer will have chosen the
operating system for that specific device. Often, you will want to learn about the
mobile operating system before you purchase a device to ensure compatibility
and support for the mobile applications you want to use.

Some Popular Mobile Operating Systems

1. Android OS (Google Inc.)

The Android mobile operating system is Google’s open and free software stack
that includes an operating system, middleware, and key applications for use on
mobile devices, including smartphones. Updates for the open source Android
mobile operating system have been developed under “dessert-inspired” version
names (Cupcake, Donut, Eclair, Gingerbread, Honeycomb, Ice Cream
Sandwich), with each new version arriving in alphabetical order with new
enhancements and improvements.

2. Bada (Samsung Electronics)

Bada is a proprietary Samsung mobile OS that was first launched in 2010. The
Samsung Wave was the first smartphone to use this mobile OS. Bada provides
mobile features such as multipoint-touch, 3D graphics, and of course,
application downloads and installation.

3. BlackBerry OS (Research In Motion)

The BlackBerry OS is a proprietary mobile operating system developed by


Research In Motion for use on the company’s popular BlackBerry handheld
devices. The BlackBerry platform is popular with corporate users as it offers
synchronization with Microsoft Exchange, Lotus Domino, Novell GroupWise
email, and other business software when used with the BlackBerry Enterprise
Server.

4. iPhone OS/iOS (Apple)

Apple’s iPhone OS was originally developed for use on its iPhone devices.
Now, the mobile operating system is referred to as iOS and is supported on a
number of Apple devices including the iPhone, iPad, iPad 2, and iPod Touch.
The iOS mobile operating system is available only on Apple’s own
manufactured devices as the company does not license the OS for third-party
hardware. Apple iOS is derived from Apple’s Mac OS X operating system.

5. MeeGo OS (Nokia and Intel)

MeeGo OS is a joint open source mobile operating system, which is the result
of merging two products based on open source technologies: Maemo (Nokia)
and Moblin (Intel). MeeGo is a mobile OS designed to work on a number of
devices, including smartphones, netbooks, tablets, in-vehicle information
systems, and various devices using Intel Atom and ARMv7 architectures.

6. Palm OS (Garnet OS)

The Palm OS is a proprietary mobile operating system (PDA operating system)


that was originally released in 1996 on the Pilot 1000 handheld. Newer versions
of the Palm OS have added support for expansion ports, new processors,
external memory cards, improved security, and support for ARM processors and
smartphones. Palm OS 5 was extended to provide support for a broad range of
screen resolutions, wireless connections, and enhanced multimedia capabilities
and is called Garnet OS.

7. Symbian OS (Nokia)

Symbian is a mobile operating system (OS) targeted at mobile phones that


offers a high-level of integration with communication and personal information
management (PIM) functionality. Symbian OS combines middleware with
wireless communications through an integrated mailbox and the integration of
Java and PIM functionality (agenda and contacts). Nokia has made the Symbian
platform available under an alternative, open and direct model to work with
some OEMs and the small community of platform development collaborators.
Nokia does not maintain Symbian as an open source development project.

8. webOS (Palm/HP)

WebOS is a mobile operating system that runs on the Linuxkernel. WebOS was
initially developed by Palm as the successor to its Palm OS mobile operating
system. It is a proprietary Mobile OS which was eventually acquired by HP and
now referred to as webOS (lower-case w) in HP literature. HP uses webOS in a
number of devices including several smartphones and HP TouchPads. It has
pushed its webOS into the enterprise mobile market by focusing on improving
security features and management with the release of webOS 3.x. HP has also
announced plans for a version of webOS to run within the Microsoft Windows
operating system and to be installed on all HP desktop and notebook computers
in 2012.

9. Windows Mobile (Windows Phone)

Windows Mobile is Microsoft’s mobile operating system used in smartphones


and mobile devices with or without touchscreens. The Mobile OS is based on
the Windows CE 5.2 kernel. In 2010, Microsoft announced a new smartphone
platform called Windows Phone 7.
MODULE II

Process Management: Process concept, Process States &process control Block.

Process scheduling: Scheduling criteria, Scheduling Algorithms (Pre-emptive


and non Preemptive)- FCFS,SJF,SRT,RR,Priority, multiple processor, Real
Time, multilevel and multiple feedback queue scheduling.

Deadlock- Definition, deadlock characterization, Necessary and sufficient


conditions for deadlock.

Deadlock handling approaches: Prevention, Avoidance, Detection and


Recovery.

Process

A process is basically a program in execution. The execution of a process


must progress in a sequential fashion.A process is defined as an entity which
represents the basic unit of work to be implemented in the system.To put it in
simple terms, we write our computer programs in a text file and when we
execute this program, it becomes a process which performs all the tasks
mentioned in the program.
When a program is loaded into the memory and it becomes a process, it
can be divided into four sections ─ stack, heap, text and data. The following
image shows a simplified layout of a process inside main memory −
S.N. Component & Description

Stack
1
The process Stack contains the temporary data such as method/function
parameters, return address and local variables.
Heap
2
This is dynamically allocated memory to a process during its run time.

Text
3
This includes the current activity represented by the value of Program
Counter and the contents of the processor's registers.
Data
4
This section contains the global and static variables.

Process Life Cycle

When a process executes, it passes through different states. These stages may
differ in different operating systems, and the names of these states are also not
standardized.

In general, a process can have one of the following five states at a time.

S.N. State & Description

Start
1
This is the initial state when a process is first started/created.

Ready

The process is waiting to be assigned to a processor. Ready processes are


2 waiting to have the processor allocated to them by the operating system so
that they can run. Process may come into this state after Start state or while
running it by but interrupted by the scheduler to assign CPU to some other
process.
Running
3 Once the process has been assigned to a processor by the OS scheduler, the
process state is set to running and the processor executes its instructions.

Waiting
4 Process moves into the waiting state if it needs to wait for a resource, such
as waiting for user input, or waiting for a file to become available.

Terminated or Exit

5 Once the process finishes its execution, or it is terminated by the operating


system, it is moved to the terminated state where it waits to be removed
from main memory.

Process Control Block (PCB)

A Process Control Block is a data structure maintained by the Operating System


for every process. The PCB is identified by an integer process ID (PID). A PCB
keeps all the information needed to keep track of a process as listed below in the
table −

S.N. Information & Description

Process State
1 The current state of the process i.e., whether it is ready, running, waiting,
or whatever.

2 Process privileges
This is required to allow/disallow access to system resources.

Process ID
3
Unique identification for each of the process in the operating system.

Pointer
4
A pointer to parent process.

Program Counter
5 Program Counter is a pointer to the address of the next instruction to be
executed for this process.

CPU registers
6 Various CPU registers where process need to be stored for execution for
running state.

CPU Scheduling Information


7 Process priority and other scheduling information which is required to
schedule the process.

Memory management information


8 This includes the information of page table, memory limits, Segment table
depending on memory used by the operating system.

Accounting information
9 This includes the amount of CPU used for process execution, time limits,
execution ID etc.

IO status information
10
This includes a list of I/O devices allocated to the process.

The architecture of a PCB is completely dependent on Operating System and


may contain different information in different operating systems. Here is a
simplified diagram of a PCB −
The PCB is maintained for a process throughout its lifetime, and is deleted once
the process terminates.

Operating System - Process Scheduling

Definition

The process scheduling is the activity of the process manager that handles
the removal of the running process from the CPU and the selection of another
process on the basis of a particular strategy.
Process scheduling is an essential part of a Multiprogramming operating
systems. Such operating systems allow more than one process to be loaded into
the executable memory at a time and the loaded process shares the CPU using
time multiplexing.

Process Scheduling Queues

The OS maintains all PCBs in Process Scheduling Queues. The OS maintains a


separate queue for each of the process states and PCBs of all processes in the
same execution state are placed in the same queue. When the state of a process
is changed, its PCB is unlinked from its current queue and moved to its new
state queue.

The Operating System maintains the following important process scheduling


queues −

• Job queue − This queue keeps all the processes in the system.
• Ready queue − This queue keeps a set of all processes residing in main
memory, ready and waiting to execute. A new process is always put in this
queue.
• Device queues − The processes which are blocked due to unavailability of an
I/O device constitute this queue.

The OS can use different policies to manage each queue (FIFO, Round
Robin, Priority, etc.). The OS scheduler determines how to move processes
between the ready and run queues which can only have one entry per processor
core on the system; in the above diagram, it has been merged with the CPU.

Two-State Process Model

Two-state process model refers to running and non-running states which are
described below −

S.N. State & Description

Running
1
When a new process is created, it enters into the system as in the running
state.

Not Running

Processes that are not running are kept in queue, waiting for their turn to
execute. Each entry in the queue is a pointer to a particular process. Queue
2 is implemented by using linked list. Use of dispatcher is as follows. When
a process is interrupted, that process is transferred in the waiting queue. If
the process has completed or aborted, the process is discarded. In either
case, the dispatcher then selects a process from the queue to execute.

Schedulers

Schedulers are special system software which handle process scheduling in


various ways. Their main task is to select the jobs to be submitted into the
system and to decide which process to run. Schedulers are of three types −

1. Long-Term Scheduler
2. Short-Term Scheduler
3. Medium-Term Scheduler
1. Long Term Scheduler

It is also called a job scheduler. A long-term scheduler determines which


programs are admitted to the system for processing. It selects processes from
the queue and loads them into memory for execution. Process loads into the
memory for CPU scheduling.
The primary objective of the job scheduler is to provide a balanced mix of
jobs, such as I/O bound and processor bound. It also controls the degree of
multiprogramming. If the degree of multiprogramming is stable, then the
average rate of process creation must be equal to the average departure rate of
processes leaving the system.
On some systems, the long-term scheduler may not be available or
minimal. Time-sharing operating systems have no long term scheduler. When a
process changes the state from new to ready, then there is use of long-term
scheduler.
2. Short Term Scheduler

It is also called as CPU scheduler. Its main objective is to increase system


performance in accordance with the chosen set of criteria. It is the change of
ready state to running state of the process. CPU scheduler selects a process
among the processes that are ready to execute and allocates CPU to one of
them.

Short-term schedulers, also known as dispatchers, make the decision of


which process to execute next. Short-term schedulers are faster than long-term
schedulers.

3. Medium Term Scheduler

Medium-term scheduling is a part of swapping. It removes the processes


from the memory. It reduces the degree of multiprogramming. The medium-
term scheduler is in-charge of handling the swapped out-processes.
A running process may become suspended if it makes an I/O request. A
suspended processes cannot make any progress towards completion. In this
condition, to remove the process from memory and make space for other
processes, the suspended process is moved to the secondary storage. This
process is called swapping, and the process is said to be swapped out or rolled
out. Swapping may be necessary to improve the process mix.

Comparison among Scheduler

S.N. Long-Term Scheduler Short-Term Scheduler Medium-Term Scheduler

It is a process swapping
1 It is a job scheduler It is a CPU scheduler
scheduler.

Speed is in between both


Speed is lesser than Speed is fastest among
2 short and long term
short term scheduler other two
scheduler.
It provides lesser
It controls the degree of It reduces the degree of
3 control over degree of
multiprogramming multiprogramming.
multiprogramming

It is almost absent or
It is also minimal in It is a part of Time
4 minimal in time sharing
time sharing system sharing systems.
system

It can re-introduce the


It selects processes from It selects those
process into memory and
5 pool and loads them into processes which are
execution can be
memory for execution ready to execute
continued.

Context Switch

A context switch is the mechanism to store and restore the state or context
of a CPU in Process Control block so that a process execution can be resumed
from the same point at a later time. Using this technique, a context switcher
enables multiple processes to share a single CPU. Context switching is an
essential part of a multitasking operating system features.
When the scheduler switches the CPU from executing one process to
execute another, the state from the current running process is stored into the
process control block. After this, the state for the process to run next is loaded
from its own PCB and used to set the PC, registers, etc. At that point, the second
process can start executing.
Context switches are computationally intensive since register and memory
state must be saved and restored. To avoid the amount of context switching
time, some hardware systems employ two or more sets of processor registers.
When the process is switched, the following information is stored for later use.

1. Program Counter
2. Scheduling information
3. Base and limit register value
4. Currently used register
5. Changed State
6. I/O State information
7. Accounting information
Operating System scheduling algorithms
A Process Scheduler schedules different processes to be assigned to the
CPU based on particular scheduling algorithms. There are six popular process
scheduling algorithms which we are going to discuss in this chapter −

• First-Come, First-Served (FCFS) Scheduling


• Shortest-Job-Next (SJN) Scheduling /Shortest Job First (SJF)
• Priority Scheduling
• Shortest Remaining Time
• Round Robin(RR) Scheduling
• Multiple-Level Queues Scheduling
These algorithms are either non-preemptive or preemptive. Non-preemptive
algorithms are designed so that once a process enters the running state, it cannot
be preempted until it completes its allotted time, whereas the preemptive
scheduling is based on priority where a scheduler may preempt a low priority
running process anytime when a high priority process enters into a ready state.

• First Come First Serve (FCFS)


• Jobs are executed on first come, first serve basis.
• It is a non-preemptive, pre-emptive scheduling algorithm.
• Easy to understand and implement.
• Its implementation is based on FIFO queue.
• Poor in performance as average wait time is high.

Wait time of each process is as follows −


Process Wait Time : Service Time - Arrival Time

P0 0-0=0

P1 5-1=4

P2 8-2=6

P3 16 - 3 = 13

Average Wait Time: (0+4+6+13) / 4 = 5.75

• Shortest Job Next (SJN)/Shortest Job First (SJF)

• This is also known as shortest job first, or SJF


• This is a non-preemptive, pre-emptive scheduling algorithm.
• Best approach to minimize waiting time.
• Easy to implement in Batch systems where required CPU time is known
in advance.
• Impossible to implement in interactive systems where required CPU time
is not known.
• The processer should know in advance how much time process will take.

Given: Table of processes, and their Arrival time, Execution time

Process Arrival Time Execution Time Service Time


P0 0 5 0
P1 1 3 5
P2 2 8 14
P3 3 6 8
Waiting time of each process is as follows −

Process Waiting Time


P0 0-0=0
P1 5-1=4
P2 14 - 2 = 12
P3 8-3=5

Average Wait Time: (0 + 4 + 12 + 5)/4 = 21 / 4 = 5.25

• Priority Based Scheduling


• Priority scheduling is a non-preemptive algorithm and one of the most
common scheduling algorithms in batch systems.
• Each process is assigned a priority. Process with highest priority is to be
executed first and so on.
• Processes with same priority are executed on first come first served basis.
• Priority can be decided based on memory requirements, time
requirements or any other resource requirement.
Given: Table of processes, and their Arrival time, Execution time, and priority.
Here we are considering 1 is the lowest priority.

Process Arrival Time Execution Time Priority Service Time


P0 0 5 1 0
P1 1 3 2 11
P2 2 8 1 14
P3 3 6 3 5

Waiting time of each process is as follows −

Process Waiting Time


P0 0-0=0
P1 11 - 1 = 10
P2 14 - 2 = 12
P3 5-3=2

Average Wait Time: (0 + 10 + 12 + 2)/4 = 24 / 4 = 6

➢ Shortest Remaining Time


• Shortest remaining time (SRT) is the preemptive version of the SJN
algorithm.
• The processor is allocated to the job closest to completion but it can be
preempted by a newer ready job with shorter time to completion.
• Impossible to implement in interactive systems where required CPU time
is not known.
• It is often used in batch environments where short jobs need to give
preference.

➢ Round Robin Scheduling


• Round Robin is the preemptive process scheduling algorithm.
• Each process is provided a fix time to execute, it is called a quantum.
• Once a process is executed for a given time period, it is preempted and
other process executes for a given time period.
• Context switching is used to save states of preempted processes.

Wait time of each process is as follows −


Process Wait Time : Service Time - Arrival Time
P0 (0 - 0) + (12 - 3) = 9
P1 (3 - 1) = 2
P2 (6 - 2) + (14 - 9) + (20 - 17) = 12
P3 (9 - 3) + (17 - 12) = 11
Average Wait Time: (9+2+12+11) / 4 = 8.5

➢ Multiple-Level Queues Scheduling


• Multiple-level queues are not an independent scheduling algorithm. They
make use of other existing algorithms to group and schedule jobs with
common characteristics.
• Multiple queues are maintained for processes with common
characteristics.
• Each queue can have its own scheduling algorithms.
• Priorities are assigned to each queue.
For example, CPU-bound jobs can be scheduled in one queue and all I/O-
bound jobs in another queue. The Process Scheduler then alternately selects jobs
from each queue and assigns them to the CPU based on the algorithm assigned
to the queue.

Introduction to Deadlock

A deadlock happens in operating system when two or more processes need


some resource to complete their execution that is held by the other process.

In the above diagram,


• the process 1 has resource 1 and needs to acquire resource 2. Similarly
process 2 has resource 2 and needs to acquire resource 1. Process 1 and
process 2 are in deadlock as each of them needs the other’s resource to
complete their execution but neither of them is willing to relinquish their
resources.

Every process needs some resources to complete its execution. However, the
resource is granted in a sequential order.

1. The process requests for some resource.


2. OS grant the resource if it is available otherwise let the process waits.
3. The process uses it and release on the completion.

A Deadlock is a situation where each of the computer process waits for a


resource which is being assigned to some another process. In this situation, none
of the process gets executed since the resource it needs, is held by some other
process which is also waiting for some other resource to be released.

Let us assume that there are three processes P1, P2 and P3. There are three
different resources R1, R2 and R3. R1 is assigned to P1, R2 is assigned to P2
and R3 is assigned to P3.

After some time, P1 demands for R1 which is being used by P2. P1 halts its
execution since it can't complete without R2. P2 also demands for R3 which is
being used by P3. P2 also stops its execution because it can't continue without
R3. P3 also demands for R1 which is being used by P1 therefore P3 also stops
its execution.

In this scenario, a cycle is being formed among the three processes. None of the
process is progressing and they are all waiting. The computer becomes
unresponsive since all the processes got blocked.

Necessary and sufficient conditions for Deadlocks

• Mutual Exclusion

A resource can only be shared in mutually exclusive manner. It implies, if two


process cannot use the same resource at the same time.

• Hold and Wait

A process waits for some resources while holding another resource at the same
time.
• No preemption

The process which once scheduled will be executed till the completion. No
other process can be scheduled by the scheduler meanwhile.

• Circular Wait

All the processes must be waiting for the resources in a cyclic manner so that
the last process is waiting for the resource which is being held by the first
process.

Strategies for handling Deadlock

1. Deadlock Ignorance

Deadlock Ignorance is the most widely used approach among all the
mechanism. This is being used by many operating systems mainly for end user
uses. In this approach, the Operating system assumes that deadlock never
occurs. It simply ignores deadlock. This approach is best suitable for a single
end user system where User uses the system only for browsing and all other
normal stuff.

There is always a tradeoff between Correctness and performance. The operating


systems like Windows and Linux mainly focus upon performance. However, the
performance of the system decreases if it uses deadlock handling mechanism all
the time if deadlock happens 1 out of 100 times then it is completely
unnecessary to use the deadlock handling mechanism all the time.

In these types of systems, the user has to simply restart the computer in the case
of deadlock. Windows and Linux are mainly using this approach.

2. Deadlock prevention

Deadlock happens only when Mutual Exclusion, hold and wait, Nopreemption
and circular wait holds simultaneously. If it is possible to violate one of the four
conditions at any time then the deadlock can never occur in the system.

The idea behind the approach is very simple that we have to fail one of the four
conditions but there can be a big argument on its physical implementation in the
system.
We will discuss it later in detail.

3. Deadlock avoidance

In deadlock avoidance, the operating system checks whether the system is in


safe state or in unsafe state at every step which the operating system performs.
The process continues until the system is in safe state. Once the system moves
to unsafe state, the OS has to backtrack one step.

In simple words, The OS reviews each allocation so that the allocation doesn't
cause the deadlock in the system.

We will discuss Deadlock avoidance later in detail.

4. Deadlock detection and recovery

This approach let the processes fall in deadlock and then periodically check
whether deadlock occur in the system or not. If it occurs then it applies some of
the recovery methods to the system to get rid of deadlock.

We will discuss deadlock detection and recovery later in more detail since it is a
matter of discussion.

Deadlock Prevention

If we simulate deadlock with a table which is standing on its four legs then we
can also simulate four legs with the four conditions which when occurs
simultaneously, cause the deadlock.

However, if we break one of the legs of the table then the table will fall
definitely. The same happens with deadlock, if we can be able to violate one of
the four necessary conditions and don't let them occur together then we can
prevent the deadlock.

Let's see how we can prevent each of the conditions.

1. Mutual Exclusion

Mutual section from the resource point of view is the fact that a resource can
never be used by more than one process simultaneously which is fair enough
but that is the main reason behind the deadlock. If a resource could have been
used by more than one process at the same time then the process would have
never been waiting for any resource.

However, if we can be able to violate resources behaving in the mutually


exclusive manner then the deadlock can be prevented.

Spooling

For a device like printer, spooling can work. There is a memory associated with
the printer which stores jobs from each of the process into it. Later, Printer
collects all the jobs and print each one of them according to FCFS. By using this
mechanism, the process doesn't have to wait for the printer and it can continue
whatever it was doing. Later, it collects the output when it is produced.

Although, Spooling can be an effective approach to violate mutual exclusion but


it suffers from two kinds of problems.

This cannot be applied to every resource.

After some point of time, there may arise a race condition between the
processes to get space in that spool.

We cannot force a resource to be used by more than one process at the same
time since it will not be fair enough and some serious problems may arise in the
performance. Therefore, we cannot violate mutual exclusion for a process
practically.
2. Hold and Wait

Hold and wait condition lies when a process holds a resource and waiting for
some other resource to complete its task. Deadlock occurs because there can be
more than one process which are holding one resource and waiting for other in
the cyclic order.

However, we have to find out some mechanism by which a process either


doesn't hold any resource or doesn't wait. That means, a process must be
assigned all the necessary resources before the execution starts. A process must
not wait for any resource once the execution has been started.

!(Hold and wait) = !hold or !wait (negation of hold and wait is, either you
don't hold or you don't wait)

This can be implemented practically if a process declares all the resources


initially. However, this sounds very practical but can't be done in the computer
system because a process can't determine necessary resources initially.

Process is the set of instructions which are executed by the CPU. Each of the
instruction may demand multiple resources at the multiple times. The need
cannot be fixed by the OS.

The problem with the approach is:

1 Practically not possible.


2 Possibility of getting starved will be increases due to the fact that
some process may hold a resource for a very long time.

3. No Preemption

Deadlock arises due to the fact that a process can't be stopped once it starts.
However, if we take the resource away from the process which is causing
deadlock then we can prevent deadlock.

This is not a good approach at all since if we take a resource away which is
being used by the process then all the work which it has done till now can
become inconsistent.
Consider a printer is being used by any process. If we take the printer away
from that process and assign it to some other process then all the data which has
been printed can become inconsistent and ineffective and also the fact that the
process can't start printing again from where it has left which causes
performance inefficiency.

4. Circular Wait

To violate circular wait, we can assign a priority number to each of the resource.
A process can't request for a lesser priority resource. This ensures that not a
single process can request a resource which is being utilized by some other
process and no cycle will be formed.

Among all the methods, violating Circular wait is the only approach that can be
implemented practically.

Deadlock avoidance

In deadlock avoidance, the request for any resource will be granted if the
resulting state of the system doesn't cause deadlock in the system. The state of
the system will continuously be checked for safe and unsafe states.
In order to avoid deadlocks, the process must tell OS, the maximum number of
resources a process can request to complete its execution.

The simplest and most useful approach states that the process should declare the
maximum number of resources of each type it may ever need. The Deadlock
avoidance algorithm examines the resource allocations so that there can never
be a circular wait condition.

Safe and Unsafe States

The resource allocation state of a system can be defined by the instances of


available and allocated resources, and the maximum instance of the resources
demanded by the processes.

A state of a system recorded at some random time is shown below.

Resources Assigned

Process Type 1 Type 2 Type 3 Type 4


A 3 0 2 2
B 0 0 1 1
C 1 1 1 0
D 2 1 4 0

Resources still needed

Process Type 1 Type 2 Type 3 Type 4


A 1 1 0 0
B 0 1 1 2
C 1 2 1 0
D 2 1 1 2

E = (7 6 8 4)

P = (6 2 8 3)
A = (1 4 0 1)

Above tables and vector E, P and A describes the resource allocation state of a
system. There are 4 processes and 4 types of the resources in a system. Table 1
shows the instances of each resource assigned to each process.

Table 2 shows the instances of the resources, each process still needs. Vector E
is the representation of total instances of each resource in the system.

Vector P represents the instances of resources that have been assigned to


processes. Vector A represents the number of resources that are not in use.

A state of the system is called safe if the system can allocate all the resources
requested by all the processes without entering into deadlock.

If the system cannot fulfill the request of all processes then the state of the
system is called unsafe.

The key of Deadlock avoidance approach is when the request is made for
resources then the request must only be approved in the case if the resulting
state is also a safe state.
MODULE III

Memory Management : Introduction, Address binding, Logical Versus physical


address space, Swapping, Contiguous and non contiguous allocation,
Fragmentation (Internal and External), compaction, paging, segmentation,
virtual memory, Demand paging, performance of demand paging, Page
replacement Algorithms.
File management: Concept of file system (File attributes, operations, types),
Functions of file system, Types of file system, Access methods (Sequential
Direct and other methods), Directory structure (Single- level, two-level, tree
structured, acyclic graph, general graph), Allocation methods (Contiguous,
Linked, Indexed)

Memory Management
Memory management is the functionality of an operating system which
handles or manages primary memory and moves processes back and forth
between main memory and disk during execution. Memory management keeps
track of each and every memory location, regardless of either it is allocated to
some process or it is free. It checks how much memory is to be allocated to
processes. It decides which process will get memory at what time. It tracks
whenever some memory gets freed or unallocated and correspondingly it
updates the status.
Process Address Space
The process address space is the set of logical addresses that a process
references in its code. For example, when 32-bit addressing is in use, addresses
can range from 0 to 0x7fffffff; that is, 2^31 possible numbers, for a total
theoretical size of 2 gigabytes.
The operating system takes care of mapping the logical addresses to
physical addresses at the time of memory allocation to the program. There are
three types of addresses used in a program before and after memory is allocated


S.N. Memory Addresses & Description

Symbolic addresses
1
The addresses used in a source code. The variable names, constants, and
instruction labels are the basic elements of the symbolic address space.
Relative addresses
2
At the time of compilation, a compiler converts symbolic addresses into
relative addresses.
Physical addresses
3
The loader generates these addresses at the time when a program is loaded
into main memory.

Address binding
The Address Binding refers to the mapping of computer instructions and
data to physical memory locations. Both logical and physical addresses are used
in computer memory. It assigns a physical memory region to a logical pointer
by mapping a physical address to a logical address known as a virtual address. It
is also a component of computer memory management that the OS performs on
behalf of applications that require memory access.

Types of Address Binding

There are mainly three types of an address binding in the OS. These are as
follows:

1. Compile Time Address Binding


2. Load Time Address Binding
3. Execution Time or Dynamic Address Binding

Compile Time Address Binding


It is the first type of address binding. It occurs when the compiler is
responsible for performing address binding, and the compiler interacts with the
operating system to perform the address binding. In other words, when a
program is executed, it allocates memory to the system code of the computer.
The address binding assigns a logical address to the beginning of the memory
segment to store the object code. Memory allocation is a long-term process and
may only be modified by recompiling the program.
Load Time Address Binding
It is another type of address binding. It is done after loading the program
in the memory, and it would be done by the operating system memory manager,
i.e., loader. If memory allocation is specified when the program is assigned, no
program in its compiled state may ever be transferred from one computer to
another. Memory allocations in the executable code may already be in use by
another program on the new system. In this case, the logical addresses of the
program are not connected to physical addresses until it is applied and loaded
into memory.
Execution Time or Dynamic Address Binding
Execution time address binding is the most popular type of binding for scripts
that aren't compiled because it only applies to variables in the program. When a
variable in a program is encountered during the processing of instructions in a
script, the program seeks memory space for that variable. The memory would
assign the space to that variable until the program sequence finished or unless a
specific instruction within the script released the memory address connected to
a variable.

Logical and Physical Address in Operating System

Logical Address is generated by CPU while a program is running. The logical


address is virtual address as it does not exist physically, therefore, it is also
known as Virtual Address. This address is used as a reference to access the
physical memory location by CPU. The term Logical Address Space is used for
the set of all logical addresses generated by a program’s perspective.
The hardware device called Memory-Management Unit is used for mapping
logical address to its corresponding physical address.

Physical Address identifies a physical location of required data in a memory.


The user never directly deals with the physical address but can access by its
corresponding logical address. The user program generates the logical address
and thinks that the program is running in this logical address but the program
needs physical memory for its execution, therefore, the logical address must be
mapped to the physical address by MMU before they are used. The term
Physical Address Space is used for all physical addresses corresponding to the
logical addresses in a Logical address space.
Mapping virtual-address to physical-addresses

Differences between Logical and Physical Address in Operating System

1. The basic difference between Logical and physical address is that Logical
address is generated by CPU in perspective of a program whereas the
physical address is a location that exists in the memory unit.
2. Logical Address Space is the set of all logical addresses generated by
CPU for a program whereas the set of all physical address mapped to
corresponding logical addresses is called Physical Address Space.
3. The logical address does not exist physically in the memory whereas
physical address is a location in the memory that can be accessed
physically.
4. Identical logical addresses are generated by Compile-time and Load time
address binding methods whereas they differs from each other in run-time
address binding method.
5. The logical address is generated by the CPU while the program is running
whereas the physical address is computed by the Memory Management
Unit (MMU).

Comparison Chart:

Parameter LOGICAL ADDRESS PHYSICAL ADDRESS


Basic generated by CPU location in a memory unit
Logical Address Space is set of
Physical Address is set of all
Address all logical addresses generated
physical addresses mapped to the
Space by CPU in reference to a
corresponding logical addresses.
program.
User can view the logical User can never view physical
Visibility
address of a program. address of program.
Generation generated by the CPU Computed by MMU
The user can use the logical
The user can indirectly access
Access address to access the physical
physical address but not directly.
address.

Swapping

Swapping is a mechanism in which a process can be swapped temporarily out of


main memory (or move) to secondary storage (disk) and make that memory
available to other processes. At some later time, the system swaps back the
process from the secondary storage to main memory.
Though performance is usually affected by swapping process but it helps
in running multiple and big processes in parallel and that's the reason Swapping
is also known as a technique for memory compaction.
The total time taken by swapping process includes the time it takes to move the
entire process to a secondary disk and then to copy the process back to memory,
as well as the time the process takes to regain main memory.
Let us assume that the user process is of size 2048KB and on a standard
hard disk where swapping will take place has a data transfer rate around 1 MB
per second. The actual transfer of the 1000K process to or from memory will
take

2048KB / 1024KB per second


= 2 seconds
= 2000 milliseconds
Now considering in and out time, it will take complete 4000 milliseconds plus
other overhead where the process competes to regain main memory.

Memory Allocation

In the Operating System, there are two techniques for memory allocation and
these are as follows:

• Contiguous Memory Allocation


• Non-Contiguous Memory Allocation

Contiguous Memory Allocation


In Contiguous Memory Allocation whenever any user process request
for the memory then a single section of the contiguous memory block is
allocated to that process according to the requirements of the process.
Contiguous memory allocation is achieved just by dividing the memory into
the fixed-sized partition.
In this, all the available memory space remains together at one place
and freely available memory partitions are not distributed here and there
across the whole memory space.

Non-Contiguous Memory Allocation


With the help of Non-contiguous memory allocation, a process is allowed
to acquire several memory blocks at different locations in the memory
according to its need. In the non-contiguous memory allocation, the available
free memory space is distributed here and there which means that all the free
memory space is not in one place.
In this technique, memory space acquired by a process is not at one place
but it is at different locations according to the requirements of the process.
Contiguous Memory Allocation Non-Contiguous Memory Allocation

The contiguous Memory The non-Contiguous Memory allocation


Allocation technique allocates technique divides the process into several
one single contiguous block of blocks and then places them in the
memory to the process and different address space of the memory
memory is allocated to the that is memory is allocated to the process
process in a continuous fashion. in a non-contiguous fashion.

In this Allocation scheme, there


While in this scheme, there is overhead in
is no overhead in the address
the address translation while the execution
translation while the execution of
of the process.
the process.

In Contiguous Memory In Non-contiguous Memory allocation


Allocation, the process executes execution of the process is slow as the
faster because the whole process process is in different locations of the
is in a sequential block. memory.

Contiguous Memory Allocation The non-Contiguous Memory Allocation


is easier for the Operating scheme is difficult for the Operating
System to control. System to control.

In this scheme, the process is divided into


In this, the memory space is
several blocks and then these blocks are
divided into fixed-sized
placed in different parts of the memory
partitions and each partition is
according to the availability of memory
allocated only to a single process.
space.

Contiguous memory allocation


includes single partition Non-Contiguous memory allocation
allocation and multi-partition includes Paging and Segmentation.
allocation.
Contiguous Memory Allocation Non-Contiguous Memory Allocation

In this type of memory


In this type of memory allocation
allocation, generally, a table is
generally, a table has to be maintained
maintained by the operating
for each process that mainly carries the
system that maintains the list of
base addresses of each block that has
all available and occupied
been acquired by a process in the memory.
partitions in the memory space.

There is wastage of memory in There is no wastage of memory in Non-


Contiguous Memory allocation. Contiguous Memory allocation.

In this type of allocation, In this type of allocation, swapped-in


swapped-in processes are processes can be arranged in any place in
arranged in the originally the memory.
allocated space.

Fragmentation

As processes are loaded and removed from memory, the free memory space is
broken into little pieces. It happens after sometimes that processes cannot be
allocated to memory blocks considering their small size and memory blocks
remains unused. This problem is known as Fragmentation.Fragmentation is of
two types −

S.N. Fragmentation & Description

External fragmentation
1
Total memory space is enough to satisfy a request or to reside a process in
it, but it is not contiguous, so it cannot be used.
Internal fragmentation
2
Memory block assigned to process is bigger. Some portion of memory is
left unused, as it cannot be used by another process.

External fragmentation can be reduced by compaction or shuffle memory


contents to place all free memory together in one large block. To make
compaction feasible, relocation should be dynamic.
The internal fragmentation can be reduced by effectively assigning the
smallest partition but large enough for the process.

Compaction

Compaction is a technique to collect all the free memory present in form


of fragments into one large chunk of free memory, which can be used to run
other processes.
It does that by moving all the processes towards one end of the memory
and all the available free space towards the other end of the memory so that it
becomes contiguous.
It is not always easy to do compaction. Compaction can be done only
when the relocation is dynamic and done at execution time. Compaction can not
be done when relocation is static and is performed at load time or assembly
time.

Before Compaction
Before compaction, the main memory has some free space between
occupied space. This condition is known as external fragmentation. Due to less
free space between occupied spaces, large processes cannot be loaded into
them.
Main Memory

Occupied space

Free space

Occupied space

Occupied space

Free space

After Compaction
After compaction, all the occupied space has been moved up and the free
space at the bottom. This makes the space contiguous and removes external
fragmentation. Processes with large memory requirements can be now loaded
into the main memory.
Main Memory

Occupied space

Occupied space

Occupied space

Free space

Free space

Purpose of Compaction in Operating System


While allocating memory to process, the operating system often faces a
problem when there’s a sufficient amount of free space within the memory to
satisfy the memory demand of a process. However the process’s memory
request can’t be fulfilled because the free memory available is in a non-
contiguous manner, this problem is referred to as external fragmentation. To
solve such kinds of problems compaction technique is used.

Issues with Compaction


Although the compaction technique is very useful in making memory
utilization efficient and reduces external fragmentation of memory, the problem
with it is that a large amount of time is wasted in the process and during that
time the CPU sits idle hence reducing the efficiency of the system.

Advantages of Compaction

• Reduces external fragmentation.


• Make memory usage efficient.
• Memory becomes contiguous.
• Since memory becomes contiguous more processes can be loaded to
memory.

Disadvantages of Compaction

• System efficiency reduces.


• A huge amount of time is wasted in performing compaction.
• CPU sits idle for a long time.
• Not always easy to perform compaction.

Paging
A computer can address more memory than the amount physically
installed on the system. This extra memory is actually called virtual memory
and it is a section of a hard that's set up to emulate the computer's RAM. Paging
technique plays an important role in implementing virtual memory.
Paging is a memory management technique in which process address
space is broken into blocks of the same size called pages (size is power of 2,
between 512 bytes and 8192 bytes). The size of the process is measured in the
number of pages.
Similarly, main memory is divided into small fixed-sized blocks of
(physical) memory called frames and the size of a frame is kept the same as
that of a page to have optimum utilization of the main memory and to avoid
external fragmentation.
Address Translation

Page address is called logical address and represented by page number and the
offset.

Logical Address = Page number + page offset

Frame address is called physical address and represented by a frame number


and the offset.

Physical Address = Frame number + page offset

A data structure called page map table is used to keep track of the relation
between a page of a process to a frame in physical memory.
When the system allocates a frame to any page, it translates this logical
address into a physical address and create entry into the page table to be used
throughout execution of the program.
When a process is to be executed, its corresponding pages are loaded into
any available memory frames. Suppose you have a program of 8Kb but your
memory can accommodate only 5Kb at a given point in time, then the paging
concept will come into picture. When a computer runs out of RAM, the
operating system (OS) will move idle or unwanted pages of memory to
secondary memory to free up RAM for other processes and brings them back
when needed by the program.
This process continues during the whole execution of the program where
the OS keeps removing idle pages from the main memory and write them onto
the secondary memory and bring them back when required by the program.

Advantages and Disadvantages of Paging


Here is a list of advantages and disadvantages of paging −

• Paging reduces external fragmentation, but still suffer from internal


fragmentation.
• Paging is simple to implement and assumed as an efficient memory
management technique.
• Due to equal size of the pages and frames, swapping becomes very easy.
• Page table requires extra memory space, so may not be good for a system
having small RAM.

Segmentation
Segmentation is a memory management technique in which each job is
divided into several segments of different sizes, one for each module that
contains pieces that perform related functions. Each segment is actually a
different logical address space of the program.

When a process is to be executed, its corresponding segmentation are


loaded into non-contiguous memory though every segment is loaded into a
contiguous block of available memory.
Segmentation memory management works very similar to paging but
here segments are of variable-length where as in paging pages are of fixed size.
A program segment contains the program's main function, utility
functions, data structures, and so on. The operating system maintains a segment
map table for every process and a list of free memory blocks along with
segment numbers, their size and corresponding memory locations in main
memory. For each segment, the table stores the starting address of the segment
and the length of the segment. A reference to a memory location includes a
value that identifies a segment and an offset.
Virtual Memory

Virtual Memory is a storage scheme that provides user an illusion of having a


very big main memory. This is done by treating a part of secondary memory as
the main memory.
In this scheme, User can load the bigger size processes than the available
main memory by having the illusion that the memory is available to load the
process.
Instead of loading one big process in the main memory, the Operating
System loads the different parts of more than one process in the main
memory.By doing this, the degree of multiprogramming will be increased and
therefore, the CPU utilization will also be increased.

How Virtual Memory Works?

In modern word, virtual memory has become quite common these days. In this
scheme, whenever some pages needs to be loaded in the main memory for the
execution and the memory is not available for those many pages, then in that
case, instead of stopping the pages from entering in the main memory, the OS
search for the RAM area that are least used in the recent times or that are not
referenced and copy that into the secondary memory to make the space for the
new pages in the main memory.
Since all this procedure happens automatically, therefore it makes the
computer feel like it is having the unlimited RAM.
Advantages of Virtual Memory
1. The degree of Multiprogramming will be increased.
2. User can run large application with less real RAM.
3. There is no need to buy more memory RAMs.

Disadvantages of Virtual Memory


1. The system becomes slower since swapping takes time.
2. It takes more time in switching between applications.
3. The user will have the lesser hard disk space for its use.
Example of a virtual memory management system
Let us assume 2 processes, P1 and P2, contains 4 pages each. Each page
size is 1 KB. The main memory contains 8 frame of 1 KB each. The OS resides
in the first two partitions. In the third partition, 1st page of P1 is stored and the
other frames are also shown as filled with the different pages of processes in the
main memory.
The page tables of both the pages are 1 KB size each and therefore they can be
fit in one frame each. The page tables of both the processes contain various
information that is also shown in the image.
The CPU contains a register which contains the base address of page
table that is 5 in the case of P1 and 7 in the case of P2. This page table base
address will be added to the page number of the Logical address when it comes
to accessing the actual corresponding entry.
Demand Paging
According to the concept of Virtual Memory, in order to execute some
process, only a part of the process needs to be present in the main memory
which means that only a few pages will only be present in the main memory at
any time.
However, deciding, which pages need to be kept in the main memory and
which need to be kept in the secondary memory, is going to be difficult because
we cannot say in advance that a process will require a particular page at
particular time.
Therefore, to overcome this problem, there is a concept called Demand
Paging is introduced. It suggests keeping all pages of the frames in the
secondary memory until they are required. In other words, it says that do not
load any page in the main memory until it is required.
Whenever any page is referred for the first time in the main memory, then
that page will be found in the secondary memory.
After that, it may or may not be present in the main memory depending
upon the page replacement algorithm.
Demand Paging is a popular method of virtual memory management. In
demand paging, the pages of a process which are least used, get stored in the
secondary memory.
A page is copied to the main memory when its demand is made or page fault
occurs. There are various page replacement algorithms which are used to
determine the pages which will be replaced. We will discuss each one of them
later in detail.

What is a Page Fault?


If the referred page is not present in the main memory then there will be a
miss and the concept is called Page miss or page fault.
The CPU has to access the missed page from the secondary memory. If
the number of page fault is very high then the effective access time of the
system will become very high.
What is Thrashing?
If the number of page faults is equal to the number of referred pages or
the number of page faults are so high so that the CPU remains busy in just
reading the pages from the secondary memory then the effective access time
will be the time taken by the CPU to read one word from the secondary memory
and it will be so high. The concept is called thrashing.

Advantages of demand paging

• Large virtual memory.


• More efficient use of memory.
• There is no limit on degree of multiprogramming.

Disadvantages of demand paging

• Number of tables and the amount of processor overhead for handling


page interrupts are greater than in the case of the simple paged
management techniques.

Page Replacement Algorithm

Page replacement algorithms are the techniques using which an Operating


System decides which memory pages to swap out, write to disk when a page of
memory needs to be allocated. Paging happens whenever a page fault occurs
and a free page cannot be used for allocation purpose accounting to reason that
pages are not available or the number of free pages is lower than required pages.
When the page that was selected for replacement and was paged out, is
referenced again, it has to read in from disk, and this requires for I/O
completion. This process determines the quality of the page replacement
algorithm: the lesser the time waiting for page-ins, the better is the algorithm.
A page replacement algorithm looks at the limited information about
accessing the pages provided by hardware, and tries to select which pages
should be replaced to minimize the total number of page misses, while
balancing it with the costs of primary storage and processor time of the
algorithm itself. There are many different page replacement algorithms. We
evaluate an algorithm by running it on a particular string of memory reference
and computing the number of page faults,
Reference String
The string of memory references is called reference string. Reference strings
are generated artificially or by tracing a given system and recording the address
of each memory reference. The latter choice produces a large number of data,
where we note two things.

• For a given page size, we need to consider only the page number, not the
entire address.
• If we have a reference to a page p, then any immediately following
references to page p will never cause a page fault. Page p will be in
memory after the first reference; the immediately following references
will not fault.
• For example, consider the following sequence of addresses −
123,215,600,1234,76,96
• If page size is 100, then the reference string is 1,2,6,12,0,0

First In First Out (FIFO) algorithm

• Oldest page in main memory is the one which will be selected for
replacement.
• Easy to implement, keep a list, replace pages from the tail and add new
pages at the head.
Optimal Page algorithm

• An optimal page-replacement algorithm has the lowest page-fault rate of


all algorithms. An optimal page-replacement algorithm exists, and has
been called OPT or MIN.
• Replace the page that will not be used for the longest period of time. Use
the time when a page is to be used.

Least Recently Used (LRU) algorithm


• Page which has not been used for the longest time in main memory is the
one which will be selected for replacement.
• Easy to implement, keep a list, replace pages by looking back into time.

Page Buffering algorithm

• To get a process start quickly, keep a pool of free frames.


• On page fault, select a page to be replaced.
• Write the new page in the frame of free pool, mark the page table and
restart the process.
• Now write the dirty page out of disk and place the frame holding replaced
page in free pool.

Least frequently Used(LFU) algorithm

• The page with the smallest count is the one which will be selected for
replacement.
• This algorithm suffers from the situation in which a page is used heavily
during the initial phase of a process, but then is never used again.

Most frequently Used(MFU) algorithm

• This algorithm is based on the argument that the page with the smallest
count was probably just brought in and has yet to be used.
File System

File

A file is a named collection of related information that is recorded on secondary


storage such as magnetic disks, magnetic tapes and optical disks. In general, a
file is a sequence of bits, bytes, lines or records whose meaning is defined by
the files creator and user.

File Structure

A File Structure should be according to a required format that the operating


system can understand.

• A file has a certain defined structure according to its type.


• A text file is a sequence of characters organized into lines.
• A source file is a sequence of procedures and functions.
• An object file is a sequence of bytes organized into blocks that are
understandable by the machine.
• When operating system defines different file structures, it also contains
the code to support these file structure. Unix, MS-DOS support minimum
number of file structure.

What is a File ?

A file can be defined as a data structure which stores the sequence of records.
Files are stored in a file system, which may exist on a disk or in the main
memory. Files can be simple (plain text) or complex (specially-formatted).

The collection of files is known as Directory. The collection of directories at the


different levels, is known as File System.

Attributes of the File

1. Name
Every file carries a name by which the file is recognized in the file system. One
directory cannot have two files with the same name.
2. Identifier
Along with the name, Each File has its own extension which identifies the type
of the file. For example, a text file has the extension .txt, A video file can have
the extension .mp4.

3. Type
In a File System, the Files are classified in different types such as video files,
audio files, text files, executable files, etc.

4. Location
In the File System, there are several locations on which, the files can be stored.
Each file carries its location as its attribute.

5. Size
The Size of the File is one of its most important attribute. By size of the file, we
mean the number of bytes acquired by the file in the memory.

6. Protection
The Admin of the computer may want the different protections for the different
files. Therefore each file carries its own set of permissions to the different group
of Users.

7. Time and Date


Every file carries a time stamp which contains the time and date on which the
file is last modified.

Operations on the File

A file is a collection of logically related data that is recorded on the secondary


storage in the form of sequence of operations. The content of the files are
defined by its creator who is creating the file. The various operations which can
be implemented on a file such as read, write, open and close etc. are called file
operations. These operations are performed by the user by using the commands
provided by the operating system. Some common operations are as follows:

1. Create operation:
This operation is used to create a file in the file system. It is the most widely
used operation performed on the file system. To create a new file of a particular
type the associated application program calls the file system. This file system
allocates space to the file. As the file system knows the format of directory
structure, so entry of this new file is made into the appropriate directory.

2. Open operation:
This operation is the common operation performed on the file. Once the file is
created, it must be opened before performing the file processing operations.
When the user wants to open a file, it provides a file name to open the particular
file in the file system. It tells the operating system to invoke the open system
call and passes the file name to the file system.

3. Write operation:
This operation is used to write the information into a file. A system call write is
issued that specifies the name of the file and the length of the data has to be
written to the file. Whenever the file length is increased by specified value and
the file pointer is repositioned after the last byte written.

4. Read operation:
This operation reads the contents from a file. A Read pointer is maintained by
the OS, pointing to the position up to which the data has been read.

5. Re-position or Seek operation:


The seek system call re-positions the file pointers from the current position to a
specific place in the file i.e. forward or backward depending upon the user's
requirement. This operation is generally performed with those file management
systems that support direct access files.

6. Delete operation:
Deleting the file will not only delete all the data stored inside the file it is also
used so that disk space occupied by it is freed. In order to delete the specified
file the directory is searched. When the directory entry is located, all the
associated file space and the directory entry is released.

7. Truncate operation:
Truncating is simply deleting the file except deleting attributes. The file is not
completely deleted although the information stored inside the file gets replaced.

8. Close operation:
When the processing of the file is complete, it should be closed so that all the
changes made permanent and all the resources occupied should be released. On
closing it deallocates all the internal descriptors that were created when the file
was opened.

9. Append operation:
This operation adds data to the end of the file.

10. Rename operation:


This operation is used to rename the existing file.

Types of File Systems | FAT | FAT32 | NTFS

Everything is stored as files in a computer system. The files can be data files or
application files. Each operating system has its own way of organizing data
internally. The operating system performs this management with the help of a
program called File System. The type of file system is used to determine how
data and programs are accessed. It also determines the level of accessibility
available to users.

The following are the different types of file systems.

FAT File System


FAT stands for “File Allocation Table”. The file allocation table is used
by the operating system to locate files on a disk. A file may be divided into
many sections and scattered around the disk due to fragmentation. FAT keeps
track of all pieces of a file. In DOS systems, FAT is stored after the boot sector.
The file system has been used since the advent of PC.

Features of FAT File System

Some important features of the FAT File System are as follows.

Naming convention

• FAT file system used by MS-DOS provides file name of only 8


characters long.
• FAT file system used by Windows 2000 supports long file name. The full
path of file including filename can be up to 255 characters long.
• File names can contain any character except “/ [] = , ^ ?a “”
• File names should begin with alphanumeric characters.
• File names can contain spaces and multiple periods. The characters after
the last period are treated as file extension.

Security

FAT does not support local and folder security. A user logged on to a computer
locally has full access to the files and folders in FAT partitions of the computer.

Quick Access to files

FAT provides quick access to files. The speed of file access depends on file
type, file size, partition size, fragmentation, and the number of files in a folder.

FAT32 File System


FAT32 is an advanced version of the FAT file system. It can be used on
drives from 512 MB to 2TB in size. One of the most important features of FAT
and FAT32 is that they offer compatibility with operating systems other than
Windows 2000 also.

Features of FAT32 File System

FAT32 has the following features.

Partition size

FAT32 increases the number of bits used to address clusters. A cluster is a set of
sectors. It reduces the size of each cluster. It supports a larger disk (up to 2TB)
and better storage efficiency.

Access Speed

FAT32 provides good file access in partition sizes less than 500 MB or greater
than 2 GB. It provides better disk space utilization.

NTFS File System


NTFS stands for “New Technology File System”. Windows 2000
professional fully supports NTFS. It has the following characteristics.
Features of NTFS File System

The following are some of the main features of NTFS File System.

Naming Conventions
• File names can be up to 255 characters
• File names can contain most characters except “ / < > * | :
• File names are not case sensitive

Security
NTFS provides file and folder security. Files and folders are safer than FAT.
Security is maintained by assigning NTFS permissions to files and folders.
Security is maintained at the local level and the network level. The permissions
can be assigned to individual files and folders. Each file or folder in an NTFS
partition has an Access Control List. It contains the users and group security
identifier (SID) and the privileges granted to them.

Partition Size
The NTFS partition and file sizes are much bigger than FAT partitions and files.
The maximum size of an NTFS partition or file can be 16 Exabyte. However,
the practical limitation is two Terabytes. The file size can be in the range of
4GB to 64GB.

File compression
NTFS provides file compression of as much as 50%.

High reliability
NTFS is highly reliable. It is a recoverable file system. It uses transaction logs
to update the file and folders logs automatically. The system also has a great
amount of fault tolerance. It means that if the transaction fails due to power or
system failure, the logged transactions are used to recover the data.

Bad cluster Mapping


NTFS supports bad-cluster mapping. It means that the file system detects bad
clusters or areas of the disk with errors. If there is any data in those clusters, it is
retrieved and stored in another area. The bad clusters are marked to prevent data
storage in those areas in the future.

File Access Mechanisms


File access mechanism refers to the manner in which the records of a file may
be accessed. There are several ways to access files −

• Sequential access
• Direct/Random access
• Indexed sequential access

Sequential access
A sequential access is that in which the records are accessed in some
sequence, i.e., the information in the file is processed in order, one record after
the other. This access method is the most primitive one. Example: Compilers
usually access files in this fashion.

Direct/Random access
• Random access file organization provides, accessing the records directly.
• Each record has its own address on the file with by the help of which it
can be directly accessed for reading or writing.
• The records need not be in any sequence within the file and they need not
be in adjacent locations on the storage medium.

Indexed sequential access


• This mechanism is built up on base of sequential access.
• An index is created for each file which contains pointers to various
blocks.
• Index is searched sequentially and its pointer is used to access the file
directly.

Space Allocation

Files are allocated disk spaces by operating system. Operating systems deploy
following three main ways to allocate disk space to files.

• Contiguous Allocation
• Linked Allocation
• Indexed Allocation

Contiguous Allocation

• Each file occupies a contiguous address space on disk.


• Assigned disk address is in linear order.
• Easy to implement.
• External fragmentation is a major issue with this type of allocation
technique.

Linked Allocation

• Each file carries a list of links to disk blocks.


• Directory contains link / pointer to first block of a file.
• No external fragmentation
• Effectively used in sequential access file.
• Inefficient in case of direct access file.

Indexed Allocation

• Provides solutions to problems of contiguous and linked allocation.


• A index block is created having all pointers to files.
• Each file has its own index block which stores the addresses of disk space
occupied by the file.
• Directory contains the addresses of index blocks of files.

Structures of Directory in Operating System

A directory is a container that is used to contain folders and files. It organizes


files and folders in a hierarchical manner.
There are several logical structures of a directory, these are given below.

• Single-level directory –
The single-level directory is the simplest directory structure. In it, all files
are contained in the same directory which makes it easy to support and
understand.

A single level directory has a significant limitation, however, when the


number of files increases or when the system has more than one user.
Since all the files are in the same directory, they must have a unique
name. if two users call their dataset test, then the unique name rule
violated.

Advantages:

• Since it is a single directory, so its implementation is very easy.


• If the files are smaller in size, searching will become faster.
• The operations like file creation, searching, deletion, updating are very
easy in such a directory structure.

Disadvantages:

• There may chance of name collision because two files can have the same
name.
• Searching will become time taking if the directory is large.
• This can not group the same type of files together.
Two-level directory –
As we have seen, a single level directory often leads to confusion of files names
among different users. the solution to this problem is to create a separate
directory for each user.

In the two-level directory structure, each user has their own user files directory
(UFD). The UFDs have similar structures, but each lists only the files of a
single user. system’s master file directory (MFD) is searches whenever a new
user id=s logged in. The MFD is indexed by username or account number, and
each entry points to the UFD for that user.

Advantages:

• We can give full path like /User-name/directory-name/.


• Different users can have the same directory as well as the file name.
• Searching of files becomes easier due to pathname and user-grouping.

Disadvantages:

• A user is not allowed to share files with other users.


• Still, it not very scalable, two files of the same type cannot be grouped
together in the same user.
Tree-structured directory –
Once we have seen a two-level directory as a tree of height 2, the natural
generalization is to extend the directory structure to a tree of arbitrary height.
This generalization allows the user to create their own subdirectories and to
organize their files accordingly.

A tree structure is the most common directory structure. The tree has a root
directory, and every file in the system has a unique path.

Advantages:

• Very general, since full pathname can be given.


• Very scalable, the probability of name collision is less.
• Searching becomes very easy, we can use both absolute paths as well as
relative.
Disadvantages:

• Every file does not fit into the hierarchical model, files may be saved into
multiple directories.
• We can not share files.
• It is inefficient, because accessing a file may go under multiple
directories.

Acyclic graph directory –


An acyclic graph is a graph with no cycle and allows us to share subdirectories
and files. The same file or subdirectories may be in two different directories. It
is a natural generalization of the tree-structured directory.

It is used in the situation like when two programmers are working on a joint
project and they need to access files. The associated files are stored in a
subdirectory, separating them from other projects and files of other
programmers since they are working on a joint project so they want the
subdirectories to be into their own directories. The common subdirectories
should be shared. So here we use Acyclic directories.

It is the point to note that the shared file is not the same as the copy file. If any
programmer makes some changes in the subdirectory it will reflect in both
subdirectories.
Advantages:

• We can share files.


• Searching is easy due to different-different paths.

Disadvantages:

• We share the files via linking, in case deleting it may create the problem,
• If the link is a soft link then after deleting the file we left with a dangling
pointer.
• In the case of a hard link, to delete a file we have to delete all the
references associated with it.

General graph directory structure –


In general graph directory structure, cycles are allowed within a directory
structure where multiple directories can be derived from more than one parent
directory.
The main problem with this kind of directory structure is to calculate the total
size or space that has been taken by the files and directories.

Advantages:

• It allows cycles.
• It is more flexible than other directories structure.

Disadvantages:

• It is more costly than others.


• It needs garbage collection.
MODULE IV

Disk Management in Operating System: Structure, Disk Scheduling algorithms


(FCFS, SSTF, SCAN, C-SCAN, LOOK, C-LOOK), swap space management,
Disk Reliability, Recovery.

Security:- Security Threats, Security Policy mechanism, Protection, trusted


systems, Authentication and internal access authorization, windows security.

Disk Management in Operating System

The range of services and add-ons provided by modern operating systems is


constantly expanding, and four basic operating system management functions
are implemented by all operating systems. These management functions are
briefly described below and given the following overall context. The four main
operating system management functions (each of which are dealt with in more
detail in different places) are:

• Process Management
• Memory Management
• File and Disk Management
• I/O System Management

Most computer systems employ secondary storage devices (magnetic disks).


It provides low-cost, non-volatile storage for programs and data (tape, optical
media, flash drives, etc.). Programs and the user data they use are kept on
separate storage devices called files. The operating system is responsible for
allocating space for files on secondary storage media as needed.
There is no guarantee that files will be stored in contiguous locations on
physical disk drives, especially large files. It depends greatly on the amount of
space available. When the disc is full, new files are more likely to be recorded
in multiple locations. However, as far as the user is concerned, the example file
provided by the operating system hides the fact that the file is fragmented into
multiple parts.
The operating system needs to track the location of the disk for every part of
every file on the disk. In some cases, this means tracking hundreds of thousands
of files and file fragments on a single physical disk. Additionally, the operating
system must be able to locate each file and perform read and write operations on
it whenever it needs to. Therefore, the operating system is responsible for
configuring the file system, ensuring the safety and reliability of reading and
write operations to secondary storage, and maintains access times (the time
required to write data to or read data from secondary storage).

Disk management of the operating system includes:

• Disk Format
• Booting from disk
• Bad block recovery

The low-level format or physical format:


Divides the disk into sectors before storing data so that the disk controller
can read and write Each sector can be:
The header retains information, data, and error correction code (ECC)
sectors of data, typically 512 bytes of data, but optional disks use the operating
system’s own data structures to preserve files using disks.

It is conducted in two stages:

1. Divide the disc into multiple cylinder groups. Each is treated as a logical
disk.
2. Logical format or “Create File System”. The OS stores the data structure of
the first file system on the disk. Contains free space and allocated space.
For efficiency, most file systems group blocks into clusters. Disk I / O
runs in blocks. File I / O runs in a cluster.

Boot block:
• When the computer is turned on or restarted, the program stored in the
initial bootstrap ROM finds the location of the OS kernel from the disk,
loads the kernel into memory, and runs the OS. start.
• To change the bootstrap code, you need to change the ROM and
hardware chip. Only a small bootstrap loader program is stored in
ROM instead.
• The full bootstrap code is stored in the “boot block” of the disk.
• A disk with a boot partition is called a boot disk or system disk.
Bad Blocks:

• Disks are error-prone because moving parts have small tolerances.


• Most disks are even stuffed from the factory with bad blocks and are
handled in a variety of ways.
• The controller maintains a list of bad blocks.
• The controller can instruct each bad sector to be logically replaced with
one of the spare sectors. This scheme is known as sector sparing or
transfer.
• A soft error triggers the data recovery process.
• However, unrecoverable hard errors may result in data loss and require
manual intervention.

Disk Scheduling Algorithms

Disk scheduling is done by operating systems to schedule I/O requests arriving


for the disk. Disk scheduling is also known as I/O scheduling.

Disk scheduling is important because:

• Multiple I/O requests may arrive by different processes and only one I/O
request can be served at a time by the disk controller. Thus other I/O
requests need to wait in the waiting queue and need to be scheduled.
• Two or more request may be far from each other so can result in greater
disk arm movement.
• Hard drives are one of the slowest parts of the computer system and thus
need to be accessed in an efficient manner.

There are many Disk Scheduling Algorithms but before discussing them let’s
have a quick look at some of the important terms:

• Seek Time:Seek time is the time taken to locate the disk arm to a
specified track where the data is to be read or write. So the disk
scheduling algorithm that gives minimum average seek time is better.
• Rotational Latency: Rotational Latency is the time taken by the desired
sector of disk to rotate into a position so that it can access the read/write
heads. So the disk scheduling algorithm that gives minimum rotational
latency is better.
• Transfer Time: Transfer time is the time to transfer the data. It depends
on the rotating speed of the disk and number of bytes to be transferred.
• Disk Access Time: Disk Access Time is:

Disk Access Time = Seek Time +


Rotational Latency +
Transfer Time

• Disk Response Time: Response Time is the average of time spent by a


request waiting to perform its I/O operation. Average Response time is the
response time of the all requests. Variance Response Time is measure of
how individual request are serviced with respect to average response
time. So the disk scheduling algorithm that gives minimum variance
response time is better.

Disk Scheduling Algorithms

• FCFS Scheduling

• SSTF(Shortest Seek Time First) Scheduling

• SCAN Scheduling

• C-SCAN Scheduling
• LOOK Scheduling

• C- LOOK Scheduling

FCFS Disk Scheduling Algorithm

FCFS (First-Come-First-Serve) is the easiest disk scheduling algorithm among


all the scheduling algorithms. In the FCFS disk scheduling algorithm, each
input/output request is served in the order in which the requests arrive. In this
algorithm, starvation does not occur because FCFS address each request.

Advantages of FCFS Disk scheduling Algorithm

The advantages of FCFS disk scheduling algorithm are:

1. In FCFS disk scheduling, there is no indefinite delay.


2. There is no starvation in FCFS disk scheduling because each request gets
a fair chance.

Disadvantages of FCFS Disk Scheduling Algorithm

The disadvantages of FCFS disk scheduling algorithm are:

1. FCFS scheduling is not offered as the best service.


2. In FCFS, scheduling disk time is not optimized.

Example of FCFS Disk Scheduling Algorithm

Suppose a disk contains 200 tracks (0-199) and the request queue contains track
no: 93, 176, 42, 148, 27, 14,180. The current position of the read/write head is
55. Now we have to calculate the total number of track movements of read/write
head using FCFS scheduling.

Solution

As mentioned in the following example, the disk contains 200 tracks, so we take
a track line between 0 to 199.
The current position of the read/write head is 55. So, we start from 55, then
move read/write head in the FCFS order. When all the requests are addressed,
then we calculate a total number of cylinders moved by the head.

Figure: FCFS Disk Scheduling

Total Number of cylinders moved by the head = (176-55) + (176-42) + (148-42)


+ (148-14) + (180-14)

= 121+134+106+134+166

=661

SSTF (Shortest Seek Time First) Disk Scheduling Algorithm

SSTF is another type of scheduling algorithm. In this type of disk scheduling,


the job which has less seek time will be executed first. So, in SSTF (shortest
seek time first) scheduling, we have to calculate the seek time first. and after
calculating the seek time, each request will be served on the basis of seek time.
The request which is close to the disk arm will be first executed. There are some
drawbacks in FCFS. To overcome the limitations that arise in the FCFS. SSTF
scheduling is implemented.

Advantages of SSTF Disk Scheduling

The advantages of SSTF disk scheduling are:


1. In SSTF disk scheduling, the average response time is decreased.
2. Increased throughput.

Disadvantages of SSTF Disk Scheduling

The disadvantages of SSTF disk scheduling are:

1. In SSTF, there may be a chance of starvation.


2. SSTF is not an optimal algorithm.
3. There are chances of overhead in SSTF disk scheduling because, in this
algorithm, we have to calculate the seek time in advanced.
4. The speed of this algorithm can be decreased because direction could be
switched frequently.

Example of SSTF Disk Scheduling

Consider a disk that contains 200 tracks (0-199). The request queue includes
track number 82, 170, 43, 140, 24, 16, 190, respectively. The current position of
the read/write head is 50.

Solution

Before solving the above example, we have to know about the seek time.

Seek Time: -Seek time is the time required to move the desired track.

To find the seek time, we can use this simple formula.

seek time = Destination – Source

or

= Source - Destination

Now, we can solve the given example.

As mentioned in the following example, disk contains 200 tracks. So, we will
take a track line between 0 to 199. The current position of the read/write head is
50. So, we start at 50.
Figure: SSTF Disk Scheduling

We can see in the following figure that the current or initial position of
read/write head is 50. Now for further movement of read/write head, we
calculate the seek time.

Total Number of cylinders moved by the head = (50-16) + (190-16)

= 208

SCAN Disk Scheduling Algorithm

The SCAN disk scheduling algorithm is another type of disk scheduling


algorithm. In this algorithm, we move the disk arm into a specific direction
(direction can be moved towards large value or the smallest value). Each
request is addressed that comes in its path, and when it comes into the end of
the disk, then the disk arm will move reverse, and all the requests are addressed
that are arriving in its path. Scan disk scheduling algorithm is also called an
elevator algorithm because its working is like an elevator.

Advantages of SCAN Disk Scheduling Algorithm

The advantages of SCAN disk scheduling algorithm are:

1. In SCAN disk scheduling, there is a low variance of response time.


2. In this algorithm, throughput is high.
3. Response time is average.
4. In SCAN disk scheduling, there is no starvation.
Disadvantages of SCAN Disk Scheduling Algorithm

The disadvantages of SCAN disk scheduling algorithm are:

1. SCAN disk scheduling algorithm takes long waiting time for the
cylinders, just visited by the head.
2. In SCAN disk scheduling, we have to move the disk head to the end of
the disk even when we don’t have any request to service.

Example of SCAN Disk Scheduling Algorithm

Consider a disk containing 200 tracks (0-199) and the request queue includes
the track number 93, 176, 42, 148, 27, 14, 180, respectively. The current
position of read//write head is 55, and direction is towards the larger value.
Calculate the total number of cylinders moved by the head using SCAN disk
scheduling.

Solution

As mentioned in the following example, the disk contains 200 tracks. So, we
take a track line between 0 to 199.

The current position of the read/write head is 55. So, we start at 55, then move
the read/write head. When all the requests are addressed, then we calculate a
total number of cylinders moved by the head.
Figure: SCAN Disk Scheduling

Total Number of cylinders moved by head = (199-50) + (199-14)

= 329

C-SCAN Disk Scheduling Algorithm

C-SCAN stands for Circular-SCAN. C-SCAN is an enhanced version of SCAN


disk scheduling. In the C-SCAN disk scheduling algorithm, the disk head starts
to move at one end of the disk and moves towards the other end and service the
requests that come in its path and reach another end. After doing this, the
direction of the head is reversed. The head reaches the first end without
satisfying any request and then it goes back and services the requests which are
remaining.

Advantages of C-SCAN Disk Scheduling Algorithm

The advantages of the C-SCAN disk scheduling algorithm are:

1. C-SCAN offers better uniform waiting time.


2. It offers a better response time.
Disadvantages of C-SCAN Disk Scheduling Algorithm

1. In C-SCAN disk scheduling, there are more seek movements as


compared to SCAN disk scheduling.
2. In C-SCAN disk scheduling, we have to move the disk head to the end of
the disk even when we don’t have any request to service.

Example of C-SCAN Disk Scheduling Algorithm

Consider, a disk contains 200 tracks (0-199) and the request queue contains
track number 82, 170, 43, 140, 24, 16,190, respectively. The current position of
R/W head is 50, and the direction is towards the larger value. Calculate the total
number of cylinders moved by head using C-SCAN disk scheduling.

Solution

As mentioned in the following example, the disk contains 200 tracks. So, we
take a track line between 0 to 199.

The current position of the read/write head is 50. So we start at 50, then move
the read/write head based on the direction. Here, we move towards the larger
value as given in the question. When all the requests are addressed, then we
calculate a total number of cylinders moved by the head.

Figure: C-SCAN Disk Scheduling


Total Number of cylinders moved by head = (199-50) + (199-
0) + (43-0)

= 149+199+43

= 391

Look Disk Scheduling

Look disk scheduling is another type of disk scheduling algorithm. Look


scheduling is an enhanced version of SCAN disk scheduling. Look disk
scheduling is the same as SCAN disk scheduling, but in this scheduling, instead
of going till the last track, we go till the last request and then change the
direction.

Advantages of Look Disk Scheduling

The advantages of look disk scheduling are:

1. In Look disk scheduling, there is no starvation.


2. Look disk scheduling offers low variance in waiting time and response
time.
3. Look disk scheduling offers better performance as compared to the
SCAN disk scheduling.
4. In look disk scheduling, there is no requirement of disk head to move till
the end to the disk when we do not have any request to be serviced.

Disadvantages of Look Disk Scheduling

The disadvantages of Look disk scheduling are:

1. In look disk scheduling, there is more overhead to find the end request.
2. Look disk scheduling is not used in case of more load.

Example of Look Disk Scheduling

Consider a disk contains 200 tracks (0-100). The request queue includes track
number 82, 170, 43, 140, 24, 16, 190, respectively. The current position of the
read/write head is 50. The direction is towards the larger value. Calculate the
total number of cylinders moved by head using look disk scheduling.
Solution:

As mentioned in the following example, disk contains 200 tracks, so we take a


track line between 0 to 199.

The current position of the read/write head is 50, So we start at 50, then we
move the read/write head. (the disk head is moved towards the larger value as
mentioned in the given example). When all the requests are addressed, then we
calculate the total number of cylinders moved by the head.

Figure: Look Disk Scheduling

Total number of cylinders moved by the head = (190-50) + (190-16)

= 314

C-Look Disk Scheduling

C-look means circular-look. It takes the advantages of both the disk scheduling
C-SCAN, and Look disk scheduling. In C-look scheduling, the disk arm moves
and service each request till the head reaches its highest request, and after that,
the disk arm jumps to the lowest cylinder without servicing any request, and the
disk arm moves further and service those requests which are remaining.
Advantages of C-Look Disk Scheduling

The advantages of C-look disk scheduling are:

1. There is no starvation in C-look disk scheduling.


2. The performance of the C-Look scheduling is better than Look disk
scheduling.
3. C-look disk scheduling offers low variance in waiting time and response
time.

Disadvantages of C-Look Disk Scheduling

The disadvantages of C-Look disk scheduling are:

1. In C-Look disk scheduling there may be more overhead to determine the


end request.
2. There is more overhead in calculations.

Example of C-Look Disk Scheduling

Consider a disk containing 200 tracks (0-100). The request queue contains the
track number 93, 176, 42, 148, 27, 14,183 respectively. The current position of
the R/W head is 55. The direction is towards the larger value. Calculate the total
number of cylinders moved by head using look disk scheduling.

Solution:

As mentioned in the following example, disk contains 200 tracks, so we take a


track line between 0 to 199.

The current position of the read/write head is 55, So we start at 55, then we
move the read/write head (the disk head is moved towards the larger value as
mentioned in the given example). When all the requests are addressed, then we
calculate the total number of cylinders moved by the head.
Figure: C-Look Disk Scheduling

Total number of cylinders moved by the head = (180-55) + (180-14) + (42-


14)

= 125 + 166 + 28

= 319

Swap-Space Management in Operating System

A computer has a sufficient amount of physical memory, but we need


more, so we swap some memory on disk most of the time. Swap space is a
space on a hard disk that is a substitute for physical memory. It is used as virtual
memory, which contains process memory images. Whenever our computer runs
short of physical memory, it uses its virtual memory and stores information in
memory on a disk.
This interchange of data between virtual memory and real memory is
called swapping and space on disk as swap space. Swap space helps the
computer's operating system pretend that it has more RAM than it actually has.
It is also called a swap file.
Virtual memory is a combination of RAM and disk space that running
processes can use. Swap space is the portion of virtual memory on the hard
disk, used when RAM is full. Swap space can be useful to computers in the
following various ways, such as:

• It can be used as a single contiguous memory which reduces I/O


operations to read or write a file.
• Applications that are not used or less used can be kept in a swap file.
• Having sufficient swap files helps the system keep some physical
memory free all the time.
• The space in physical memory that has been freed due to swap space can
be used by OS for other important tasks.

Operating systems such as Windows, Linux, etc. systems provide a


certain amount of swap space by default which users can change according to
their needs. If you don't want to use virtual memory, you can easily disable it
together. Still, if you run out of memory, then the kernel will kill some of the
processes to create a sufficient amount of space in physical memory so that it
totally depends upon the user whether he wants to use swap space or not.
What is Swap-Space Management?
Swap-space management is another low-level task of the operating
system. Virtual memory uses disk space as an extension of main memory. Since
disk access is much slower than memory access, using swap space significantly
decreases system performance. The main goal for the design and
implementation of swap space is to provide the best throughput for the virtual
memory system.
Swap space is used in various ways by different operating systems,
depending on the memory-management algorithms in use. For example,
systems that implement swapping may use swap space to hold an entire process
image, including the code and data segments. Paging systems may simply store
pages that have been pushed out of the main memory. The amount of swap
space needed on a system can vary depending on the amount of physical
memory, the amount of virtual memory it is backing, and how it is used. It can
range from a few megabytes of disk space to gigabytes.
Note that it may be safer to overestimate than to underestimate the
amount of swap space required because if a system runs out of swap space, it
may be forced to abort processes or may crash entirely. Overestimation wastes
disk space that could otherwise be used for files, but it does no other harm.
Some systems recommend the amount to be set aside for swap space. Solaris,
for example, suggests setting swap space equal to the amount by which virtual
memory exceeds page-able physical memory. Previously, Linux suggested
setting swap space to double the amount of physical memory, although most
Linux systems now use considerably less swap space. There is currently much
debate in the Linux community about whether to set aside swap space at all.
Some operating systems, including Linux, allow multiple swap spaces.
These swap spaces are usually put on separate disks so the load placed on the
I/O system by paging and swapping can be spread over the system's I/O devices.
Uses of Swap Space
The different operating system uses Swap-space in various ways. The
systems that are implementing swapping may use swap space to hold the entire
process, including image, code, and data segments.
Swapping is a memory management technique used in multi-
programming to increase the number of processes sharing the CPU. It is a
technique of removing a process from the main memory, storing it into
secondary memory, and then bringing it back into the main memory for
continued execution. This action of moving a process out from main memory to
secondary memory is called Swap Out. The action of moving a process out from
secondary memory to main memory is called Swap In.
Paging systems may simply store pages that have been pushed out of the
main memory. The need for swap space on a system can vary from megabytes
to gigabytes. Still, it also depends on the amount of physical memory, the
virtual memory it is backing, and how it uses the virtual memory.
It is safer to overestimate than to underestimate the amount of swap space
required because if a system runs out of swap space, it may be forced to abort
the processes or may crash entirely. Overestimation wastes disk space that could
be used for files, but it does not harm others. The following table shows
different systems using the amount of swap space:
S S
Swap Space
.No. ystem
1 S Swap space is equal to the amount of physical
. olaris memory.
2 L Swap space is double the amount of physical
. inux memory.
Solaris setting swap space equal to the amount by which virtual memory
exceeds page-able physical memory. Previously, Linux has suggested setting
swap space to double the amount of physical memory. Today, this limitation is
gone, and most Linux systems use considerably less swap space.
Including Linux, some operating systems allow the use of multiple swap
spaces, including both files and dedicated swap partitions. The swap spaces are
placed on the disk, so the load on the I/O by the paging and swapping will
spread over the system's bandwidth.
Where does the Swap Space Reside?

Swap space can reside in one of these two places: The normal file system or
Separate disk partition.

If the swap space is simply a large file within the file system, normal file-
system routines can be used to create, name, and allocate its space. This
approach, though easy to implement, is inefficient. Navigating the directory
structure and a disk-allocation data structure takes extra disk access.
External fragmentation can greatly increase swapping times by forcing
multiple seeks during the reading or writing of a process image. We can
improve performance by caching the block location information in physical
memory and by using special tools to allocate physically contiguous blocks for
the swap file. However, the cost of traversing the file-system data structures still
remains.
Alternatively, swap space can be created in a separate raw partition, as no
file system or directory structure is placed in this space. Rather, a separate
swap-space storage manager is used to allocate and deallocate the blocks from
the raw partition. This manager uses algorithms optimized for speed rather than
storage efficiency because swap space is accessed more frequently than file
systems.
Internal fragmentation may increase, but this trade-off is acceptable
because the life of data in the swap space generally is much shorter than that of
files in the file system. Swap space is reinitialized at boot time, so any
fragmentation is short-lived. This approach creates a fixed amount of swap
space during disk partitioning. Adding more swap space requires repartitioning
the disk or adding another swap space elsewhere.

Some operating systems are flexible and can swap both in raw partitions and
file-system space, such as Linux. The policy and implementation are separate,
allowing the machine's administrator to decide which type of swapping to use.
The trade-off is between the convenience of allocation and management in the
file system and swapping performance in raw partitions.

Allocation of Swap Space

Management appliances allocate a specific amount of swap space based on the


size of the appliance's memory and are restricted by the amount of available
disk space.

The amount of swap space that a virtual machine requires is double the size of
its RAM. This amount provides enough space for data that is no longer required
by RAM to be placed in the swap space. In addition, there is enough space for
emergencies where RAM needs to be cleared due to hypervisor demands.

The Management appliance cannot allocate all of the space from a data disk to
swap space, as space is required for databases. The Management appliance
follows a specific set of conditions when it allocates swap space. These
conditions are as follows:

1. The maximum amount of work-in-progress partition that can be dedicated


to swap space is 25%.
2. When the Management appliance increases the swap space size, the swap
size does not increase by more than 20% at a single instance. The
maximum increase of 20% in one instance enables Informix and analytics
to allocate their disk spaces during the boot process.
3. You can allocate more data disk space by adding a new data disk to a
Management appliance.
4. You can increase the size of your code disk by following the procedure of
increasing code disk size for appliances.
Example of Swap Space Management

The traditional UNIX kernel started with swapping that copied the entire
process between contiguous disk regions and memory. UNIX later evolved to a
combination of swapping and paging as paging hardware became available.

In Solaris 1, the designers changed standard UNIX methods to improve


efficiency.

• When a process executes, text-segment pages containing code are brought


in from the file system, accessed in main memory, and thrown away if
selected for page out.
• It is more efficient to reread a page from the file system than write it to
swap space and then reread it.
• Swap space is only used as a backing store for anonymous memory
pages, including memory allocated for the stack, heap, and uninitialized
process data.

More changes were made in later versions of Solaris. The biggest change is that
Solaris now allocates swap space only when a page is forced out of physical
memory rather than when the virtual memory page is first created. This scheme
gives better performance on modern computers, which have more physical
memory than older systems.

Linux is almost similar to the Solaris system. The swap space is used only for
anonymous memory or for regions of memory shared by several processes in
both systems. In the Linux system, one or more swap areas can be established.
• A swap area may be in a swap file on a regular file system or a dedicated
file partition.
• Each swap area consists of 4-KB page slots used to hold the swapped
pages.
• An array of integers counters associated with each swap area is a swap-
map corresponding to a page slot in the swap area.
• If the value of a counter is 0, the corresponding page slot is available.
• If the values are greater than 0, it indicates that a swapped page occupies
the page slot.
• The value of the counter indicates the number of mappings to the
swapped page. For example, a value of 3 indicates that the swapped page
is mapped to the 3 different processes.

Security

Security refers to providing a protection system to computer system resources


such as CPU, memory, disk, software programs and most importantly
data/information stored in the computer system. If a computer program is run by
an unauthorized user, then he/she may cause severe damage to computer or data
stored in it. So a computer system must be protected against unauthorized
access, malicious access to system memory, viruses, worms etc.

• Authentication
• One Time passwords
• Program Threats
• System Threats
• Computer Security Classifications

Authentication

Authentication refers to identifying each user of the system and associating the
executing programs with those users. It is the responsibility of the Operating
System to create a protection system which ensures that a user who is running a
particular program is authentic. Operating Systems generally
identifies/authenticates users using following three ways −
• Username / Password − User need to enter a registered username and
password with Operating system to login into the system.
• User card/key − User need to punch card in card slot, or enter key
generated by key generator in option provided by operating system to
login into the system.
• User attribute - fingerprint/ eye retina pattern/ signature − User need
to pass his/her attribute via designated input device used by operating
system to login into the system.

One Time passwords

One-time passwords provide additional security along with normal


authentication. In One-Time Password system, a unique password is required
every time user tries to login into the system. Once a one-time password is used,
then it cannot be used again. One-time password are implemented in various
ways.

• Random numbers − Users are provided cards having numbers printed


along with corresponding alphabets. System asks for numbers
corresponding to few alphabets randomly chosen.
• Secret key − User are provided a hardware device which can create a
secret id mapped with user id. System asks for such secret id which is to
be generated every time prior to login.
• Network password − Some commercial applications send one-time
passwords to user on registered mobile/ email which is required to be
entered prior to login.

Program Threats

Operating system's processes and kernel do the designated task as instructed. If


a user program made these process do malicious tasks, then it is known as
Program Threats. One of the common example of program threat is a program
installed in a computer which can store and send user credentials via network to
some hacker. Following is the list of some well-known program threats.

• Trojan Horse − Such program traps user login credentials and stores
them to send to malicious user who can later on login to computer and
can access system resources.
• Trap Door − If a program which is designed to work as required, have a
security hole in its code and perform illegal action without knowledge of
user then it is called to have a trap door.
• Logic Bomb − Logic bomb is a situation when a program misbehaves
only when certain conditions met otherwise it works as a genuine
program. It is harder to detect.
• Virus − Virus as name suggest can replicate themselves on computer
system. They are highly dangerous and can modify/delete user files, crash
systems. A virus is generatlly a small code embedded in a program. As
user accesses the program, the virus starts getting embedded in other
files/ programs and can make system unusable for user

System Threats

System threats refers to misuse of system services and network connections to


put user in trouble. System threats can be used to launch program threats on a
complete network called as program attack. System threats creates such an
environment that operating system resources/ user files are misused. Following
is the list of some well-known system threats.

• Worm − Worm is a process which can choked down a system


performance by using system resources to extreme levels. A Worm
process generates its multiple copies where each copy uses system
resources, prevents all other processes to get required resources. Worms
processes can even shut down an entire network.
• Port Scanning − Port scanning is a mechanism or means by which a
hacker can detects system vulnerabilities to make an attack on the system.
• Denial of Service − Denial of service attacks normally prevents user to
make legitimate use of the system. For example, a user may not be able to
use internet if denial of service attacks browser's content settings.

Computer Security Classifications

As per the U.S. Department of Defense Trusted Computer System's Evaluation


Criteria there are four security classifications in computer systems: A, B, C, and
D. This is widely used specifications to determine and model the security of
systems and of security solutions. Following is the brief description of each
classification.
S.N. Classification Type & Description
Type A
1
Highest Level. Uses formal design specifications and verification
techniques. Grants a high degree of assurance of process security.
Type B

Provides mandatory protection system. Have all the properties of a class


C2 system. Attaches a sensitivity label to each object. It is of three types.

• B1 − Maintains the security label of each object in the system. Label


2 is used for making decisions to access control.
• B2 − Extends the sensitivity labels to each system resource, such as
storage objects, supports covert channels and auditing of events.
• B3 − Allows creating lists or user groups for access-control to grant
access or revoke access to a given named object.

Type C

Provides protection and user accountability using audit capabilities. It is of


two types.

3 • C1 − Incorporates controls so that users can protect their private


information and keep other users from accidentally reading /
deleting their data. UNIX versions are mostly Cl class.
• C2 − Adds an individual-level access control to the capabilities of a
Cl level system.

Type D
4 Lowest level. Minimum protection. MS-DOS, Window 3.1 fall in this
category.
MODULE V

Linux: Introduction, history and features of Linux, advantages, hardware


requirements for installation, Linux architecture, file system of Linux -
boot block, super block, inode table, data blocks.
Linux standard directories, Linux kemel, Partitioning the hard drive for
Linux, installing the Linux System, system - startup and shut-down
process, init and run levels. Process, Swap, Partition, fdisk, checking disk
free spaces. Difference between CLI OS & GUI OS, Windows v/s Linux,
Importance of Linux kernel, Files and Directories. Concept of Open Source
software.

Introduction:-

Linux is an open-source operating system like other operating systems such as


Microsoft Windows, Apple Mac OS, iOS, Google android, etc. An operating
system is a software that enables the communication between computer
hardware and software. It conveys input to get processed by the processor and
brings output to the hardware to display it. This is the basic function of an
operating system. Linux looks and feels much like any other UNIX systems.
However UNIX OS is much more older than Linux OS. Its development began
in 1991 when a Finnish student Linus Torvalds wrote a small bur self contained
kernel for the first 32 bit processor in the Intel’s range of PC compatible CPU
known as 80386 processor.

Early in its development, source code of Linux was made available for free on
the internet. As a result, its history has been one of the collaboration by many
users from all around the world. From an initial kernel that partially
implemented a small subset of the UNIX system services. Linux has grown to
include evermore UNIX functionality.

The basic Linux system is a standard environment for applications and for user
programming, but it does not enforce any standard means of managing the
available functionality as a whole. As Linux has matured, there has been a need
for another layer of functionality on top of the Linux system. A Linux
distribution includes all the standard components of Linux system plus a set of
administrative tools to simplify the initial installation and subsequent upgrading
of Linux and to manage installation and deinstallation of other packages on the
system. A modern distribution also typically includes tools for management of
file system, creation and management of user accounts, networking
administration and so on.

Linux OS is around us since the mid-90s. It can be used from wristwatches to


supercomputers. It is everywhere in our phones, laptops, PCs, cars and even in
refrigerators. It is very much famous among developers and normal computer
users.

Linux Features

o Multiuser capability: Multiple users can access the same system


resources like memory, hard disk, etc. But they have to use different
terminals to operate.
o Multitasking: More than one function can be performed simultaneously
by dividing the CPU time intelligently.
o Portability: Portability doesn't mean it is smaller in file size or can be
carried in pen drives or memory cards. It means that it support different
types of hardware.
o Security: It provides security in three ways namely authenticating (by
assigning password and login ID), authorization (by assigning permission
to read, write and execute) and encryption (converts file into an
unreadable format).
o Live CD/USB: Almost all Linux distributions provide live CD/USB so
that users can run/try it without installing it.
o Graphical User Interface (X Window system): Linux is command line
based OS but it can be converted to GUI based by installing packages.
o Support's customized keyboard: As it is used worldwide, hence
supports different languages keyboards.
o Application support: It has its own software repository from where
users can download and install many applications.
o File System: Provides hierarchical file system in which files and
directories are arranged.
o Open Source: Linux code is freely available to all and is a community
based development project.
Advantages of Linux

Some of the advantages of the Linux operating system are as follows:

1. Open Source
One of the main advantages of Linux is that it is an open source operating
system i.e. its source code is easily available for everyone. Anyone capable of
coding can contribute, modify, enhance and distribute the code to anyone and
for any purpose.
2. Security
Linux is more secure in comparison to other operating systems such as
Windows. Linux is not completely secure as there is some malware for it also
but it is less vulnerable than others. Every program in Linux whether an
application or a virus needs authorization from the administrator in the form of
a password. Unless the password is typed virus won’t execute. There is no
requirement of any anti-virus program in Linux.
3. Revive older computer systems
Linux helps you to use or utilize your old and outdated computer systems as a
firewall, router, backup server or file server and many more. There are many
distributions available to use according to your system capability. As you can
use Puppy Linux for low- end systems.
4. Software Updates
In Linux you encounter a larger number of software updates. These software
updates are much faster than updates in any other operating system. Updates in
Linux can be done easily without facing any major issue or concern.
5. Customization
A feature that gives a major advantage over other operating systems is
customization. You can customize any feature, add or delete any feature
according to your need as it is an open source operating system. Not only this,
various wallpapers and attractive icon themes can be installed to give an
amazing look to your system.
6. Various Distributions
There are many distributions available also called distros of Linux. It provides
various choices or flavors to the users. You can select any bistros according to
your needs. Some bistros of Linux are Fedora, Ubuntu, Arch Linux, Debian,
Linux Mint and many more. If you are a beginner you can use Ubuntu or Linux
Mint. If you are a good programmer you may use Debian or Fedora.
7. Free to use (Low Cost)
Linux is freely available on the web to download and use. You do not need to
buy the license for it as Linux and many of its software come with GNU
General Public License. This proved to be one of the major advantages Linux
faces over Windows and other operating systems. You need to spend a huge
amount to buy the license of Windows which is not the case with Linux.
8. Large Community Support
Forums by excited users are made on the web to help and solve the problem any
other user is facing. There are a lot of dedicated programmers there to help you
out whenever and wherever possible.
9. Stability (Reliability)
Linux provides high stability also this is good advantage i.e. it does not need to
be rebooted after a short period of time. Your Linux system rarely slows down
or freezes. As in windows, you need to reboot your system after installing or
uninstalling an application or updating your software but this is not the case
with Linux. You can work without any disturbance on your Linux systems.
10. Privacy
Linux ensures the privacy of user’s data as it never collects much data from the
user while using its distributions or software but this is not true for many other
operating systems.
11. Performance
Linux provides high performance on various networks and workstations. It
allows a large number of users to work simultaneously and handles them
efficiently.
12. Network Support
Linux gives support for network functionality as it was written by programmers
over the internet. Linux helps you to set up client and server systems on your
computer systems easily and in a fast manner.
13. Flexibility
Linux provides a high range of flexibility as you can install only required
components. There is no need to install a full or complete suite. You can also
keep Linux file under multiple partitions so if one of them corrupts then there is
no major loss. You only need to repair that particular partition, not the complete
file which is not the case with other operating systems.
14. Compatibility
Linux runs or executes all possible file formats and is compatible with a large
number of file formats.
15. Fast and easy installation
Linux can be easily installed from the web and does not require any
prerequisites as it can run on any hardware, even on your oldest systems.
16. Proper use of Hard Disk
Linux performs all the tasks efficiently even after the hard disk is almost full.
This increases the performance of the Linux hence Linux provides high
performance also.
17. Multitasking
Linux is a multitasking operating system as it can perform many tasks
simultaneously without any decrease in its speed such as downloading a large
file would not slow down the system.
18. Run multiple desktops
Linux provides various desktop environments to make it easy to use. While
installing Linux you can choose any desktop environment according to your
wishes such as KDE (K Desktop Environment) or GNOME (GNU Network
Object Model Environment).

Structure Of Linux Operating System

An operating system is a collection of software, each designed for a specific


function.

Linux OS has following components:


1) Kernel

Linux kernel is the core part of the operating system. It establishes


communication between devices and software. Moreover, it manages system
resources. It has four responsibilities:
• device management: A system has many devices connected to it like
CPU, a memory device, sound cards, graphic cards, etc. A kernel stores
all the data related to all the devices in the device driver (without this
kernel won't be able to control the devices). Thus kernel knows what a
device can do and how to manipulate it to bring out the best performance.
It also manages communication between all the devices. The kernel has
certain rules that have to be followed by all the devices.
• Memory management: Another function that kernel has to manage is
the memory management. The kernel keeps track of used and unused
memory and makes sure that processes shouldn't manipulate data of each
other using virtual memory addresses.
• Process management: In the process, management kernel assigns
enough time and gives priorities to processes before handling CPU to
other processes. It also deals with security and ownership information.
• Handling system calls: Handling system calls means a programmer can
write a query or ask the kernel to perform a task.

2) System Libraries

System libraries are special programs that help in accessing the kernel's
features. A kernel has to be triggered to perform a task, and this triggering is
done by the applications. But applications must know how to place a system call
because each kernel has a different set of system calls. Programmers have
developed a standard library of procedures to communicate with the kernel.
Each operating system supports these standards, and then these are transferred
to system calls for that operating system.

The most well-known system library for Linux is Glibc (GNU C library).

3) System Tools

Linux OS has a set of utility tools, which are usually simple commands. It is a
software which GNU project has written and publish under their open source
license so that software is freely available to everyone.

With the help of commands, you can access your files, edit and manipulate data
in your directories or files, change the location of files, or anything.

4) Development Tools

With the above three components, your OS is running and working. But to
update your system, you have additional tools and libraries. These additional
tools and libraries are written by the programmers and are called toolchain. A
toolchain is a vital development tool used by the developers to produce a
working application.

5) End User Tools

These end tools make a system unique for a user. End tools are not required for
the operating system but are necessary for a user.

Some examples of end tools are graphic design tools, office suites, browsers,
multimedia players, etc.

Why use Linux?

This is one of the most asked questions about Linux systems. Why do we use a
different and bit complex operating system, if we have a simple operating
system like Windows? So there are various features of Linux systems that make
it completely different and one of the most used operating systems. Linux may
be a perfect operating system if you want to get rid of viruses, malware,
slowdowns, crashes, costly repairs, and many more. Further, it provides various
advantages over other operating systems, and we don't have to pay for it. Let's
have a look at some of its special features that will attract you to switch your
operating system.

Free & Open Source Operating System

Most OS come in a compiled format means the main source code has run
through a program called a compiler that translates the source code into a
language that is known to the computer.

Modifying this compiled code is a tough job.

On the other hand, open-source is completely different. The source code is


included with the compiled version and allows modification by anyone having
some knowledge. It gives us the freedom to run the program, freedom to change
the code according to our use, freedom to redistribute its copies, and freedom to
distribute copies, which are modified by us.

In short, Linux is an operating system that is "for the people, by the people."

And we can dive in Linux without paying any cost. We can install it on Multiple
machines without paying any cost.

It is secure

Linux supports various security options that will save you from viruses,
malware, slowdowns, crashes. Further, it will keep your data protected. Its
security feature is the main reason that it is the most favorable option for
developers. It is not completely safe, but it is less vulnerable than others. Each
application needs to authorize by the admin user. The virus cannot be executed
until the administrator provides the access password. Linux systems do not
require any antivirus program.

Favorable choice of Developers

Linux is suitable for the developers, as it supports almost all of the most used
programming languages such as C/C++, Java, Python, Ruby, and more. Further,
it facilitates with a vast range of useful applications for development.

Developers find that the Linux terminal is much better than the Windows
command line, So, they prefer terminal over the Windows command line. The
package manager on Linux system helps programmers to understand how things
are done. Bash scripting is also a functional feature for the programmers. Also,
the SSH support helps to manage the servers quickly.

A flexible operating system

Linux is a flexible OS, as, it can be used for desktop applications, embedded
systems, and server applications. It can be used from wristwatches to
supercomputers. It is everywhere in our phones, laptops, PCs, cars and even in
refrigerators. Further, it supports various customization options.

Linux Distributions

Many agencies modified the Linux operating system and makes their Linux
distributions. There are many Linux distributions available in the market. It
provides a different flavor of the Linux operating system to the users. We can
choose any distribution according to our needs. Some popular distros are
Ubuntu, Fedora, Debian, Linux Mint, Arch Linux, and many more.

For the beginners, Ubuntu and Linux Mint are considered useful and, for the
proficient developer, Debian and Fedora would be a good choice. To Get a list
of distributions, visit Linux Distributions.

How does Linux work?


Linux is a UNIX-like operating system, but it supports a range of hardware
devices from phones to supercomputers. Every Linux-based operating system
has the Linux kernel and set of software packages to manage hardware
resources.

Also, Linux OS includes some core GNU tools to provide a way to manage the
kernel resources, install software, configure the security setting and
performance, and many more. All these tools are packaged together to make a
functional operating system.

How to use Linux?

We can use Linux through an interactive user interface as well as from the
terminal (Command Line Interface). Different distributions have a slightly
different user interface but almost all the commands will have the same
behavior for all the distributions. To run Linux from the terminal, press the
"CTRL+ALT+T" keys. And, to explore its functionality, press the application
button given on the left down corner of your desktop.

Linux History

Evolution of Computer

In earlier days, computers were as big as houses or parks. So you can imagine
how difficult it was to operate them. Moreover, every computer has a different
operating system which made it completely worse to operate on them. Every
software was designed for a specific purpose and was unable to operate on other
computer. It was extremely costly and normal people neither can afford it nor
can understand it.

Evolution of Unix

In 1969, a team of developers of Bell Labs started a project to make a common


software for all the computers and named it as 'Unix'. It was simple and elegant,
used 'C' language instead of assembly language and its code was recyclable. As
it was recyclable, a part of its code now commonly called 'kernel' was used to
develop the operating system and other functions and could be used on different
systems. Also its source code was open source.
Initially, Unix was only found in large organizations like government,
university, or larger financial corporations with mainframes and minicomputers
(PC is a microcomputer).

Unix Expansion

In eighties, many organizations like IBM, HP and dozen other companies


started creating their own Unix. It result in a mess of Unix dialects. Then in
1983, Richard Stallman developed GNU project with the goal to make it freely
available Unix like operating system and to be used by everyone. But his project
failed in gaining popularity. Many other Unix like operating system came into
existence but none of them was able to gain popularity.

Evolution of Linux

In 1991, Linus Torvalds a student at the university of Helsinki, Finland, thought


to have a freely available academic version of Unix started writing its own code.
Later this project became the Linux kernel. He wrote this program specially for
his own PC as he wanted to use Unix 386 Intel computer but couldn't afford it.
He did it on MINIX using GNU C compiler. GNU C compiler is still the main
choice to compile Linux code but other compilers are also used like Intel C
compiler.

He started it just for fun but ended up with such a large project. Firstly he
wanted to name it as 'Freax' but later it became 'Linux'.

He published the Linux kernel under his own license and was restricted to use
as commercially. Linux uses most of its tools from GNU software and are under
GNU copyright. In 1992, he released the kernel under GNU General Public
License.

Linux Today

Today, supercomputers, smart phones, desktop, web servers, tablet, laptops and
home appliances like washing machines, DVD players, routers, modems, cars,
refrigerators, etc use Linux OS.

Linux Features
• Multiuser capability: Multiple users can access the same system
resources like memory, hard disk, etc. But they have to use different
terminals to operate.
• Multitasking: More than one function can be performed simultaneously
by dividing the CPU time intelligently.
• Portability: Portability doesn't mean it is smaller in file size or can be
carried in pen drives or memory cards. It means that it support different
types of hardware.
• Security: It provides security in three ways namely authenticating (by
assigning password and login ID), authorization (by assigning permission
to read, write and execute) and encryption (converts file into an
unreadable format).
• Live CD/USB: Almost all Linux distros provide live CD/USB so that
users can run/try it without installing it.
• Graphical User Interface (X Window system): Linux is command line
based OS but it can be converted to GUI based by installing packages.
• Support's customized keyboard: As it is used worldwide, hence
supports different languages keyboards.
• Application support: It has its own software repository from where
users can download and install many applications.
• File System: Provides hierarchical file system in which files and
directories are arranged.
• Open Source: Linux code is freely available to all and is a community
based development project.

Why Use Linux

Linux is completely different from other operating systems in many ways.

• It is an open source OS which gives a great advantage to the


programmers as they can design their own custom operating systems.
• It gives you a lot of option of programs having some different features so
you can choose according to your need.
• A global development community look at different ways to enhance its
security, hence it is highly secured and robust so you don't need an anti
virus to scan it regularly. Companies like Google, Amazon and Facebook
use linux in order to protect their servers as it is highly reliable and stable.
• Above all you don't have to pay for software and server licensing to
install Linux, its absolutely free and you can install it on as many
computers as you want.
• Its completely trouble free operating system and don't have an issue with
viruses, malware and slowing down your computer.

Hardware Requirement for Linux.

For Installing Linux Server/ Desktop Operating System, it need a specific


configuration of hardware platform.

For Installing Linux Server/ Desktop Operating System, it need a specific


configuration of hardware platform.
Hardware Requirement for Linux. For Installing Linux Server/ Desktop
Operating System, it need a specific configuration of hardware platform. The
hardware also depends upon the sorts of Linux distribution. Here we are telling
about Fedora Core 6.0 Linux distribution. Fedora Core 6 supports the x86,
x86_64 and PowerPC platforms. Processor and Memory Requirements Intel,
AMD, Cyrix, and VIA processor are used for Fedora Core 6. Here we are
giving the detail of only Intel processor. Minimum Requirement for 32-bit
version. Fedora Core 6 requires an Intel Pentium or better processor, and is
optimized for Pentium 4 and later processors. Recommended for text-mode: 200
MHz Pentium-class or better Recommended for graphical: 400 MHz Pentium II
or better Minimum RAM for text-mode: 128MB Minimum RAM for graphical:
192MB Recommended RAM for graphical: 256MB Hard Disk Space
Requirement. Minimum space required at the initial stage at the time of
installation is 90 MB, which required some additional space of 175 MB. But the
total disk covers 9 GB space after the installation of all the packages including
Java, Apache, Eclipse and Java Applications software. At least 5% free space
should be maintained for proper system operation. Minimum Requirement for
64-bit version. Minimum RAM for text-mode: 128MB Minimum RAM for
graphical: 256MB Recommended RAM for graphical: 512MB Minimum
Requirement for 64-bit version. Minimum RAM for text-mode: 128MB
Minimum RAM for graphical: 256MB Recommended RAM for graphical:
512MB Hard Disk Space Requirements Minimum space required 90 MB for a
minimal installation to as much as an additional 175 MB for an installation that
includes nearly all the packages. The complete installed packages can occupy
over 9 GB of disk space. 5% additional free space should also required for
maintaining proper system operation. PowerPC Hardware Requirements Fedora
Core 6 also runs on PowerPCs, which have different processor. Processor and
Memory. Minimum CPU: PowerPC G3 / POWER3 Fedora Core 6 supports
only the ?New World? generation of Apple Power Macintosh originates after
1999, but it also supports IBM pSeries, IBM iSeries, IBM RS/6000,
GenesiPegasos II, and IBM Cell Broadband Engine machines. Recommended
for text-mode: 233 MHz G3 or better, 128MiB RAM. Recommended for
graphical: 400 MHz G3 or better, 256MiB RAM. Hard Disk Space
Requirements Minimum space required 90 MB for a minimal installation to as
much as an additional 175 MB for an installation that includes nearly all the
packages. The complete installed packages can occupy over 9 GB of disk space.
5% additional free space should also required for maintaining proper system
operation.

Linux client system requirements

Hardware minimum

Ensure that the system onto which you install the Discovery Studio client meets
these minimum requirements:

• 32-bit Intel® Pentium® 4 or compatible processor running at 2 GHz or


greater
• 512 MB RAM
• Graphics card: NVIDIA®Quadro™ FX 1100, FX1400, FX540 or ATI
FireGL™ V3200, V5100
• Disk space: 350 MB for client components
• A DVD-ROM drive

Note. The total hard disk space required for installation can vary between 350
MB and 2 GB, depending on the components selected for installation.
Additional space is required if system updates are necessary.

Operating system

The client is supported on workstations running:

• Red Hat® Enterprise Linux WS 3.0, updates 4-7


• Red Hat® Enterprise Linux WS 4.0, base and updates 1-3
Note. Discovery Studio is designed for use on 32-bit operating systems only. It
does not support 64-bit versions of Red Hat Enterprise running natively on
Intel® Itanium®, Intel® EM64T, or AMD64.

Additional software required

• GNOME Desktop - Discovery Studio optimized for the GNOME


Desktop. We recommend that this software is installed and configured. It
should be available on your Linux distribution media.
• System libraries - On Red Enterprise Linux WS 4.0, the Standard C++
libraries for backwards compatibility (compat-libstdc++-33) are required
for correct operation of the Discovery Studio client. These are typically
provided in a default installation of the operating system.
• Graphics Drivers - Discovery Studio is optimized to provide hardware-
accelerated graphics with supported NVIDIA and ATI hardware when
certified drivers are installed. For example, on Linux, Accelrys
recommends version 1.0-8174 or higher for use on NVIDIA Quadro
systems. 3D stereo support is also available with hardware that provides
quad-buffered OpenGL stereo capabilities. Further details on Accelrys-
certified graphics drivers can be obtained from http://www.nvidia.com
and http://www.ati.com.

Linux server system requirements

Hardware requirements

Ensure that the system onto which you install Discovery Studio meets these
minimum requirements:

• 32-bit Intel-compatible processor running at 2 GHz or greater


• 512 MB RAM
• Disk space: 2.5 GB for Pipeline Pilot server plus components
• A DVD-ROM drive

Note. The hard disk space required for installation can vary between 300 MB
and 2.6 GB (total), depending on the components selected for installation.

Operating system

The server is supported on workstations running:


• Red Hat® Enterprise Linux WS 3.0, updates 4-7
• Red Hat® Enterprise Linux WS 4.0, base and update 1-3

Note. Discovery Studio is designed for use on 32-bit operating systems only. It
does not support 64-bit versions of Red Hat® Enterprise running natively on
Intel® Itanium®, Intel EM64T, or AMD64.

Additional software required

• System libraries - On Red Hat® Enterprise Linux 4.0, the Standard C++
libraries for backwards compatibility (compat-libstdc++-33) are required
for correct operation of the Discovery Studio server. These are typically
provided in a default installation of the operating system.
• MPICH - Discovery Studio includes a version of CHARMm that runs on
systems with multiple processors. To use this version, MPICH must be
installed and configured. We recommend building MPICH 1.2.7 from
http://www-unix.mcs.anl.gov/mpi/mpich1/ using GCC 3.2.3 for C/C++
and Intel 8.1 for Fortran.
Architecture of Linux system

The Linux operating system's architecture mainly contains some of the


components: the Kernel, System Library, Hardware layer, System, and
Shell utility.

1. Kernel:- The kernel is one of the core section of an operating system. It is


responsible for each of the major actions of the Linux OS. This operating
system contains distinct types of modules and cooperates with underlying
hardware directly. The kernel facilitates required abstraction for hiding details
of low-level hardware or application programs to the system. There are some of
the important kernel types which are mentioned below:

• Monolithic Kernel
• Micro kernels
• Exo kernels
• Hybrid kernels

2. System Libraries:- These libraries can be specified as some special


functions. These are applied for implementing the operating system's
functionality and don't need code access rights of the modules of kernel.
3. System Utility Programs:- It is responsible for doing specialized level and
individual activities.

4. Hardware layer:- Linux operating system contains a hardware layer that


consists of several peripheral devices like CPU, HDD, and RAM.

5. Shell:- It is an interface among the kernel and user. It can afford the services
of kernel. It can take commands through the user and runs the functions of the
kernel. The shell is available in distinct types of OSes. These operating systems
are categorized into two different types, which are the graphical shells and
command-line shells.

The graphical line shells facilitate the graphical user interface, while the
command line shells facilitate the command line interface. Thus, both of these
shells implement operations. However, the graphical user interface shells work
slower as compared to the command-line interface shells.

There are a few types of these shells which are categorized as follows:

• Korn shell
• Bourne shell
• C shell
• POSIX shell

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:

The file system requires an API (Application programming interface) to access


the function calls to interact with file system components like files and
directories. API

facilitates tasks such as creating, deleting, and copying the files. It facilitates an
algorithm that defines the arrangement of files on a file system.

The first two parts of the given file system together called a Linux virtual file
system. It provides a single set of commands for the kernel and developers to
access the file system. This virtual file system requires the specific system
driver to give an interface to the file system.

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:

• 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.
• 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.
• 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.
• 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.
• 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.

Types of Linux File System

When we install the Linux operating system, Linux offers many file systems
such as Ext, Ext2, Ext3, Ext4, JFS, ReiserFS, XFS, btrfs, and swap.
Let's understand each of these file systems in detail:

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

size.

Boot Block, Super block, dentry, iNode and data block...


File System is divided mainly into 5 blocks

1. boot block

2. super block

3. dentry
4. iNode

5. Data Block

Partition is divided into data blocks with of fixed size which are used to store
content of file. In case if file is of greater size than of block then it is stored in
multiple blocks.

Boot Block: located in the first few sectors of a file system. The boot block
contains the initial bootstrap program used to load the operating
system. Typically, the first sector contains a bootstrap program that reads in a
larger bootstrap program from the next few sectors, and so forth.

Super Block: Each filesystem has one super block (+ duplicate super block) it
contains info about

1. type of filesystem (ext2, ext3...)

2. the block size

3. pointers to a list of free blocks

4. the inode number of the root directory

5. magic number

iNode: Every file have one inode and vice versa. In linux every file is
recognized with integer number known as inode number. This structure consists
of info of file about

1. file ownership indication

2. file type (e.g., regular, directory, special device, pipes, etc.)

3. file access permissions. May have setuid (sticky) bit set.

4. time of last access, and modification

5. number of links (aliases) to the file


6. pointers to the data blocks for the file

7. size of the file in bytes (for regular files), major and minor device numbers
for special devices.

Inodes include pointers to the data blocks. Each inode contains 15 pointers:

• the first 12 pointers point directly to data blocks


• the 13th pointer points to an indirect block, a block containing pointers to
data blocks
• the 14th pointer points to a doubly-indirect block, a block containing 128
addresses of singly indirect blocks
• the 15th pointer points to a triply indirect block (which contains pointers
to doubly indirect blocks, etc.)

Linux Directories

What are Commands

A command is an instruction given to our computer by us to do whatever we


want. In Mac OS, and Linux it is called terminal, whereas, in windows it is
called command prompt. Commands are always case sensitive.

Commands are executed by typing in at the command line followed by pressing


enter key.

This command further passes to the shell which reads the command and execute
it. Shell is a method for the user to interact with the system. Default shell in
Linux is called bash (Bourne-Again Shell).

There are two types of shell commands:

• Built-in shell commands: They are part of a shell. Each shell has some
built in commands.
• External/Linux commands: Each external command is a separate
executable program written in C or other programming languages.

Linux Directory Commands

Directory
Description
Command
The pwd command stands for (print working directory). It
displays the current working location or directory of the user. It
pwd
displays the whole working path starting with /. It is a built-in
command.
The ls command is used to show the list of a folder. It will list
ls
out all the files in the directed folder.
The cd command stands for (change directory). It is used to
cd change to the directory you want to work from the present
directory.
mkdir With mkdir command you can create your own directory.
The rmdir command is used to remove a directory from your
rmdir
system.

Linux Home Directory

The Linux home directory is a directory for a particular user of the system and
consists of individual files. It is also referred to as the login directory. This is
the first place that occurs after logging into a Linux system. It is automatically
created as "/home" for each user in the directory'. It is a standard subdirectory
of the root directory. The root directory contains all other directories,
subdirectories, and files on the system. It is denoted by a forward slash (/).

The home directory can be said as a personal working space for all the users
except root. There is a separate directory for every user. For example, two users
'jtp1' and 'jtp2' will have directories like "/home/jtp1" and "/home/jtp2". These
users will have all the rights under their directory files.
The root (administrative) user is the only user who has its home directory in a
different location by default. The path of the root user is '/root/', where it has
control under all the directories and files.

How to find the Home Directory?

There are multiple ways to access and return to the home directory. Some
commands are very helpful for the directories such as cd, pwd, mkdir, pwd, ls,
and rmdir. To access the home directory graphically, open the files application,
and click on the Home option from the left side menu. Consider the below
image:

Here, we can explore our home directory.

Generally, our terminal opens with the user's particular directory. To change
directory to home directory, execute the cd command as follows:

1. cd /home
The above command will change the directory to home. To list the home
directory, execute the ls command as follows:

1. ls

Consider the below output:

We can get back to our home directory by executing the cd command without
any argument. It will back to our home directory from any directory we are
working on. Execute it as follows:

1. cd

Consider the below output:

From the above output, we were in /Directory/files, by executing only cd


command, we reached to our home directory. We can use the "cd ~ or cd
$HOME" commands as well, to do the same. Consider the below commands:

1. cd ~
2. cd $Home

To display the current working directory, execute the pwd command as follows:

1. pwd

Consider the below output:

To create a directory under a directory, execute the mkdir command as


follows:

1. mkdir <directory name>


Consider the below output:

From the above output, we have created a directory as 'new_dir', and displayed
it by executing the ls command.

We can remove a directory as well. To remove a directory, execute the rmdir


command as follows:

1. rmdir <directory name>

Consider the below output:

From the above output, we have removed the 'new_dir' directory.

Difference between Root and Home Directory

Some key differences between root and home directory are as following:

Root Directory Home Directory


The root directory is the topmost The home directory is a subdirectory of the
level of the system drive. root directory.
It is denoted by '~' and has path
It is denoted by a slash '/'.
"/users/username".
The admin has access to make any No user other than the root user can change
changes in the files and settings. the settings of the entire system.
Any user having a home directory cannot
The admin can create a user.
create a user.
In the Linux file system,
The home directory contains a particular
everything comes under the root
user's data.
directory.

The role of the Linux kernel

With an impressive numbers of code lines, the Linux kernel is one of the most
prominent open source projects and at the same time, the largest available one.
The Linux kernel constitutes a piece of software that helps with the interfacing
of hardware, being the lowest-level code available that runs in everyone's Linux
operating system. It is used as an interface for other user space applications, as
described in the following diagram:

The main roles of the Linux kernel are as follows:


• It provides a set of portable hardware and architecture APIs that offer
user space applications the possibility to use necessary hardware
resources
• It helps with the management of hardware resources, such as a CPU,
input/output peripherals, and memory
• It is used for the management of concurrent accesses and the usage of
necessary hardware resources by different applications.

Architechture

Components of the Linux Kernel

A kernel is simply a resource manager; the resource being managed may be a


process, memory or hardware device. It manages and arbitrates access to the
resource between multiple competing users. The Linux kernel exists in the
kernel space, below the userspace, which is where the user’s applications are
executed. For the user space to communicate with the kernel space, a GNU C
Library is incorporated which provides a forum for the system call interface to
connect to the kernel space and allow transition back to the userspace.

The Linux kernel can be categorized into three primary levels:

1. The system call interface; this is the topmost and undertakes the basic
actions such as read and write.
2. The kernel code; is located below the system call interface, it is common
to all of the processor architectures supported by Linux, it is sometimes
defined as architecture-independent kernel code.
3. The architecture-dependent code; it is under the architecture-independent
code, forms what is usually referred to as a Board Support Package (BSP)
– this contains a small program called the bootloader that places the
Operating System and device drivers into memory.

The architectural perspective of the Linux kernel consists of: System call
interface, Process Management, the Virtual File system, Memory Management,
Network Stack, Architecture and the Device Drivers.

1. System call interface; is a thin layer that is used to undertake function


calls from user space into the kernel. This interface may be architecture
dependent
2. Process management; is mainly there to execute the processes. These are
referred to as the thread in a kernel and are representing an individual
virtualization of the particular processor
3. Memory management; memory is managed in what are known as pages
for efficiency. Linux includes the methods in which to manage the
available memory as well as the hardware mechanisms for physical and
virtual mappings. Swap space is also provided
4. Virtual file system; it provides a standard interface abstraction for the file
systems. It provides a switching layer between the system call interface
and the file systems supported by the kernel.
5. Network stack; is designed as a layered architecture modeledafter the
particular protocols.
6. Device drivers; a significant part of the source code in the Linux kernel is
found in the device drivers that make a particular hardware device
usable. Device driver tutorial
7. Architecture-dependent code; those elements that depend on the
architecture on which they run, hence must consider the architectural
design for normal operation and efficiency.

Interfaces

System calls and Interrupts

Applications pass information to the kernel through system calls. A library


contains functions that the applications work with. The libraries then, through
the system call interface, instruct the kernel to perform a task that the
application wants. What is a Linux System Call?

Interrupts offer a way through which the Linux kernel manages the systems’
hardware. If hardware has to communicate with a system, an interrupt on the
processor does the trick, and this is passed on to the Linux kernel.

Linux kernel interfaces

The Linux kernel offers various interfaces to the user space applications that
perform a variety of tasks and have different properties. Two distinct
Application Programming Interface (API) exist; the kernel-user space and the
kernel internal. The Linux API is the kernel-userspace API; it gives access to
programs in the user space into the system resources and services of the kernel.
It is made up of the System Call Interface and the subroutines from the GNU C
Library.

Linux ABI

This refers to the kernel-user space ABI (Application Binary Interface). This is
explained as the interface that exists between program modules. When
comparing API and ABI, the difference is that ABI’s are used to access external
codes that are already compiled while API are structures for managing
software. Defining an important ABI is majorly the work of Linux distributions
than it is for the Linux kernel. A specific ABI should be defined for each
instruction set, for example, x86-64. End-users of Linux products are interested
in the ABIs rather than the API.

System Call Interface

As earlier discussed, this plays a more prominent role in the kernel. It is a


denomination of the whole part of all existing system calls.

The C standard library

All the system calls of the kernel are within the GNU C Library whereas, the
Linux API is comprised of the system call interface and the GNU C Library,
also called glibc.

Portable Operating System Interface(POSIX)

POSIX is a collective term of standards for maintaining compatibility among


the operating systems. It declares the API together with utility interfaces and
command line shells. The Linux API, not only has the usable features defined
by the POSIX but also has additional features in its kernel:

1. Cgroups subsystem.
2. The Direct Rendering Manager’s system calls.
3. Areadaheadfeature.
4. Getrandom call that is present in V 3.17.
5. System calls such asfutex, epoll, splice, dnotify, fanotify and inotify.

The modular kernel


Previous versions of the Linux kernel were in such a way that all their parts
were statically fixed into one, monolithic. However, modern Linux kernels have
most of their functionality contained in modules that are put into the kernel
dynamically. This in contrast to monolithic types, is referred to as modular
kernels. Such a setup allows a user to load or replace modules in a running
kernel without the need of rebooting.

The Linux Loadable Kernel Module (LKM)

The basic way of adding code in the Linux kernel is through the introduction of
source files to the kernel source tree. However, you may want to add a code
while the kernel is running. The code added this way is referred to as a loadable
kernel module. These particular modules perform various tasks but are specified
into three: device drivers, file system drivers and system calls.

The loadable kernel module can be compared to the kernel extensions in other
operating systems. You can put a module into the kernel by either loading it as
an LKM or binding it into the base kernel.

The benefits of LKMs over binding into the base kernel:

• Rebuilding your kernel often is not necessary, saving time and avoids
errors.
• They assist in figuring out system problems such as bugs.
• LKMs save you space as you only have them loaded when you need to
use them.
• Give much faster maintenance and debugging time.

Uses of LKMs

1. Device drivers; the kernel exchanges information with hardware through


this. A kernel must have a device’s driver before using it.
2. Filesystem drivers; this translates the contents of a filesystem
3. System calls; programs in the user space utilize system calls to acquire
services from the kernel.
4. Network drivers; interprets a network protocol
5. Executable interpreters; loads and manages an executable.

Compiling the Linux Kernel


Unlike what most people say, compiling the Linux kernel is a simple task. The
following is a step-by-step illustration of the process using one of the Linux
distributions: Fedora 13 KDE. (It is advisable to backup your data and grub.conf
just in case something goes wrong)

1. From http://kernel.org website, download the source.


2. While in your downloads directory, extract the kernel source from the
archive by entering the following command in terminal:

tar xvjf Linux-2.6.37.tar.bz2

3. Use the command make mrproper to clear the build area prior to any
compilation.
4. Use a configuration say xconfig, These configurations are designed to
make it easier to run any program in Linux.
5. Specify the modules and features you wish your kernel to contain.
6. After acquiring the .config file, the next step is to go to Makefile
7. Run the make command and wait for the compilation to go through.
8. Install the modules using the command make modules_install
9. Copy your kernel and the system map to /boot.
10.Run the new-kernel-pkg to build the list of module dependencies and
stuff like grub.conf

Upgrading the kernel

It is possible to upgrade a Linux kernel from an older version to a more recent


one, while retaining all of the configuration options from the earlier version. To
achieve this, one has to first back up the .config file in the kernel source
directory; this is in case something goes wrong when trying to upgrade your
kernel. The steps are:

1. Get the latest source code from the main kernel.org website
2. Apply the variations to the old source tree to bring it up to the latest
version.
3. Reconfigure the kernel based on the preceding kernel configuration file
you had backed up.
4. Build the new kernel.
5. Now you can install the new build the kernel.
Downloading the new source; the Linux kernel developers understand that some
users may not want to download the full source code for the kernel updates, as
this would waste time and bandwidth. Therefore, a patch is made available
which can upgrade an older kernel release. Users only need to know which
patch applies to a particular version, since a kernel patch file will only update
the source code from one specific release. The different patch files can be
applied through the following ways;

1. Stable kernel patches which apply to the base kernel version.


2. Base kernel release patches only apply to the previous base kernel version
3. Incremental patch upgrade from a particular release to the next release.
This allows developers avoid the hustle of downgrading then upgrading
their kernel. Instead, they can switch from their current stable release to
the next stable release.

How to partition a disk in Linux

Creating and deleting partitions in Linux is a regular practice because storage


devices (such as hard drives and USB drives) must be structured in some way
before they can be used. In most cases, large storage devices are divided into
separate sections called partitions. Partitioning also allows you to divide your
hard drive into isolated sections, where each section behaves as its own hard
drive. Partitioning is particularly useful if you run multiple operating systems.

There are lots of powerful tools for creating, removing, and otherwise
manipulating disk partitions in Linux. In this article, I'll explain how to use the
parted command, which is particularly useful with large disk devices and many
disk partitions. Differences between parted and the more common fdisk and
cfdisk commands include:

• GPT format: The parted command can create a Globally Unique


Identifiers Partition Table GPT), while fdisk and cfdisk are limited to
DOS partition tables.
• Larger disks: A DOS partition table can format up to 2TB of disk space,
although up to 16TB is possible in some cases. However, a GPT partition
table can address up to 8ZiB of space.
• More partitions: Using primary and extended partitions, DOS partition
tables allow only 16 partitions. With GPT, you get up to 128 partitions by
default and can choose to have many more.
• Reliability: Only one copy of the partition table is stored in a DOS
partition. GPT keeps two copies of the partition table (at the beginning
and the end of the disk). The GPT also uses a CRC checksum to check
the partition table integrity, which is not done with DOS partitions.

With today's larger disks and the need for more flexibility in working with
them, using parted to work with disk partitions is recommended. Most of the
time, disk partition tables are created as part of the operating system installation
process. Direct use of the parted command is most useful when adding a storage
device to an existing system.

The following explains the process of partitioning a storage device with the
parted command. To try these steps, I strongly recommend using a brand new
storage device or one where you don't mind wiping out the contents.

1. List the partitions: Use parted -l to identify the storage device you want to
partition. Typically, the first hard disk (/dev/sda or /dev/vda) will contain the
operating system, so look for another disk to find the one you want (e.g.,
/dev/sdb, /dev/sdc, /dev/vdb, /dev/vdc, etc.).

$ sudo parted -l

[sudo] password for daniel:

Model: ATA RevuAhn_850X1TU5 (scsi)

Disk /dev/vdc: 512GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Disk Flags:
Number Start End Size Type File system Flags

1 1049kB 525MB 524MB primary ext4 boot

2 525MB 512GB 512GB primary lvm

2. Open the storage device: Use parted to begin working with the selected
storage device. In this example, the device is the third disk on a virtual system
(/dev/vdc). It is important to indicate the specific device you want to use. If you
just type parted with no device name, it will randomly select a storage device to
modify.

$ sudo parted /dev/vdc

GNU Parted 3.2

Using /dev/vdc

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted)

3. Set the partition table: Set the partition table type to GPT, then type "Yes"
to accept it.

(parted) mklabelgpt

Warning: the existing disk label on /dev/vdc will be destroyed

and all data on this disk will be lost. Do you want to continue?

Yes/No? Yes

The mklabel and mktable commands are used for the same purpose (making a
partition table on a storage device). The supported partition tables are: aix,
amiga, bsd, dvh, gpt, mac, ms-dos, pc98, sun, and loop. Remember mklabel will
not make a partition, rather it will make a partition table.
4. Review the partition table: Show information about the storage device.

(parted) print

Model: Virtio Block Device (virtblk)

Disk /dev/vdc: 1396MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number Start End Size File system Name Flags

5. Get help: To find out how to make a new partition, type: (parted) help
mkpart.

(parted) help mkpart

mkpart PART-TYPE [FS-TYPE] START END make a partition

PART-TYPE is one of: primary, logical, extended

FS-TYPE is one of: btrfs, nilfs2, ext4, ext3, ext2, fat32, fat16, hfsx, hfs+,
hfs, jfs, swsusp,

linux-swap(v1), linux-swap(v0), ntfs, reiserfs, hp-ufs, sun-ufs, xfs, apfs2,


apfs1, asfs, amufs5,

amufs4, amufs3, amufs2, amufs1, amufs0, amufs, affs7, affs6, affs5, affs4,
affs3, affs2, affs1,

affs0, linux-swap, linux-swap(new), linux-swap(old)


START and END are disk locations, such as 4GB or 10%. Negative
values count from the end of the

disk. For example, -1s specifies exactly the last sector.

'mkpart' makes a partition without creating a new file system on the


partition. FS-TYPE may be

specified to set an appropriate partition ID.

6. Make a partition: To make a new partition (in this example, 1,396MB on


partition 0), type the following:

(parted) mkpart primary 0 1396MB

Warning: The resulting partition is not properly aligned for best performance

Ignore/Cancel? I

(parted) print

Model: Virtio Block Device (virtblk)

Disk /dev/vdc: 1396MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:
Number Start End Size File system Name Flags

1 17.4kB 1396MB 1396MB primary

Filesystem type (fstype) will not create an ext4 filesystem on /dev/vdc1. A DOS
partition table's partition types are primary, logical, and extended. In a GPT
partition table, the partition type is used as the partition name. Providing a
partition name under GPT is a must; in the above example, primary is the name,
not the partition type.

7. Save and quit: Changes are automatically saved when you quit parted. To
quit, type the following:

(parted) quit

Information: You may need to update /etc/fstab.

Main Differences between the CLI and GUI

Various main differences between the CLI and GUI are as follows:

1. A graphical user interface enables users to interact with the operating


system or application. On the other hand, a CLI is an interface that allows
the user to perform tasks by issuing commands in successive lines of text
or command lines.
2. The CLI needs the commands to be memorized, making it difficult for
newcomers. Professionals frequently prefer CLI. GUI is more user-
friendly than CLI and may be utilized by both beginners and experienced
professionals.
3. The CLI is ideal for dealing with difficult tasks. The difficult task may be
handled by writing a few commands, whereas GUI requires some steps to
be followed in order to function.
4. The CLI may or may not support multitasking. On the other hand, in a
GUI, multitasking is simple. For example, MS Word and Chrome both
have multitasking capabilities.
5. The GUI is slow than CLI. It took more time to complete tasks. On the
other hand, CLI performs better. A script may be written to carry out a set
of commands, although the GUI does not have this capability.
6. When interacting, only the keyboard and the system are used. On the
other hand, the GUI has additional resources to engage with the user.
7. The interface in Command Line Interface is consistent all of the time.
The interface in GUI changes as the software is updated.
8. In the Command Line Interface, there is less color strain on the eyes. The
color strain is greater in GUI. CLI is a command-line interface that gives
users greater control over the system. There are a few limitations in the
GUI when it comes to accessing folders and doing tasks.
9. GUI is more flexible than CLI.
10.The graphical user interface (GUI) provides access to the operating
system and files. However, CLI is still required to do complex tasks.

Head-to-head comparison between the CLI and GUI

Here, you will learn the head-to-head comparison between the CLI and GUI.
Some of the head-to-head comparisons are as follows:

Features CLI GUI


A CLI is an interface that
A graphical user interface
allows the user to perform
enables users to interact with
Definition tasks by issuing commands in
the operating system or
successive lines of text or
application.
command lines.
Memory It needs less memory than the It needs more memory because
Requirement GUI. it has various graphics
components.
Ease of use It is not easy to use. It is easy to use.
Speed It is faster than the GUI. It is slower than the CLI.
Flexibility It is less flexible than GUI. It is more flexible than CLI.
It needs both a keyboard and a
Device Used It needs the only keyboard.
mouse.
Its appearance may not be Its appearance may be
Appearance
modified or changed. modified or changed.
Its precision is high as Its precision is low as
Precision
compared to GUI. compared to CLI.
In a GUI, information can be
The information can be viewed viewed or presented to the user
Data
to the user in plain text and in several ways, including
Presentation
files in the CLI. simple text, videos, graphics,
etc.
Spelling mistakes and typing Spelling mistakes and typing
Errors
errors are not avoided. errors are avoided.
No graphics are used in the
Graphics Graphics are used in the GUI.
CLI.
No menus are provided in the Menus are provided in the
Menus
CLI. GUI.

GUI and CLI are user interfaces.

Following are the important differences between GUI and CLI.

Sr.
Key GUI CLI
No.
User interacts with computer User interacts with
1 Interaction using Graphics like images, computer using
icons. commands.
2 Navigation Navigation is easy. Navigation is difficult.
3 Peripherals Keyboard, mouse or any other Only keyboard.
Sr.
Key GUI CLI
No.
used pointing device.
4 Precision GUI has low precision. CLI has high precision.
5 Speed GUI is of low speed. ClI is of high speed.
Usage is difficult,
6 Usage Usage is easy.
requires expertise.
Memory Low memory
7 High memory requirement.
requirement requirement.
Little flexibile user
8 Flexibility Highly flexibile user interface.
interface.
CLI appearance is not
9 Customize GUI is highly customizable.
easily changable.
Typing GUI normally handles type errors CLI don't handles type
10
Check and correct them. errors.

Linux and Windows both are operating systems. Linux is open source and is
free to use whereas Windows is a proprietary.

Following are the important differences between Linux and Windows.

Sr.
Key Linux Windows
No.
Open Linux is Open Source and is free Windows is not open source
1
Source to use. and is not free to use.
Case Linux file system is case Windows file system is case
2
sensitivity sensitive. insensitive.
kernel
3 Linux uses monolithic kernel. Windows uses micro kernel.
type
Linux is more efficient in
Windows is less efficient in
4 Efficiency operations as compared to
operations.
Windows.
Sr.
Key Linux Windows
No.
Path Linux uses forward slash as path Windows uses backward
5
Seperator seperator between directorioes. slash as a path seperator.
Windows provides less
Linux is highly secure as
6 Security security as compared to
compared to Windows.
Linux.

Open Source Software

Definition

Open source software (OSS) is software that is distributed with its source code,
making it available for use, modification, and distribution with its original
rights. Source code is the part of software that most computer users don’t ever
see; it’s the code computer programmers manipulate to control how a program
or application behaves. Programmers who have access to source code can
change a program by adding to it, changing it, or fixing parts of it that aren’t
working properly. OSS typically includes a license that allows programmers to
modify the software to best fit their needs and control how the software can be
distributed.

What are some examples of OSS?

• GNU/Linux
• Mozilla Firefox
• VLC media player
• SugarCRM
• GIMP
• VNC
• Apache web server
• LibreOffice
• jQuery

What are the differences between open source and closed source software?

Factors Open source Closed source


Price Available for nominal or Cost varies based upon the scale
zero licensing and usage of the software.
charges.
Freedom to Completely customizable Change requests must be made to
customize but it depends on the open the company selling the software.
source license. Requires in- This includes bug fixes, features,
house expertise. and enhancements.
User-friendliness Typically less user-friendly, Typically more user-friendly. As
but it can depend on the a for-profit product, adoptability
goals of the project and and user experience are often key
those maintaining it. considerations.
After-sales Some very popular pieces Dedicated support teams are in
support of open source software place. The level of service
(e.g., OSS distributed by available depends on the service-
Red Hat or SUSE) have level agreement (SLA).
plenty of support.
Otherwise, users can find
help through user forums
and mailing lists.
Security Source code is open for The company distributing the
review by anyone and software (i.e., software owner)
everyone. There is a guarantees a certain level of
widespread theory that support, depending on the terms
more eyes on the code of the SLA. Because the source
makes it harder for bugs to code is closed for review, there
survive. However, security can be security issues. If issues
bugs and flaws may still are found, the software
exist and pose significant distributor is responsible for
risk. fixing them.
Vendor lock-in No vendor lock-in due to In most cases, large investments
the associated cost. are made in proprietary software.
Integration into systems Switching to a different vendor
may create technical or to an open source solution can
dependency. be costly.
Stability This will depend on the Older, market-based solutions are
current user base, the more stable. New products have
parties maintaining the similar challenges as open source
software, and the number of products. If a distributor
years in the market. discontinues an application, the
customer may be out of luck.
Popularity Some open source solutions In some industries, proprietary
are very popular and are software is more popular,
even market leaders (e.g., especially if it has been in the
Linux, Apache). market for many years.
Total cost of TCO is lower and upfront TCO is much higher and depends
ownership (TCO) due to minimal or no usage on the size of the user base.
cost, and depends on the
level of maintenance
required.
Community The community Closed community.
participation participating in
development, review,
critique, and enhancement
of the software is the
essence of open source.
Interoperability This will depend on the This will depend on the
with other open level of maintenance and development standards.
source software goals of the group, but it is
typically better than closed
source software.
Tax calculation Difficult due to undefined Definite.
monetary value.
Enhancements or Can be developed by the Request must be made to the
new features user if needed. software owner.
Suitability for OSS might not be Most proprietary software goes
production technically well-designed or through multiple rounds of
environment tested in a large-scale testing. However, things can still
production environment. go wrong when deployed in a
production environment.
Financial The financial industry tends Financial institutions prefer
institution to avoid open source proprietary software.
considerations solutions. If used, a vetting
process must take place.
Warranty No warranty available. Best for companies with security
policies requiring a warranty and
liability indemnity.

What are the advantages and disadvantages of open source software?

Advantages

• Open source software is free.


• Open source is flexible; developers can examine how the code works and
freely make changes to dysfunctional or problematic aspects of the
application to better fit their unique needs.
• Open source is stable; the source code is publicly distributed, so users can
depend on it for their long-term projects since they know that the code’s
creators cannot simply discontinue the project or let it fall into disrepair.
• Open source fosters ingenuity; programmers can use pre-existing code to
improve the software and even come up with their own innovations.
• Open source comes with a built-in community that continuously modifies
and improves the source code.
• Open source provides great learning opportunities for new programmers.v

Disadvantages

• Open source can be harder to use and adopt due to difficulty setting it up
and the lack of friendly user interfaces.
• Open source can pose compatibility issues. When attempting to program
proprietary hardware with OSS, there is often a need for specialized
drivers that are typically only available from the hardware manufacturer.
• Open source software can pose liability issues. Unlike commercial
software, which is fully controlled by the vendor, open source rarely
contains any warranty, liability, or infringement indemnity protection.
This leaves the consumer of the OSS responsible for maintaining
compliance with legal obligations.
• Open source can incur unexpected costs in training users, importing data,
and setting up required hardware.vi
UNIT VI
Indian contribution to the field - the BOSS operating system, open source
softwares, growth of LINUX, Aryabhatt Linux, contributions of innovators
- RaienSheth, Sunder Pichai etc.

BOSS Operating System

Overview

BOSS Operating System is an Indian OS based on GNU/Linux developed


by C-DAC (Centre for Development of Advanced Computing), Chennai. It is
developed to provide the benefit of using Free/Open source software all over
India. The Indian government has been using the BOSS operating system for
official use and to control different cyber vulnerabilities in Indian
cyberspace.The latest version of the BOSS operating system is 9.09.0, which is
called urja released in February 2021.

What is the Boss Operating System?

Indian peoples always rely on other nations for using Operating Systems
like Windows and Linux distributions like CentOS, Ubuntu, etc., in their
computers, smartphones, and other gadgets in which, none of which were
developed in India. Therefore, if we want to use an OS developed in India, then
the BOSS operating system should be our go-to option.
BOSS Operating System, also known as Bharat Operating System
Solution, is a GNU/Linux distribution that is derived from Debian Linux.
This distribution was developed in India by the Centre for Development
of Advanced Computing (C-DAC), Chennai, in the year 20062006 for the
enhancement of Free/Open source software used throughout the entire nation.
The National Resource Centre for Free and Open Source Software
(NRCFOSS) is the key provider of BOSS GNU/Linux OS. It has an upgraded
desktop environment that supports local Indian languages.
C-DAC had a vision that the BOSS Operating System would
significantly impact the digital divide across India since every individual will
now have access to applications or software in their local language to use the
internet and other communication technologies.
The BOSS operating system has been recommended by the Indian
government for its adoption and implementation on the national level. It has
been LSB certified (Linux Standard Base) by the Linux foundation.
Note: Linux Standard Base(LSB) is a set of standards that increases
compatibility among Linux distributions.
It becomes easier for Microsoft Windows users to migrate to the BOSS
operating system because of its exceptional features like presentation tools,
documents converter, All-in-One control panel, and also features like plug and
play. BOSS operating system is designed to be easily used for Educational
Domains with the help of EduBOSS OS, which is a variant of BOSS OS and
has relevant features for the primary and secondary school environment.

Till now, 9 major versions of BOSS OS have been released, which are as
follows :
1.01.0 (Tarag) released in January 2006
2.02.0 (Anant) released in September2007
3.03.0 (Tejas) released in September 2008
4.04.0 (Savir) released in April 2011
5.05.0 (Anokha) released in September 2013
6.06.0 (Anoop) released in August 2015
7.07.0 (Drishti) released in August 2018
8.08.0 (Unnati) released in July 2019
9.09.0 (Urja) released in February 2021

BOSS Operating System Advantages and Disadvantages


A working framework is the core of any PC without which it can’t
endure. It gives every one of the assets to programming, deals with the
equipment, and carries out all standard administrations for PC programs. An
Operating System is a framework programming that ensures that clients can
oversee exercises of both equipment and programming just as use assets of a
PC. It permits the communication between the client and the product those are
introduced. Bharat Operating System Solutions is an Indian Linux appropriation
got from Debian. Chief – Bharat Operating System Solutions, a free open-
source PC working framework created by the National Resource Center for
Free/Open Source Software (NRCFOSS) of India.
Advantages of BOSS (Linux) OS
Linux is an open-source OS that implies anybody can see the source code
and change it as per his requirements. You can uninhibitedly introduce Linux on
numerous PCs without getting a compensated permit. Assuming we contrast
this and windows or macintosh then they are paid working frameworks. You
need to get a permit of windows and macintosh to use on your machine.
In Linux, you needn’t bother with hostile to infection programming to be
introduced on your PC. Linux has fewer opportunities to be impacted by
infection. The justification behind solid infection assurance is that Linux has a
huge number of open-source engineers who watches out for infection-related
stuff. Assuming any source code should be refreshed then it is done in a matter
of moments.
Linux has a huge scope of word processors accessible. Assuming you are
a developer then you can pick any of the free programming bundles like visual
studio code, Vim, Atom and so on The greater part of word processors are
unreservedly accessible and you can utilize it with no issue.
Order brief in Linux is extremely best in class and assuming that you are
an engineer then you can perform the vast majority of your work utilizing the
order line interface. You can introduce various vaults and bundles through the
order line interface.
Assuming you are a Windows client then you have seen framework
reboot while you introduce/uninstall any product or reboot when the framework
turns out to be slow. In any case, in the event of Linux, you don’t have to reboot
your framework in such cases.
Assuming you have an old PC that has low particular then you can in any
case run Linux. Linux has various disseminations that are accessible for a wide
range of PCs for example huge scope PCs, servers, Pc and so on
To do some bunch works like printing a huge record or downloading
huge document then you can simultaneously perform different undertakings like
composing or coding any program. Linux is great in doing such performing
multiple tasks and your framework won’t dial back.
Assuming you have restricted plate space then you can in any case run
Linux. You needn’t bother with additional circle space for running Linux for a
more drawn out time frame.
Linux upholds countless document designs. So you need to not stress assuming
any record design doesn’t run on Linux. You can introduce diverse
programming bundles for explicit record configuration and it will turn out great.
Disadvantages of BOSS (Linux) OS
One of the issues that most Linux clients face is that a few equipment
drivers are not accessible for Linux. Equipment organizations like to make
drivers for windows or macintosh since they have more clients when contrasted
with Linux.
Getting everything rolling with windows is simple for amateurs however
learning Linux is troublesome. You need to find out with regards to the order
line interface and looking for new programming is additionally smidgen
troublesome. Assuming that you deal with any issue in the working framework
then, at that point, observing arrangement is hazardous. There are fewer
specialists for Linux when contrasted with windows and macintosh.
Take an illustration of Photoshop which is a well known realistic altering
instrument. Photoshop is accessible for windows yet is absent in Linux. There
are other photographs altering instruments yet Photoshop is a more integral
asset than others. MS office is another model which isn’t accessible for Linux
clients.
A large portion of the games is made for windows yet not Linux. As the
windows stage is generally utilized so game engineers have more interest in
windows.
One principle issue with Linux is drivers. Before you can introduce any
equipment part in your PC, you should ensure the equipment has drivers
accessible. Equipment makers generally compose drivers for Windows,
however not all brands compose drivers for Linux. This implies that a portion of
your equipment probably won’t be viable with Linux assuming you choose to
switch.
Comparison Between Advantages and Disadvantages of BOSS (Linux)
Advantages Disadvantages
Its an open source Unavailability of hardware drivers
No antivirus required Difficult to learn LINUX language
Command prompt is efficient Insufficient software tools
No reboot required Cannot run all the games
Less space and multitasking Support issue
FAQ’s on Boss Operating System Advantages and Disadvantages

Question 1.What is BOSS?


Answer:
Bharat Operating System Solutions usually alluded to as BOSS, is a gathering
of a few Open Source working framework subordinates, which are all evolved
by CDAC, Chennai to help the use of Free/Open Source Software in India.
Manager GNU/Linux is a vital deliverable of NRCFOSS. It has improved the
Desktop Environment incorporated with Indian language support and different
programming projects. It has improved the work area climate coordinated with
Indian language support and other programming. The product has been
supported by the Government of India for reception and execution on a public
scale.

Question 2.What is the major advantage of the BOSS operating system?


Answer:
The major advantage of the BOSS operating system is that it is available in all
the main Indian languages such as Assamese, Bengali, Gujarati, Hindi,
Kannada, Malayalam, Marathi, Oriya, Punjabi, Sanskrit, Tamil, Telugu, Bodo,
Urdu, Kashmiri, Maithili, Konkani, Manipuri, etc.

Question 3. Is BOSS an operating system?


Answer:
Yes, BOSS is an operating system. It is an Indian Linux distribution derived
from Debian.

Aryabhatt Linux

Linux Technologies has formally launched Aryabhatt Linux, the first


distribution of the Linux operating system (OS) in India. Linux is a `free'
operating system, as it is based on an open source code unlike other systems
such as Microsoft Windows.
Linux Technologies which is based in the city focusses on conducting
ongoing research on the Linux Kernel and developing software solutions that
are both effective and affordable.
The company received its first round of incubator funding of Rs one crore
for 10 per cent of its equity three months ago. The second round is being
negotiated to raise $1 million (Rs 4.4 crore) from three to four equity partners.
The third round is proposed to be an initial public offering and the fourth a
Nasdaq listing. The paid-up capital of the company is Rs 1.5 crore.
Aryabhatt Linux is currently valued at $25 million according to Linux
Technologies.
"We have spent two years developing this operating system and can
proudly say that Aryabhatt Linux is on par with any operating system in the
world and, in addition, is specifically customised for the Indian user," said
Vishal Gupta, managing director, Linux Technologies.

Aryabhatt Linux is priced at Rs 2,100 or $50 per pack, which also has an user
manual.

Gupta said this was at least 20 per cent cheaper than other alternatives available
in the market.
The company's target audience is the entire universe of personal
computer users whether corporates, small office-home office users, dotcoms or
educational institutions.
For popularising the operating system, Linux Technologies also has a
team, focussing on training and education and tie-ups with the likes of Datapro,
LCC, Sun Resources, Symbiosis Institute and Bhawan's Institute, already in
place. Linux will offer training to the staff of the training institutes on the
Aryabhatt Linux platform.
The company is in negotiations with various computer manufacturers and
application sellers such as IBM, Sun and Oracle to pre-install Aryabhatt and/or
bundle it with their software. Aryabhatt Linux will also be globally marketed in
Singapore, Japan, Korea and the Middle east.
In the first year, Linux Technologies expects to sell one lakh boxes in the
country which would be 2 per cent of the domestic personal computer base. The
first year sales target is $2.5 million doubling every year to touch $20 million
by 2004. A company statement said besides supporting most hardware
Aryabhatt Linux has low minimum hardware requirements. It supports all x86
compatible PCs with 16 MB of random access memory (RAM) and 640 MB of
hard disk space.

You might also like