Sei sulla pagina 1di 44

Training Partner

UNIX and Shell Scripting


Module 2: UNIX Operating System
Architecture
Training Partner
Module 2 Objectives
Upon completing this module, the learner will be able to:
Describe Onion Architecture of UNIX Operating System
Explain the Interaction of User App with Kernel
Describe the Hierarchical Structure of UNIX File System (Virtual
File System)
Describe the Physical file System
Define a Program
Define a Process
Summarize the difference between Program and Process
Describe working of Shell
Describe different flavors of UNIX
List the services offered by UNIX Operating System

Training Partner
Module 2 Agenda
Topic Name Duration
Introduction to UNIX OS Architecture
30 min
UNIX File System
20 min
Processing Environment
35 min
Operating System Services
25 min
Training Partner

4
Introduction to UNIX OS Architecture
An Operating System (OS)
is a software component of
a computer system, which:
Shares the limited resources
of the computer
Coordinates and manages
the various activities
Offers a number of services
to application programs and
users
Acts as a host for
Applications that are run on
the machine

Printer
Monitor
Applications
Disk
Drive
Keyboard
Operating
System
Training Partner
Discussion: Features of UNIX OS (1 of 2)
Discussion topic:
What are the features of UNIX OS?

Discussion time:
5 minutes

Instructions:
Ask students about their
experience/opinions.
Write them on a flip-chart.
Training Partner
Features of UNIX OS (2 of 2)
Multi-user, Multi-tasking, Time sharing system
File structure
Modularity
Input/Output Redirection and Pipes
Consistent Peripheral Interface
Security
Communication and Networking
UNIX Utilities and Software Development Tools




Training Partner

8
UNIX Onion Architecture (1 of 2)











8










Shell
Shell
User Process
Shell
User Process
Shell
Everything below the
system call interface
and above the
physical hardware is
the KERNEL.
It provides file
system, CPU
scheduling, memory
management, and
other OS functions
using system calls.
Training Partner

9
UNIX Onion Architecture (2 of 2)










Shell
Shell
User Process
Shell
User Process
Shell
The system call
interface layer
converts a process
running in user mode
to a protected kernel
mode process.
System call provides a
programming interface
that allows user
programs to access
kernel functions.
Training Partner
User Application and Kernel Interaction
Kernel controls the underlying
hardware. The kernel provides
low-level device, memory, and
processor management functions.
Shell is a command
interpreter of UNIX.
Utilities are
set of UNIX
commands
and Programs.
Hardware
Kernel
The Operating System
Shell
Utility
Applications
User
Applications are different
softwares run on UNIX.
Users enter UNIX commands or
run different software applications.
Training Partner
Knowledge Check (1 of 3)
Which of the following are true about the operating
system?

1. It manages memory.
2. It manages processor.
3. It manages Input/Output devices.


Training Partner

12
Knowledge Check (2 of 3)
The operating system comprises a set of software
packages that can be used to manage interactions with
the hardware. The elements that are generally included in
this set of software are listed below. Which is the odd one
out?

1. Input/Output Devices
2. Shell
3. File System
4. Kernel

Training Partner

13
Knowledge Check (3 of 3)
What are system calls?
Describe their uses.

Training Partner

14
Module 2 Agenda
Topic Name Duration
Introduction to UNIX OS Architecture
30 min
UNIX File System
20 min
Processing Environment
35 min
Operating System Services
25 min
Training Partner
UNIX File System (1 of 3)
What is a file?
A collection of data items stored on a disk

What is a file system?
A group of files and relevant information regarding them
Each file system is stored in a separate whole disk partition
UNIX supports variety of files
Ordinary file
Directory file
Special files
Character special files
Block special files


Training Partner

16
Demonstration: UNIX File System (2 of 3)
For slide 17

This topic includes demonstration related to login to the UNIX system
and files in a directory. It will be conducted in the following manner:
Instructions:
Explain the command with demonstration.
Ask participants to execute the same.
Discuss the related slide.

Note: The commands would be used by the faculty and participants
simultaneously.



Training Partner

17
UNIX File System (3 of 3)
$ ls l
Gives long listing of files





Character In the first column
represents that it is an ordinary file.
Character l in the first column
represents TestFln is link for TestF1.
Character d in the first column represents directory file.
Training Partner

