Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 32

Operating System and File

system
Operating System
• is an interface between a computer user and computer hardware.
• An operating system is a software which performs all the basic tasks like file
management, memory management, process management, handling input and
output, and controlling peripheral devices such as disk drives and printers.
• Every computer must have at least one OS to run other programs.
Basically, there are two ways.
– With a command-line operating system (e.g., DOS), you type a text command and
the computer responds according to that command.
– With a graphical user interface (GUI) operating system (e.g., Windows), you
interact with the computer through a graphical interface with pictures and buttons
by using the mouse and keyboard.

• Some popular Operating Systems include Linux, Windows, OS X, VMS, OS/400, AIX,
z/OS, etc
– With Unix you have in general the option of using either command-lines (more
control and flexibility) or GUIs (easier).
Following are some of important functions of an operating
System.
– Memory Management
– Processor Management
– Device Management
– File Management
– Security
– Control over system performance
– Job accounting
– Error detecting aids
– Coordination between other software and users
Types of Operating System
• Batch operating system
– Jobs with similar type are batched together and run as group
– User do not interact with
– Punch card is used
– User prepare their job on offline device on punch card
• Time-sharing operating systems
– enables people located at a different terminal(shell) to use a single
computer system at the same time.
– The processor time (CPU) which is shared among multiple users is termed
as time sharing.
• Distributed operating System
– Distributed systems use many processors located in different machines to
provide very fast computation to its users.
• Network operating System
– Network Operating System runs on a server. It provides the
capability to serve to manage data, user, groups, security,
application, and other networking functions.
• Real Time operating System
– In this type operating system time interval to process and
respond to inputs is very small. Examples: Military Software
Systems, Space Software Systems.
– Hard real-time systems
• SECONDARY STORAGE IS LIMITED
• No virtual memory/data is stored in ROM
– Soft real-time systems
• Mobile OS
– Mobile operating systems are those OS which is
especially designed to power smart phones,
tablets, and wearable devices.
– Some of the most famous mobile operating
systems are Android and iOS, but others include
BlackBerry, Web, and watchOS.
Unix and Windows: Two Major Classes of
Operating Systems

• They have a competitive history and future


• Unix has been in use for more than five decades
• Since the 1980s Unix's main competitor Windows has
gained popularity due to the increasing power of
microcomputers with Intel-compatible processors.
• Windows, at the time, was the only major OS designed
for this type of processors
• Linux is a version of unix gets popularity for
microcomputers.
• In OS for server Unix is dominant in the market share
Advantages of Unix
• Unix is more flexible and can be installed on
many different types of machines, including
mainframe computers, supercomputers, and
micro-computers.
• Unix is more stable and does not go down as
often as Windows does, therefore requires less
administration and maintenance.
• Unix has greater built-in security and
permissions features than Windows
• Unix possesses much greater processing power than
Windows.
• Unix is the leader in serving the Web. (About 90% of the
Internet relies on Unix operating systems running Apache, the world's
most widely used web server)
• Runtime errors and crashes are quite rare on the Unix
operating system due to the way its kernel is designed
and the way processes are allowed to access it
• Free ( Most )
• GUI / Command Line
Files and File Structure
In Windows, there is a registry which contains system configuration information; files and folders.
In UNIX, everything a file and folders are called directories. Since everything is a file, disks and partitions are
mounted as directories, devices appears as files in /dev and so are running processors which appear in
/proc.
In Windows, the main folders are C:/Windows, C:/Program Files, C:/Users (for Windows Vista, 7 or
C:/Document and Settings for Windows XP).
In Unix, the file system layout is very different.
• /boot – Where the boot image files are stored
• /mnt – The mount points for the partitions
• /dev – Files of all the connected devices (USB, Printers)
• /proc – Dynamic process information
• /sys – Dynamic system configuration information
• /var – Log files and system subdirectories
• /tmp & /spool – Temporary files
• /home – User accounts home directories
• /usr & /user/local – A replicate tree for users and contains administrative tools
• /bin & /sbin – Essential system executable files
• /etc – System configuration files
• /share – Common read only files
• /lib & /include – Shared library files and system development
• Comparisons
• Here are a list of some other comparisons between UNIX and Windows
Other Comparisons

• Here are a list of some other comparisons between UNIX


