Chap-2-Architecture

Download Report

Transcript Chap-2-Architecture

UNIX
Unit 1- Architecture of Unix
- By
Pratima
Unix Architecture

Typical computer system consists of:




Hardware
Operating system
Applications and utilities
Typical OS includes a user interface or
command interpreter
2
Unix Architecture
3
Unix Architecture
UNIX is no longer a small system but it
certainly is a powerful one.
 Layered approach is basis for Unix
security
1. Division of Labor: Kernel n Shell
2.The File Process
3.The System Calls
4
Levels of Unix Software

Unix uses a layer approach of defining software


Layered approach is basis for Unix security
At the lowest level, the level closest to the
hardware, are the basic hardware interface
modules






Process scheduling
Memory management
Interrupt handling
Low level device control
Disk system management and data buffering
Process synchronization and inter-process
communication (IPC)
6
Unix Functional Layer Model
7
1. Division of Labor: Kernel & Shell

“Filter ideas” is division of labor between two agencies- The Kernel
and Shell
– The Kernel interacts with the machine's hardware & the Shell with
the user (Mapping between user requests and device driver actions)
– The Kernel is the core of the operating system
1. Its a collections of routines mostly written in c
2. Its loaded into memory when its booted n communicates with hardware
directly
3. Programs access the Kernel through set of System calls

It actually also performs the requested service

Process creation and termination (Schedules the process)

I/O services

File/disk access services (manages sys memory)

Terminal handling services

Decides the Priorities n perform other tasks.
8
Shell

The uppermost layer consists of user processes
running:





Shells
Unix commands
Utility programs
User application programs
User processes:



Protected from from other users
Have no access to Unix kernel routines except
through the system call interface
Cannot directly access kernel memory space
9
Shell
Command Interpreter is a job that is handled by the
outer part of the OS called as Shell
OR
Unix command interface is a separate program referred
to as the shell
• The Shell actually acts as an interface between user &
the Kernel

There could be several Shells in action-one for each
user who logged in.
 After using commands, shell communicates with Kernel
to see that command is executed.
 It is represented by sh(Bourne shell), csh(C shell),
ksh(Korn shell) or bash(Bash shell)

10
Kernel Space





Kernel space is the region of memory where all
kernel services are provided via kernel
processes
Any process executing in kernel space is said to
be executing in kernel mode
Kernel space is a privileged area; the user has
access to it only through the system call
interface
A user does not have direct access to either all
machine instructions or devices
A kernel process does have direct access to
both
11
2. The File and Process


“File have places and Process have Life”
– A File is a an array of bytes n also a part of
single hierarchical structure.
– Can be moved from one place to another
– It considers even directories and devices as a
single file system
The Process is an entity, name given to a file
wen its executed as a program
– IT also belongs to a separate hierarchical
tree structure
12
3. The System Calls





System calls provide a programming interface that
allows user programs to access kernel functions
There are a large number of system calls that perform
functions to manage system resources such as
memory, disk storage, and peripherals
System calls are defined in a run-time library that
provides a mapping of the system call interface to the
kernel routine(s) that perform the system functions
The shell also provides functionality equivalent to
many of the system calls
System call arguments are passed in the u area (user
area) of the calling process
13
System Usage Accounting
Services


Unix provides some general accounting
services
As each process terminates, an accounting
record is made available describing the
resources used by the process







Name of the process
Amount of user and system CPU time used
Elapsed (wall clock) time
Average amount of memory used
Number of disk I/O operations done
UID and GID of the process
Terminal from which the process was started
14
Features







A Multiuser System
A Multitasking System
The Building-Block Approach
The Unix Toolkit
Pattern Matching
Programming Facility
Documentation
15