18
UNIX System Directories (1 of 4)

bin directory contains the
commands and utilities used by
user day to day. These are
executable binary files
The directory is located at the top of
the UNIX file system. It is represented
by the "/" (forward slash) character.
This directory contains special files used to
represent real physical devices such as
printers and terminals. For non-existent
device null is used

Training Partner

19
UNIX System Directories (2 of 4)

For system
administration, this
directory contains
various commands and
files. One of these
files, motd, contains a
'message of the day,
which is displayed
whenever we log into
the system.
For each user of
the system, this
directory
contains a home
directory.
This directory
contains libraries
that are used by
various programs
and languages.
Training Partner

20
UNIX System Directories (3 of 4)
Kernel is loaded in whenever the system is started up called booting of
the system
It is at the core of each UNIX system
It manages the entire resources of the system, presenting them to you
and every other user as a coherent system.
This directory acts as a
area to store files on
temporary basis by any
user.
Typically Application
programs, language
dictionaries, and on-line
manual pages reside in this
directory. This also contains
system files and directories
which user wants to share
with other users.
Training Partner

21
UNIX System Directories (4 of 4)
Under the root directory, subdirectories organize the files
and subdirectories on the system. These subdirectories
might be of any name.
The diagram below represents file structure as inverted
tree.









/
etc bin tmp users src
webmin usb tdlibuser User 1 User 2
Training Partner
Physical File System
Storage space on a computer usually resides on several devices and encompasses
different types of media, including hard drives, CD-ROM drives, and floppy drives.
Each of these devices has a distinct physical file system associated with it.
There are numerous types of physical file systems found under UNIX, including:
ufs
The standard UNIX File System
bffs
The Berkeley Fat Fast File System, an improvement over the original UNIX
file system
cd9660
The ISO-9660 file system for CD-ROM drives
The types of file systems available vary from OS to OS and cover a wide variety of
devices and media.
Training Partner

23
Module 2 Agenda
Topic Name Duration
Introduction to UNIX OS Architecture
30 min
UNIX File System
20 min
Processing Environment
35 min
Operating System Services
25 min
Training Partner

24
Discussion: Program in Execution (1 of 3)
Discussion topic:
What kind of programs have you
written?

Discussion time:
5 minutes

Instructions:
Ask students about their
experience/opinions.
Write them on a flip-chart.
Training Partner
Program in Execution (2 of 3)





List of Processes Before Running program
List of Processes After Running program
New process Created for the running program
Training Partner

26
Demonstration: Program in Execution
(3 of 3)
This topic includes demonstration on Program (Focus:
Functionality). It will be conducted in the following manner:
Instructions:
Explain the command with demonstration.
Ask participants to execute the same.
Discuss the related slide.

Note: The commands would be used by the faculty and participants
simultaneously.





Training Partner

27
Processing Environment
A program is a set of instructions written to perform a
specific task.

A process is:
An operation which takes the instructions given and does the
manipulations or anything that is instructed in the code itself
The single executable module that runs concurrently with other
executable modules
A program in execution
Training Partner

28
Shell as Command Interpreter
Each line that shell reads from standard input is called a pipeline.
Shell as a command interpreter:
Reads lines from standard input (each of these line is called pipeline)
Splits the command into tokens
Checks the token to see if its a keyword
Checks the first word for alias
Performs command substitution for any $(string)
Performs wildcard expansion
Looks at first word as build-in command
Runs the command

For example, following command on command prompt:
ll $(whence cc) /etc/pass*
will change to ls l /bin/cc /etc/passwd
if ll is alias to ls l
cc is in /bin directory
/etc directory has only one file starting with string pass
Training Partner

29
Knowledge Check (1 of 5)
Find the odd one out:

1. Block Special Files
2. Character Special Files
3. Disk Files
4. Ordinary Files
5. Directory Files
Training Partner

30
Knowledge Check (2 of 5)
State whether the following statements are True or False:

1. When you log into your UNIX account, you are placed in your pwd
directory.
2. The types of file systems available vary from OS to OS.
Training Partner

31
Knowledge Check (3 of 5)
Which of the following command should be used to move
to the directory above the current directory?

1. cd
2. cd ..
3. cd..
4. None
Training Partner
Knowledge Check (4 of 5)
What is the command used to see all the processes
running currently?

