UNIX
Unit 1- Architecture of Unix
- By Pratima
2
Unix Architecture
Typical computer system consists of:HardwareOperating systemApplications and utilities
Typical OS includes a user interface or command interpreter
3
Unix Architecture
4
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
6
Levels of Unix Software
Unix uses a layer approach of defining softwareLayered approach is basis for Unix security
At the lowest level, the level closest to the hardware, are the basic hardware interface modulesProcess schedulingMemory management Interrupt handlingLow level device controlDisk system management and data bufferingProcess synchronization and inter-process
communication (IPC)
7
Unix Functional Layer Model
8
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.
9
Shell
The uppermost layer consists of user processes running:ShellsUnix commandsUtility programsUser application programs
User processes:Protected from from other usersHave no access to Unix kernel routines except
through the system call interfaceCannot directly access kernel memory space
10
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)
11
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
12
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 systemThe Process is an entity, name given to a file
wen its executed as a program – IT also belongs to a separate hierarchical
tree structure
13
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
14
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 processName of the processAmount of user and system CPU time usedElapsed (wall clock) timeAverage amount of memory usedNumber of disk I/O operations doneUID and GID of the processTerminal from which the process was started
15
Features
A Multiuser SystemA Multitasking SystemThe Building-Block ApproachThe Unix ToolkitPattern MatchingProgramming FacilityDocumentation