of 50
8/9/2019 1 History of Unix 1
1/50
1
Faculty : Vinay
Email : [email protected]
8/9/2019 1 History of Unix 1
2/50
Evolution of UNIX
UNIX System Structure
Features of Unix
Operating System Services
Unix Kernel
Architecture of Unix
System Concepts
Kernel Data Structures
Introduction to System Calls
Types of System Calls.
8/9/2019 1 History of Unix 1
3/50
3
Computer systems didn't talk to each other in the earlydays of computing. Even the various computer system made
by the same company often needed interpreters.
Introduction
A
nd no interoperability of systems by different vendors.
In addition, operating systems very often performedonly limited tasks, and only on the machines for whichthey were written. If a business upgraded to a bigger,
more powerful computer, the old operating systemprobably wouldn't work on the new computer, andoften the company's data had to be entered -- again -- into
the new machine.
8/9/2019 1 History of Unix 1
4/50
4
To try to develop a convenient, interactive, useablecomputer system that could support many users, a group of
computer scientists from Bell Labs and GE in 1965 joinedan effort underway at MIT on what was called the MULTICS(Multiplexed Information and Computing Service)mainframe timesharing system.
The Unix operating system found its beginnings in MULTICS.
In 1969 Bell Laboratories pulled out of the project.
One of Bell Laboratories people involved in theproject was Ken Thompson. He liked the potentialMULTICS had, but felt it was too complex and that thesame thing could be done in simpler way.
History of Unix
8/9/2019 1 History of Unix 1
5/50
5
In 1969 he wrote the first version ofUnix, called
UNICS. UNICS stood for Uniplexed Operating andComputing System.
Although the operating system has changed, the
name stuck and was eventually shortened to
UNIX.
Ken Thompson teamed upwith Dennis Ritchie, whowrote the first C compiler.
In 1973 they rewrote theUnix kernel in C.
History of Unix
8/9/2019 1 History of Unix 1
6/50
6
The following year a version of Unix known as the FifthEdition was first licensed to universities. The SeventhEdition, released in 1978 served as a dividing point for twodivergent lines of Unix development. These two branches areknown as SVR4 (System V) and BSD (Berkeley SoftwareDistribution) .
The Linux operating system was developed as a Unixlook alike and has a user command interface thatresembles SVR4.
Many companies developed and marketed their ownversions of UNIX in subsequent years.
History of Unix
8/9/2019 1 History of Unix 1
7/50
7
Variations of UNIX include AIX, a version
of UNIX adapted by IBM to run on RISC-
based workstations
A/UX, a graphical version for the Apple
Macintosh
XENIX OS, developed by Microsoft
Corporation
SunOS, adapted and distributed by Sun
Microsystems, Inc.; Mach, a UNIX-
compatible operating system for the NeXT
computer;
and Linux, developed by Finnish
computer engineer Linus Torvalds with
collaborators worldwide.
8/9/2019 1 History of Unix 1
8/50
8
AIX by IBM
BSD/OS (BSDi) by Wind RiverCLIX by Intergraph Corp.
Debian GNU/Linux by Software in the Public Interest, Inc.
Tru64 Unix (formerly Digital Unix) by Compaq Computer Corp.
DYNIX/ptx by IBM (formerly by Sequent Computer Systems)
Esix Unix Esix Systems
FreeBSD by FreeBSD GroupGNU Herd by GNU Organization
HAL SPARC64/OS by HAL Computer Systems, Inc.
HP-UX by Hewlett-Packard Company
Irix by Silicon Graphics, Inc.
Linux by several groups several
LynxOS by Lynx Real-Time Systems, Inc.MacOS X Serverby Apple Computer, Inc.
NetBSD by NetBSD Group
OpenBSD by OpenBSD Group
OpenLinux by Caldera Systems, Inc.
Openstep by Apple Computer, Inc.
NonStop-UX by Compaq Computer Corporation
UNIX Flavors
Red Hat Linux by Red Hat Software, Inc.
Reliant Unix by Siemens AG
SCO Unix by The Santa Cruz Operation Inc.
Solaris by Sun Microsystems
SuSE by S.u.S.E., Inc.
UNICOS by Silicon Graphics, Inc.
UTS by UTS Global, LLC
8/9/2019 1 History of Unix 1
9/50
9
For startup companies, UNIX has really priced itselfout of the market. Licensing fees for SVR4 and OSF/1 are
prohibitive for a company that doesn't have very, verydeep pockets.
With Sun Microsystems' first workstation, UNIXwas the software that ran on the best low-cost available
hardware. For a given price, you could get much moreperformance than was possible before.
As soon as Microsoft released Windows NT in the market , thepopularity of Unix decreased little bit. Then with success with
The Windows NT people started shifting from UNIX toWindows NT.
Later when they came to know the problem with NT they realizedthat UNIX was better.
History of Unix
8/9/2019 1 History of Unix 1
10/50
10
The Connection Between Unix and C
At the time the first Unix was written, most operating systems
developers believed that an operating system must be written inan assembly language so that it could function effectively and gainaccess to the hardware. Not only was Unix innovative as an operatingsystem, it was ground-breaking in that it was written in a language(C) that was not an assembly language.
The C language itself operates at a level that is just highenough to be portable to variety of computer hardware. Agreat deal of publicly available Unix software is distributedas C programs that must be complied before use.
Many Unix programs follow C's syntax. Unix system calls areregarded as C functions.
What this means for Unix system administrators is that anunderstanding of C can make Unix easier to understand
8/9/2019 1 History of Unix 1
11/50
11
Unix is a multi-user, multi-tasking operating system. You can have
many users logged into a system simultaneously, each running many
programs.
Its the kernels job to keep each process and user separate and to
regulate access to system hardware, including cpu, memory, disk and
other I/O devices.
8/9/2019 1 History of Unix 1
12/50
12
Why Use UNIX ?
One of the biggest reasons for using Unix isnetworking capability. With other operating systems,additional software must be purchased for networking.With Unix, networking capability is simply part of theoperating system. Unix is ideal for such things as world
wide e-mail and connecting to the Internet.
Unix was founded on what could be called a "smallis good" philosophy. The idea is that each program is
designed to do one job well. Because Unix was developed bydifferent people with different needs it has grown to anoperating system that is both flexible and easy to adaptfor specific needs.
8/9/2019 1 History of Unix 1
13/50
13
Unix was written in a machine independentlanguage. So Unix and UNIX-like operating systems
can run on a variety of hardware. These systems are
available from many different sources, some of them at no
cost.
Because of this diversity and the ability to utilize the same
"user-interface" on many different systems, Unix is said to
be an open system.
Why use Unix
8/9/2019 1 History of Unix 1
14/50
14
An Overview of UNIX Operating system
The UNIX operating system was designed tolet a number of programmers access the computer atthe same time and share its resources
The operating system coordinates the use of thecomputer's resources, allowing one person, forexample, to run a spell check program while anothercreates a document, lets another edit a documentwhile another creates graphics, and lets another user
format a document -- all at the same time, with eachuser oblivious to the activities of the others.
8/9/2019 1 History of Unix 1
15/50
15
The operating system controls all of thecommands from all of the keyboards and all of the
data being generated, and permits each user tobelieve he or she is the only person working on thecomputer.
Overview of Unix OS
This real-time sharing of resources make UNIXone of the most powerful operating systems ever
Although UNIX was developed by programmersfor programmers, it provides an environment sopowerful and flexible that it is found in businesses,
sciences, academia, and industry. Manytelecommunications switches and transmissionsystems also are controlled by administration andmaintenance systems based on UNIX.
8/9/2019 1 History of Unix 1
16/50
16
While initially designed for medium-sizedminicomputers, the operating system was soon moved to
larger, more powerful mainframe computers.As personal computers grew in popularity, versions
of UNIX found their way into these boxes, and a number ofcompanies produce UNIX-based machines for thescientific and programming communities.
Overview of Unix OS
8/9/2019 1 History of Unix 1
17/50
17
The Uniqueness of UNIX
The features that made UNIX a hit from the start are:
Multitasking capability
Multi-user capability
Portability
UNIX programs
Library of application software
8/9/2019 1 History of Unix 1
18/50
18
Many computers do just one thing at a time, as anyonewho uses a PC or laptop can attest. Try logging onto yourcompany's network while opening your browser while openinga word processing program. Chances are the processor will
freeze for a few seconds while it sorts out the multipleinstructions.
UNIX, on the other hand, lets a computer do severalthings at once, such as printing out one file while the useredits another file. This is a major feature for users, since usersdon't have to wait for one application to end before startinganother one.
Multitasking
Uniqueness of UNIX
8/9/2019 1 History of Unix 1
19/50
19
The same design that permits multitaskingpermits multiple users to use the computer. Thecomputer can take the commands of a number ofusers -- determined by the design of the computer --to run programs, access files, and print documents at
the same time.
The computer can't tell the printer to print all therequests at once, but it does prioritize the requests tokeep everything orderly. It also lets several usersaccess the same document by compartmentalizing thedocument so that the changes of one user don'toverride the changes of another user.
Multi-Users
Uniqueness of UNIX
8/9/2019 1 History of Unix 1
20/50
20
A major contribution of the UNIX system wasits portability, permitting it to move from one brand ofcomputer to another with a minimum of codechanges. At a time when different computer lines of
the same vendor didn't talk to each other -- yet alonemachines of multiple vendors -- that meant a greatsavings in both hardware and software upgrades.
It also meant that the operating system couldbe upgraded without having all the customer's datainputted again. And new versions of UNIX werebackward compatible with older versions, making iteasier for companies to upgrade in an orderly manner
System portability
Uniqueness of UNIX
8/9/2019 1 History of Unix 1
21/50
21
FEATURES AND BENEFITS OF UNIXFEATURES AND BENEFITS OF UNIX
The UNIX operating System is available on machineswith a wide range of computing power, frommicrocomputers to mainframes, and on differentmanufacturers machines. No other operating system
can make this claim. The popularity and success of UNIX isdue to the following reasons:
PORTABILITY :
The system is written in a high level languagemaking it easier to read, understand, change and, thereforemove to other machines. The code can be changed andcompiled on a new machine. Customers can choose from awide variety of hardware vendors without being locked
with a particular vendor.
[ 6 Marks ]Features of UNIX
8/9/2019 1 History of Unix 1
22/50
22
Machine Independence :
The system hides the machine architecture from theuser, making it easier to write applications that can run
on micros, minis and mainframes.
Multi User Operations :
UNIX is a multi-user system designed to support agroup of users simultaneously. The system allows for thesharing of processing power and peripheral resources,while at the same time providing excellent security features..
Hierarchical File System :
UNIX uses a hierarchical file structure to storeinformation. This structure has the maximum flexibility ingrouping information in a way that reflects its naturalstate. It allows for easy maintenance and efficient
implementations.
Features of UNIX
8/9/2019 1 History of Unix 1
23/50
23
UNIX SHELL :UNIX has a simple user interface called the shell
that has the power to provide the services that the userwants. It protects the user from having to know the intricatehardware details.
PIPES and FILTERS :
UNIX has facilities called pipes and filters whichpermit the user to create complex programs from simpleprograms.
Utilities :
UNIX has over 200 utility programs for variousfunctions. New utilities can be built effortlessly by combiningexisting utilities.
Features of UNIX
8/9/2019 1 History of Unix 1
24/50
24
Background Processing :UNIX has a facility by which the user can start a
process and then proceed to work on other processes whilethe system runs the first process in background and thesecond process in the foreground. Background processinghelps the user in effective utilization of time.
Software Development Tools :UNIX offers an excellent variety of tools for softwaredevelopment for all phases, from program editing tomaintenance of software..
Maturity :
UNIX is a time-based operating system. It offers abug-free environment and ahigh level reliability.
The UNIX system supports a wide variety oflanguages :C, FORTRON, BASIC, PASCAL, Ada, COBOL, Lisp, Prolog.
Features of UNIX
8/9/2019 1 History of Unix 1
25/50
25
Some more features :
Input / Output redirection and Pipes
Consistent Peripheral Interface
Communication and Networking
8/9/2019 1 History of Unix 1
26/50
26
UNIX System Structure
The UNIX system is functionally organized at 3 levels:
1 The kernel,[ core of UNIX System]
which schedules tasks and manages storage.
2 The shell,[ interpreter b/w User and Computer]
which connects and interprets users'commands, calls programs from memory, and
executes them, and
3 The tools and applications that offer additionalfunctionality to the operating system.
How UNIX is organized
[ 10 Marks ]
8/9/2019 1 History of Unix 1
27/50
27
4. Utility Programs
5User programs can be developed using UNIX utilities,
purchased from software suppliers.
8/9/2019 1 History of Unix 1
28/50
28
Highlevel of UNIX
Architecture
[ 10 Marks ]
User
User
Hardware
Kernel
8/9/2019 1 History of Unix 1
29/50
29
Any Command cannot be executed unless it obtains the clearanceof the Shell .
The Shell , when analyzing the command and its associatedarguments often modifies and simplifies its input before Itforwards it to another agency which Actually executes thecommand.
This agency is called the KERNEL .
UNIX permits the use of complex command structures that cantbe understood by the kernel, the shell has to take on the role ofinterpreter to translate them into forms that the kernel can
understand.
The shell , is actually the interface between the user and thekernel that effectively insulates the user from knowledge ofkernel functions.
8/9/2019 1 History of Unix 1
30/50
30
Kernel
Core of the Unix system
Interacts directly with the hardware
Insulates other parts of UNIX from hardware
Performs all low level functions
Parts of the kernel deals with I/O devices , called device drivers
All programs and applications interact with the kernel
8/9/2019 1 History of Unix 1
31/50
31
The KERNEL
The kernel is the heart of he system a collection of programs mostly written in C that directly communicate withhardware. There is only one kernel for any system. Its that part ofthe UNIX system that is loaded into memory when the system is
booted.
Kernel does not directly deal with the user. Instead it starts a separateprogram called shell , which actually interacts with the user andinterprets the command
It directly interacts with hardware , parts of the kernelmust be customized to each systems hardware features.
UNIXArchitecture / kernel[ 10 Marks ]
8/9/2019 1 History of Unix 1
32/50
32
Functions Performed by Kernel
Memory management
Process scheduling
File Management and security
Interrupt handling and error reporting
Input / Output services
Date and Time services
System Accounting
8/9/2019 1 History of Unix 1
33/50
33
[ 10 Marks ]
Functions Performed by Kernel
Managing the machines memory and allocating it to each
process
Scheduling the work done by the CPU so that the work ofeach user is carried as efficiently as is possible.
Organizing the transfer of data from one part of the machineto another.
Accepting instructions from the shell and carrying them
out.
Enforcing the access permissions that are in force on the file
system .
UNIXArchitecture / kernel
8/9/2019 1 History of Unix 1
34/50
34
8/9/2019 1 History of Unix 1
35/50
35
KERNEL LEVEL
File subsystem : this takes care of where to store , how to retrieve, and therelated job with files (data)
Process subsystem : this comprises of IPC, scheduler and Memory
management
IPC stands for Interprocess Communication between the processes .
The techniques used in UNIX for this IPC are pipes, messages, shared
memory and semaphores.
Scheduleris responsible for scheduling the processes.
Memory Management is about where to place a program in memory,
allows programs of bigger than the memory size to be executed.
8/9/2019 1 History of Unix 1
36/50
36
8/9/2019 1 History of Unix 1
37/50
37
Interface for the user to access services from the kernel
Is the command interpreter of UNIX
Provides powerful programming capabilities
The SHELL
The Shell is a utility program that comes with the UNIX
system. However, it plays a very important role. It acts as the
command interpreter for the kernel and is the interface betweenthe user and the kernel.
8/9/2019 1 History of Unix 1
38/50
38
Shell features and Benifits
InteractiveProcessing :Communication between the users and the system takes the form of an interactive
dialogue with the shell.
Background Processing :
Time-consuming, non-interactive tasks can proceed while the user continues with other
processing. Therefore, the system can perform many different tasks at the same time
on behalf of a single-user.
Input/Output Redirection :Programs designed to interact with user can easily be instructed to take their input
from another source, such as a file, and send their output to another destination, such
as printer.
[ 5 Marks ]
8/9/2019 1 History of Unix 1
39/50
39
Shell Scripts :
A frequently used sequence of shell commands can be stored in a file. The
name of the file can later be used to execute the stored sequence with a singlecommand.
Shell Variables :
The user can control the behavior of the shell, as well as other programs and
utilities, by storing data in variables.
Programming Language Constructs :
The shell includes features that allow it to be used as a programming
language. These features can be used to build shell scripts that perform complex
operations.
Pipes:
Programs that perform simple functions can easily be connected to performmore complex functions , minimizing the need to develop new programs.
8/9/2019 1 History of Unix 1
40/50
8/9/2019 1 History of Unix 1
41/50
41
Login
Shell ask
for a
command
User
Types
Command
Shell
Executes
utility to
carry out
command
User
Interacts
with Utility
Shell ask
for next
command
User
Types
Control D
Logout
Using the UNIX Shell
8/9/2019 1 History of Unix 1
42/50
42
Sh ( Bourne shell) Written by S.R. Bourne
It is the granddaddy of Unix Shells. This is still Widely used Today.
As a scripting language, this shell provides all the necessary
constructs to create structured programs. Permits you to open or duplicate arbitrary file descriptors.
Fastest UNIX command processor available.
* Lack of command line editing features and Job Control
[2 or 6 Marks ]
[There are 7 types shells are available ]
8/9/2019 1 History of Unix 1
43/50
43
Csh ( C-Shell ) written by Bill Joy ( University Of
California )
C-Shell supports a full range of structured programming constructs.
C-Shell weak in supporting I/O redirection.
As name it self says supports , C (language ) like syntax.
* Does not permits you to open / duplicate arbitrary file descriptors.
* Less suitable for complex Shell Programming due to its implementation
Characteristics.
Ksh ( Korn-Shell ) written by David (AT & T Lab )
Combines both Bourne Shell and C-Shell. It includes job control,
aliasing and an improved command history and editing facilities
introduced by C-Shell, along with stronger syntactical language of the
Bourne Shell.
[ 6 Marks ]
8/9/2019 1 History of Unix 1
44/50
44
bash ( -Shell ) part of Free Software Foundations (FSF)
excellent suite of Unix tools. It matches the Korn shell feature.
Which is owned by AT & T, bash is freely available. It also
maintains a high degree of compatibility with the Bourne shell
and can run that shells script without any modifications
Tcsh replacement for C-Shell
Pdksh it is a compatible public-domain implementation of the korn shell.
Zsh written by paul Falstad.zsh is another richly featured, freely available Bourne/Korn based
shell.
8/9/2019 1 History of Unix 1
45/50
45
System call
UNIX system and application programs call on the kernel to perform services for them.
The mechanism used to request kernel services is called a system call.
Each system call instructs the kernel to perform one particular service on behalf of the
program making the call.
For example , each time an application program wants to read a line of user input from
a terminal , the program calls the kernel, which obtains the requested data and passes
it on to the program.
System calls are the interface between UNIX-based applications programs and theUNIX kernel. These calls are the only way that application programs and the kernel
interact directly in a UNIX based system.
8/9/2019 1 History of Unix 1
46/50
46
User Program
( Requests Services )
UNIX System Kernel
(Provides Services)
Call
Request services
-Type
-Details
-Data
Return
Service complete
-Status-Data
Anatomy of a System Call
8/9/2019 1 History of Unix 1
47/50
47
The UNIX kernel supports over sixty different system calls. These calls are identical
on every UNIX system. No matter what hardware differences exists down below or
whether the system is an IBM PC or a mainframe , the system calls are the same.
Thus the system calls form a standard interface for the UNIX system.
8/9/2019 1 History of Unix 1
48/50
48
System calls for low level file I/O
creat(name, permissions)
open(name, mode)
close(fd)
unlink(fd)
read(fd, buffer, n_to_read)
write(fd, buffer, n_to_write)
lseek(fd, offest, whence)
System Calls for process control
fork()
wait()
execl(), execlp(), execv(), execvp()
exit()
signal(sig, handler)
kill(sig, pid)System Calls for IPC
pipe(fildes)
dup(fd)
Some System call
8/9/2019 1 History of Unix 1
49/50
49
File Structure
Hierarchical Structure
Consistent treatment of data files
Ability to create and delete files
Dynamic growth of files
Protection of file data
Treatment of peripheral devices as files
8/9/2019 1 History of Unix 1
50/50
50
The File system consist of all types of files and resembles an
inverted tree structure
The directories can have sub directories resulting in a large
hierarchical structure
A hierarchical file structure provides higher system performance,
sheltering private data from unauthorized users and enhancingsecurity against unintentional damage .
UNIX treats Input / Output devices as files . UNIX stores all files
as stream of bytes.
Space is allocated dynamically according to the size of the file
which changes in the
number of bytes.