and Windows
– Scrips Vs .BAT files
– Shells Vs DOS Command Windows
– /etc config files Vs System Registry
– Shared library’s Vs DLL’s – Dynamic Link Libraries
– Kill Vs Task Manager
– Mkfs / newfs Vs Format and label
– 3 types of users in Linux./ 4 types of users
(Administrative(root)’,,Regular, Service) / ( Administrator, Standard, Child, Guest)
- File names are case insensitive/ Case sensitive
What is Unix ?
• Unix was originally developed in 1969 by a group of
AT&T
• There are various Unix variants available in the
market. Solaris Unix, AIX, HP Unix and BSD are a few
examples. Linux is also a flavor of Unix which is freely
available.
• Several people can use a Unix computer at the same
time; hence Unix is called a multiuser system.
• A user can also run multiple programs at the same
time; hence Unix is a multitasking environment.
• Because UNIX is community oriented, there are many different flavours of UNIX.
• This basically means that users take the base of the UNIX kernel and adapt it to their
own needs. Mac OS X is even a flavour of UNIX.
• Some other flavours include:

FreeBSD

Novell

HP/UX

Solaris

Linux
 Red Hat
 Debian
 Ubuntu
 SuSE

• On the other hand, Windows is not, it was coded and created by Microsoft. People are
not able to edit it, or change the code in any way
Unix Architecture
• The main concept that unites all the versions of Unix is the following four basics −
• Kernel − The kernel is the heart of the operating system. It interacts with the hardware
and most of the tasks like memory management, task scheduling and file management.
• Shell − The shell is the utility that processes your requests. When you type in a
command at your terminal, the shell interprets the command and calls the program
that you want. The shell uses standard syntax for all commands. C Shell, Bourne Shell
and Korn Shell are the most famous shells which are available with most of the Unix
variants.
• Commands and Utilities − There are various commands and utilities which you can
make use of in your day to day activities. cp, mv, catand grep, etc. are few examples of
commands and utilities. There are over 250 standard commands plus numerous others
provided through 3rd party software. All the commands come along with various
options.
• Files and Directories − All the data of Unix is organized into files. All files are then
organized into directories. These directories are further organized into a tree-like
structure called the filesystem.
File
• A file is a named collection of related information that is
recorded on secondary storage such as magnetic disks,
magnetic tapes and optical disks.
• In general, a file is a sequence of bits, bytes, lines or records
whose meaning is defined by the files creator and user.
File Structure

A File Structure should be according to a required format


that the operating system can understand.
– A file has a certain defined structure according to its type.
– A text file is a sequence of characters organized into lines.
– A source file is a sequence of procedures and functions.
– An object file is a sequence of bytes organized into blocks
that are understandable by the machine.
– When operating system defines different file structures, it
also contains the code to support these file structure.
– Unix and MS-DOS support minimum number of file
structure.
File Type
• File type refers to the ability of the operating system to distinguish different
types of file such as text files, source files and binary files etc. Many operating
systems support many types of files. Operating system like MS-DOS and UNIX
have the following types of files −
• Ordinary files
– These are the files that contain user information.
– These may have text, databases or executable program.
– The user can apply various operations on such files like add, modify, delete or even
remove the entire file.
• Directory files
– These files contain list of file names and other information related to these files.
• Special files
– These files are also known as device files.
– These files represent physical device like disks, terminals, printers, networks, tape drive
etc.
Special File ….

• Special files are of two types −



Character special files − data is handled character by character as in case of
terminals or printers.

Block special files − data is handled in blocks as in the case of disks and tapes.
File Access Mechanisms
• File access mechanism refers to the manner in which the records of a file may be
accessed. There are several ways to access files −

Sequential access

Direct/Random access

Indexed sequential access
• Sequential access

A sequential access is that in which the records are accessed in some
sequence, i.e., the information in the file is processed in order, one record
after the other.

This access method is the most primitive one.

Example: Compilers usually access files in this fashion.

Direct/Random access

Random access file organization provides, accessing the records directly.

Each record has its own address on the file with by the help of which it
can be directly accessed for reading or writing.

The records need not be in any sequence within the file and they need
not be in adjacent locations on the storage medium.

Indexed sequential access

This mechanism is built up on base of sequential access.

An index is created for each file which contains pointers to various blocks.

Index is searched sequentially and its pointer is used to access the file
directly.
Space Allocation
• Files are allocated disk spaces by operating system. Operating systems
deploy following three main ways to allocate disk space to files.
• Contiguous Allocation
• Linked Allocation
• Indexed Allocation
Contiguous Allocation
• Each file occupies a contiguous address space on disk.
• Assigned disk address is in linear order.
• Easy to implement.
• External fragmentation is a major issue with this type of allocation
technique.
Linked Allocation
• Each file carries a list of links to disk blocks.
• Directory contains link / pointer to first block of a file.
• No external fragmentation
• Effectively used in sequential access file.
• Inefficient in case of direct access file.