1. ps
2. ls
3. cd
4. ls l

Training Partner

33
Knowledge Check (5 of 5)
State whether the following statements are True or False:

1. Basic and other commands are available in bin directory.
2. Shell is also a program which keeps on running till user login.
3. Every word written on command line is command for shell.
4. UNIX allows other processes to run while running one.
5. Process is an executable module.
Training Partner

34
Module 2 Agenda
Topic Name Duration
Introduction to UNIX OS Architecture
30 min
UNIX File System
20 min
Processing Environment
35 min
Operating System Services
25 min
Training Partner

35
Discussion: UNIX Variants (1 of 3)
Discussion topic:
How many different UNIX variants have
you heard of?

Discussion time:
5 minutes

Instructions:
Ask students about their
experience/opinions.
Write them on a flip-chart.
Training Partner

36
UNIX Variants (2 of 3)
UNIX Variants
Year UNIX Variant Features
1957 BESYS At Bell Labs
To run batch jobs
1965 MULTICS
(Multiplexed Information and
Computing Service)
Adopted third generation computer
equipments
1969 UNICS
(UNiplexed Information and
Computing Service)
To play space travel on another
smaller machine (DEC PDP-7)
1971 UNIX The first edition of the "UNIX
PROGRAMMER'S MANUAL
By K. Thompson [and] D. M. Ritchie;
included over 60 commands
Training Partner

37
UNIX Variants (3 of 3)
UNIX Popular Variants

UNIX Variant Features
AIX
(Advanced Interactive eXecutive)
Developed By IBM in 1990
Shells available (Korn, Bourne, C)
Default Korn shell
BSD
(Berkeley Software Distribution)
Developed at the Computer System
Research Group (CSRG)
Sun Solaris Sun company's UNIX variant operating
system
MINIX A free UNIX clone written from scratch
Small size
Micro kernel-based design and simple
documentation
Suited for personal computer
Training Partner
LINUX
Developed by Linus Torvalds

Freely available multitasking and multi-user operating system

Placed under General Public License

Variants
Caldera Linux
Debian Linux
Kondara Linux
Red Hat Linux
Mandrake Linux
SuSE Linux

Training Partner

39
UNIX Flavors
All proprietary UNIX flavors and their names are respective
trademarks of the originating entity/vendor.












Originator Proprietary Name
U. Cal. Berkley BSD
Sun Solaris
IBM AIX
HP HP - UX
SGI IRIX
Digital Equipment
2
DEC UNIX
Compaq Tru64 UNIX
3
Apple MacOS X
4
L. Torvalds/GNU
5
Linux
6
Training Partner
Kernel (1 of 2)
Kernel is the heart of OS and performs various operations on
behalf of the user processes, like:
Permitting process controlled access
Devices like terminals
Disk and tape drives
Network drives
Controlling the process execution
Creation
Termination
Suspension
Communication
Training Partner

41
Kernel (2 of 2)
Efficient retrieval and storage of user data
By allocating storage
By reclaiming unused storage
Protecting
Time sharing
Suspending the process
Rescheduling the processes
Sharing of main memory
Swapping system
Training Partner
Knowledge Check (1 of 2)
Which one from the following service support more than
one user to use the UNIX system at the same time?

1. Modularity
2. File Structure
3. Multitasking
4. Input-Output Redirections and Pipes
Training Partner

43
Knowledge Check (2 of 2)
State whether the following statements are True or False:

1. Portability is the ability of software to operate on different types of
machines (often called platforms).
2. In UNIX systems, a user can initiate more than one task to run at a
time from the same terminal.
3. UNIX has a hierarchical file structure. It is like an inverted tree,
having the Child at the top.
4. A UNIX system consists of various tools that help the programmers
to develop different applications.
Training Partner
Module 2 Summary
Upon completing this module, you should now be able to:
Describe Onion Architecture of UNIX Operating System
Explain the Interaction of User App with Kernel
Describe the Hierarchical Structure of UNIX File System (Virtual File System)
Describe the Physical file System
Define a Program
Define a Process
Summarize the difference between Program and Process
Describe working of Shell
Describe different flavors of UNIX
List the services offered by UNIX Operating System
Training Partner
Questions and Comments
What questions or
comments do you have?

Potrebbero piacerti anche