Bestpractice 17183611833
Bestpractice 17183611833
MODULE 1
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 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.
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.
• 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.
Memory Management
Processor Management
Device Management
File Management
Security
Job accounting
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.
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.
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.
CPU is often idle, because the speed of the mechanical I/O devices is slower
than the CPU.
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.
Problem of reliability.
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.
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.
Upgrades to new technologies and hardware can be easily integrated into the
system.
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.
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 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
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
Multitasking
Multiprogramming
Advantages
Disadvantages
Interactivity
Distributed Environment
Spooling
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:-
Disadvantages:-
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:-
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:-
Of course, there are other workstation operating systems out there as well.
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.
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.
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.
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.
7. Symbian OS (Nokia)
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.
Process
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.
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.
Start
1
This is the initial state when a process is first started/created.
Ready
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
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.
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.
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.
• 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 refers to running and non-running states which are
described below −
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
1. Long-Term Scheduler
2. Short-Term Scheduler
3. Medium-Term Scheduler
1. Long Term Scheduler
It is a process swapping
1 It is a job scheduler It is a CPU scheduler
scheduler.
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
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 −
P0 0-0=0
P1 5-1=4
P2 8-2=6
P3 16 - 3 = 13
Introduction to Deadlock
Every process needs some resources to complete its execution. However, the
resource is granted in a sequential order.
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.
• Mutual Exclusion
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.
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.
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 simple words, The OS reviews each allocation so that the allocation doesn't
cause the deadlock in the system.
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.
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.
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.
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.
!(Hold and wait) = !hold or !wait (negation of hold and wait is, either you
don't hold or you don't wait)
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.
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.
Resources Assigned
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.
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
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.
There are mainly three types of an address binding in the OS. These are as
follows:
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:
Swapping
Memory Allocation
In the Operating System, there are two techniques for memory allocation and
these are as follows:
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 −
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.
Compaction
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
Advantages of Compaction
Disadvantages of 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.
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.
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.
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.
• 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
• 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
• 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.
• 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
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).
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.
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.
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.
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.
Naming convention
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.
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.
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.
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.
• 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.
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
Linked Allocation
Indexed Allocation
• 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.
Advantages:
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:
Disadvantages:
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:
• 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.
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:
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.
Advantages:
• It allows cycles.
• It is more flexible than other directories structure.
Disadvantages:
• Process Management
• Memory Management
• File and Disk Management
• I/O System Management
• Disk Format
• Booting from disk
• Bad block recovery
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:
• 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:
• FCFS Scheduling
• SCAN Scheduling
• C-SCAN Scheduling
• LOOK Scheduling
• C- LOOK Scheduling
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.
= 121+134+106+134+166
=661
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.
or
= Source - Destination
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.
= 208
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.
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
= 329
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.
= 149+199+43
= 391
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.
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:
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.
= 314
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
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:
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
= 125 + 166 + 28
= 319
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.
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:
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.
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
• 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.
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
Type C
Type D
4 Lowest level. Minimum protection. MS-DOS, Window 3.1 fall in this
category.
MODULE V
Introduction:-
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 Features
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).
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.
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.
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.
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.
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.
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.
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.
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.
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
Unix Expansion
Evolution of Linux
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.
Hardware minimum
Ensure that the system onto which you install the Discovery Studio client meets
these minimum requirements:
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
Hardware requirements
Ensure that the system onto which you install Discovery Studio meets these
minimum requirements:
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
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.
• 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
• Monolithic Kernel
• Micro kernels
• Exo kernels
• Hybrid kernels
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 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.
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.
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.
• 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.
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:
The file system Ext stands for Extended File System. It was primarily
developed for MINIX OS. The Ext file system is an older version, and is no
longer used due to some limitations.
Ext2 is the first Linux file system that allows managing two terabytes of data.
Ext3 is developed through Ext2; it is an upgraded version of Ext2 and contains
backward compatibility. The major drawback of Ext3 is that it does not support
servers because this file system does not support file recovery and disk
snapshot.
Ext4 file system is the faster file system among all the Ext file systems. It is a
very compatible option for the SSD (solid-state drive) disks, and it is the default
file system in Linux distribution.
JFS stands for Journaled File System, and it is developed by IBM for AIX
Unix. It is an alternative to the Ext file system. It can also be used in place of
Ext4, where stability is needed with few resources. It is a handy file system
when CPU
power is limited.
XFS file system was considered as high-speed JFS, which is developed for
parallel I/O processing. NASA still using this file system with its high storage
server (300+ Terabyte server).
Btrfs stands for the B tree file system. It is used for fault tolerance, repair
system, fun administration, extensive storage configuration, and more. It is not a
good suit for the production system.
The swap file system is used for memory paging in Linux operating system
during the system hibernation. A system that never goes in hibernate state is
required to have swap space equal to its RAM
size.
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
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
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:
Linux Directories
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).
• 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.
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.
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.
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:
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
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
1. cd ~
2. cd $Home
To display the current working directory, execute the pwd command as follows:
1. pwd
From the above output, we have created a directory as 'new_dir', and displayed
it by executing the ls command.
Some key differences between root and home directory are as following:
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:
Architechture
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.
Interfaces
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.
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.
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.
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 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.
• 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
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
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;
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:
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
Disk Flags:
Number Start End Size Type File system Flags
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.
Using /dev/vdc
(parted)
3. Set the partition table: Set the partition table type to GPT, then type "Yes"
to accept it.
(parted) mklabelgpt
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
Disk Flags:
5. Get help: To find out how to make a new partition, type: (parted) help
mkpart.
FS-TYPE is one of: btrfs, nilfs2, ext4, ext3, ext2, fat32, fat16, hfsx, hfs+,
hfs, jfs, swsusp,
amufs4, amufs3, amufs2, amufs1, amufs0, amufs, affs7, affs6, affs5, affs4,
affs3, affs2, affs1,
Warning: The resulting partition is not properly aligned for best performance
Ignore/Cancel? I
(parted) print
Disk Flags:
Number Start End Size File system Name Flags
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
Various main differences between the CLI and GUI are as follows:
Here, you will learn the head-to-head comparison between the CLI and GUI.
Some of the head-to-head comparisons are as follows:
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.
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.
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.
• 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?
Advantages
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.
Overview
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
Aryabhatt Linux
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.