0% found this document useful (0 votes)
12 views

CH6

Uploaded by

Aditi Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

CH6

Uploaded by

Aditi Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Ch 6

Unix
What is Unix
• The UNIX operating system is a set of programs that act as a link between
the computer and the user.
• The computer programs that allocate the system resources and coordinate
all the details of the computer's internals is called as kernel.
• Users communicate with the kernel through a program known as the shell.
The shell is a command line interpreter; it translates commands entered by
the user and converts them into a language that is understood by the kernel.
• Unix was originally developed in 1969 by a group of AT&T employees at Bell
Labs, including Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe
Ossanna.
• There are various Unix variants available in the market. Solaris Unix, AIX, HP
Unix and BSD are 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
called multitasking.
Unix Architecture

• Kernel: The kernel is the heart of the


operating system. It interacts with
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 most famous shells
which are available with most of the
Unix variants.
• .
• Commands and Utilities: There are various command
and utilities which you would use in your day to day
activities. cp, mv, cat and 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 optional options.
• Files and Directories: All data in UNIX is organized into
files. All files are organized into directories. These
directories are organized into a tree-like structure called
the filesystem
Features of UNIX OS
• Portable: UNIX can be installed on many hardware platforms. Its
widespread use can be traced to the decision to develop it using the C
language.
• Multiuser : The UNIX design allows multiple users to concurrently share
hardware and software
• Multitasking : UNIX allows a user to run more than one program at a
time. In fact more than one program can be running in the background
while a user is working foreground.
• Networking : networking is also incorporated into the heart of the
operating system. Access to another system uses a standard
communications protocol known as TCP/IP.
• Organized File System : UNIX has a very organized file and directory
system that allows users to organize and maintain files.
• Device Independence : UNIX treats input/output devices like ordinary
files. The source or destination for file input and output is easily
controlled through a UNIX design feature called redirection.
• Utilities : UNIX provides a rich library of utilities that can be use to
increase user productivity.
Booting

• When the computer is powered on or rebooted, a short


built-in program (maybe store in ROM) reads the first
block or two of the disk into memory. These blocks
contain a loader program, which was placed on the disk
when disk is formatted.
• The loader is started. The loader searches the root
directory for /unix or /root/unix and load the file into
memory
• The kernel starts to execute.

6
The first processes
• The kernel initializes its internal data structures:
it constructs linked list of free inodes, regions, page table
• The kernel creates u area and initializes slot 0 of process
table
• Process 0 is created
• Process 0 forks, invoking the fork algorithm directly
from the Kernel. Process 1 is created.
• In kernel mode, Process 1 creates user-level context
(regions) and copy code (/etc/init) to the new region.
• Process 1 calls exec (executes init).

7
init process

• The init process is a process dispatcher:spawning


processes, allow users to login.
• Init reads /etc/inittab and spawns getty
• when a user login successfully, getty goes through a login
procedure and execs a login shell.
• Init executes the wait system call, monitoring the death
of its child processes and the death of orphaned
processes by exiting parent.

8
Init fork/exec
a getty progrma
to manage the line

When the shell


dies, init wakes up
and fork/exec a
getty for the line

Getty prints The shell runs


“login:” message and programs for the
waits for someone user unitl the
to login user logs off

The login process


prints the
password message,
read the password
then check the password
9
File System Structure
Types of Files
• Simple/ordinary file, used to store info and data on secondary
storage device, typically a disk.
• It can contain a source program, an executable program such as
compilers, DB tools, pictures, audio, graphics, and so on.
• Directory files, directory file contains the name of other files and/or
directories (sub directory).
• Directories have names just like other files, and these names obey
the same naming rules as normal files.
• Link files, the link file points to the existing file, allowing you to
rename an existing file and share it without duplicating its contents.
• Special files (devices), it is a mean of accessing hardware device,
including the keyboard, hard disk, CD-ROM drive…etc.
• Each hardware device is associated with at least one special file.
• Usually they reside in the /dev directory
File System Structure
• The UNIX file system is structured hierarchically upside
down treelike, so it start with root directory and can have
any number of files or sub directories under it. A typical
UNIX system contains hundreds of files and directories,
organized as the following
root