Indexed Allocation
• Provides solutions to problems of contiguous and linked allocation.
• A index block is created having all pointers to files.
• Each file has its own index block which stores the addresses of disk space
occupied by the file.
• Directory contains the addresses of index blocks of files.
Unix / Linux - File System Basics
• A file system is a logical collection of files on a partition or
disk. A partition is a container for information and can span an
entire hard drive if desired.
• Your hard drive can have various partitions which usually
contain only one file system, such as one file system housing
the /file system or another containing the /home file system.
• One file system per partition allows for the logical
maintenance and management of differing file systems.
• Everything in Unix is considered to be a file, including physical
devices such as DVD-ROMs, USB devices, and floppy drives.
Directory Structure
• Unix uses a hierarchical file system structure, much like an upside-down tree,
with root (/) at the base of the file system and all other directories spreading
from there.
• A Unix filesystem is a collection of files and directories that has the following
properties −
 It has a root directory (/) that contains other files and directories.
 Each file or directory is uniquely identified by its name, the directory in
which it resides, and a unique identifier, typically called an inode.
• By convention, the root directory has an inode number of 2 and
the lost+found directory has an inode number of 3. Inode numbers 0 and 1 are
not used. File inode numbers can be seen by specifying the -i option to ls
command.
• It is self-contained. There are no dependencies between one filesystem and
another.
• The directories have specific purposes and generally hold the same types
of information for easily locating files. Following are the directories that
exist on the major versions of Unix. 

Directory Description
/  This is the root directory which should contain only the directories needed at the top level of the file structure.

/bin This is where the executable files are located. They are available to all user.

/dev These are device drivers.

/etc Supervisor directory commands, configuration files, disk configuration files, valid user lists, groups, ethernet, hosts, where to send critical
messages.

/lib Contains shared library files and sometimes other kernel-related files.

/boot Contains files for booting the system.

/home Contains the home directory for users and other accounts.

/mnt Used to mount other temporary file systems, such as cdrom and floppy for the CD-ROM drive and floppy diskette drive, respectively.

/proc Contains all processes marked as a file by process number or other information that is dynamic to the system.

/tmp Holds temporary files used between system boots.

/usr Used for miscellaneous purposes, or can be used by many users. Includes administrative commands, shared files, library files, and others.

/var Typically contains variable-length files such as log and print files and any other type of file that may contain a variable amount of data.

/sbin Contains binary (executable) files, usually for system administration. For example fdisk and ifconfig utlities.

/kernel Contains kernel files.


Navigating the File System

• Now that you understand the basics of the file system, you can
begin navigating to the files you need. The following commands are
used to navigate the system −
S
r.
Command & Description
– Table 2 Sr.No. Command & Description

N
o.

1 cat filename Displays a filename 10 more filename Browses through a file from the beginning to the end

2 cd dirname Moves you to the identified directory 11 mv file1 file2 Moves the location of, or renames a file/directory

3 cp file1 file2 Copies one file/directory to the specified location 12 Pwd Shows the current directory the user is in

4 file filename Identifies the file type (binary, text, etc) 13 rm filename Removes a file

5 find filename dir Finds a file/directory 14 rmdir dirname Removes a directory

6 head filename Shows the beginning of a file 15 tail filename Shows the end of a file

7 less filename Browses through a file from the end or the beginning 16 touch filename
Creates a blank file or modifies an existing file or its attributes

8 ls dirname Shows the contents of the directory specified 17 whereis filename Shows the location of a file

9 mkdir dirname Creates the specified directory 18 which filename Shows the location of a file if it is in your PATH
Mounting the File System
• A file system must be mounted in order to be usable by the system. To see
what is currently mounted (available for use) on your system, use the
following command −
– $ mount
 /dev/vzfs on / type reiserfs (rw,usrquota,grpquota)

 /proc on /proc type proc (rw,odiratime)

 /devpts on /dev/pts type devpts (rw)

 $

• The /mnt directory, by the Unix convention, is where temporary mounts


(such as CDROM drives, remote network drives, and floppy drives) are
located.
• If you need to mount a file system, you can use the mount command with
the following syntax −
– mount -t file_system_type device_to_mount directory_to_mount_to
• Eg
– if you want to mount a CD-ROM to the directory /mnt/cdrom, you can type −
• $ mount -t iso9660 /dev/cdrom /mnt/cdrom
Unmounting the File System

• To unmount (remove) the file system from your system, use


the umount command by identifying the mount point or device.
– For example, to unmount cdrom, use the following command −
– $ umount /dev/cdrom
• The mount command enables you to access your file systems, but
on most modern Unix systems, the automount function makes this
process invisible to the user and requires no intervention.
Microsoft windows
• The family originated as a graphical layer on top of the older MS-
DOS environment for the IBM PC
• Modern versions are based on the newer Windows NT core.
• Windows runs on 32-bit and 64-bit Intel and AMD computers,
although earlier versions also ran on the DEC Alpha, MIPS, and
PowerPC architectures (some work was done to port it to the SPARC
architecture)
• Take near-monopoly of around 90% of the worldwide desktop
market share,

You might also like