Professional Documents
Culture Documents
1.2 Operating System and File System
1.2 Operating System and File System
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
• 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
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.
/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.
/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.
/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.
• 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
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)
$