bin tmp etc user

sh ps passwd Proj a Proj b


File System Structure (cont…)
• When you log on, the UNIX system puts you in a specific
directory, called your home/logon directory. You can specify your
home directory by using the tilde (~) when using C or Korn shell.
The directory you are in at any particular time is call Present
Working Directory pwd. Also called as current directory. The pwd
is also denoted . (pronounced dot) the parent of the pwd is ..
(dotdot).
• Pathnames can be specified in three ways
– Starting with root directory (/), absolute pathname.
– Starting with pwd, relative pathname.
– Staring with user home directory, relative pathname.
Standard Directories and Files
• Root directory (/), at the top of the file system hierarchy and
denote as a slash (/), it is the master cabinet which contains
all.
• /bin it is known as binary directory, it contains binary -
executables- images of most UNIX commands, including cat,
kill, mv, rm, echo, date, mkdir, ksh, pwd...etc. all file in this
directory either executable files or symbolic link to
executables files.
• /dev it is the device directory, contains files corresponding to
the devices (terminals, disk drives..) connected to the
computer.
• /etc, contains commands and files for system administration.
A typical user not allowed to use these files and commands.
Files in this directory include login, passwd, and profile.
Standard Directories and Files (cont…)
• /lib, contains a collection of related files for a given language in a
single file called an archive. Atypical UNIX system contains libraries
for C, C++ and other languages. The archive file is used by
application developed by that language. Some libraries are also
stored in /usr/lib directory.
• /lost+found, it contains all the files not connected to any directory.
These files are found by a UNIX tool, fsck (file system check).
• /tmp, it contains temporary files, all files are deleted periodically so
the disk does not get filled with temp files. The life of this is set by
system administrator.
• /users, normally hold the home directories of all users of the
system. It may be located in many various part of the file system
structure.
• /etc/passwd, contains one line for every user on the system and
describes login name & password
Linux Unix
Linux is just the kernel, all Unix generally comes with the kernel, and a
other programs like GUI, GNU whole host of applications, compilers,
What is it? apps, Compilers, Editors etc programs, making it a complete package.
come along with the Linux
distribution
Linux can be freely Different flavors of Unix have different cost
distributed, downloaded structures according to vendors
Cost
freely, distributed through
magazines, Books etc..
Everyone. From home Unix operating systems were developed
users to developers and mainly for mainframes, servers and
User computer enthusiasts workstations except OSX, Which is
alike. designed for everyone.

User More Userfriendly Less


Friendly
Linux can be installed on a wide The UNIX operating system is used in
variety of computer hardware, internet servers, workstations & PCs.
ranging from mobile phones, Backbone of the majority of finance
Usage tablet computers and infastructure and many 24x365 high
video game consoles, to availability solutions.
mainframes and supercomputers.
Linux is developed by Open Unix systems are divided into various
Develo Source development and it is other flavors, mostly developed by
pment distributed by various vendors. AT&T as well as various commercial
and vendors and non-profit organizations.
Distrib
ution
Linux typically provides two GUIs, Initially Unix was a command based
KDE and Gnome. But there are OS, but later a GUI was created called
GUI millions of alternatives such as Common Desktop Environment. Most
LXDE, Xfce, Unity, Mate, twm, ect. distributions now ship with Gnome.

File Ext2, Ext3, Ext4, Jfs, ReiserFS, Xfs, jfs, gpfs, hfs, hfs+, ufs, xfs, zfs format
system Btrfs, FAT, FAT32, NTFS
suppor
t
Kernal
Linux kernels are preemptive. Unix kernels are Non preemptive.
More Portable to diff architecture Less Portable to diff architecture
Portabilty

Linux has had about 60-100 viruses A rough estimate of UNIX viruses is
Security listed till date. None of them between 85 -120 viruses reported till
actively spreading nowadays. date.
Linux comes with open source UNIX operating systems comes with
netfilter/iptables based firewall tool its own firewall product

Firewall

You might also like