0% found this document useful (0 votes)
44 views9 pages

Unix Architecture: Typical Computer System Consists of

Uploaded by

learn409
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views9 pages

Unix Architecture: Typical Computer System Consists of

Uploaded by

learn409
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Unix Architecture

q Typical computer system consists of:


u Hardware
u Operating system
u Applications and utilities

q Typical OS includes a user interface or command


interpreter
q Unix is somewhat unique in that the command
interpreter is not integrated with the OS but is a
separate program

ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer


1

Unix Architecture

2
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer

1
Levels of Unix Software

q Unix uses a layer approach of defining software


u Layered approach is basis for Unix security
q At the lowest level, the level closest to the
hardware, are the basic hardware interface
modules
u Process scheduling
u Memory management
u Interrupt handling
u Low level device control
u Disk system management and data buffering
u Process synchronization and inter-process
communication (IPC)
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer
3

Unix Functional Layer Model

4
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer

2
Kernel Services Layer

q The next level provides all the kernel services


u Mapping between user requests and device driver
actions
u The user system call is converted to a kernel service
call that actually performs the requested service
l Process creation and termination

l I/O services

l File/disk access services

l Terminal handling services

ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer


5

System Call Interface Layer

q The system call interface layer converts a process


running in user mode to a protected kernel mode
process
u This allows the program to invoke protected kernel
routines to perform system functions

6
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer

3
User Process Layer

q The uppermost layer consists of user processes


running:
u Shells
u Unix commands
u Utility programs
u User application programs

q User processes:
u Protected from from other users
u Have no access to Unix kernel routines except through
the system call interface
u Cannot directly access kernel memory space

ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer


7

Kernel vs User Space

q In addition to the software levels, Unix also


features two "rings of protection" from inadvertent
programming errors or malicious attacks that
might damage other user's processes or the
kernel's processes and data structures
q The inner protected ring is known as kernel space
q The outer ring is called user space

8
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer

4
User Space

q User space is the area in memory where user


processes are run
q This consists of memory starting above the kernel
and includes the rest of available memory
q This memory is protected; the system prevents
one user from interfering with another
q Only kernel process can access a user process
q A process operating in this memory region is said
to be operating in user mode

ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer


9

Kernel Space

q Kernel space is the region of memory where all


kernel services are provided via kernel processes
q Any process executing in kernel space is said to
be executing in kernel mode
q Kernel space is a privileged area; the user has
access to it only through the system call interface
q A user does not have direct access to either all
machine instructions or devices
q A kernel process does have direct access to both

10
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer

5
q Also, a kernel process can modify the memory
map, an operation frequently required to perform
process scheduling
q A user process becomes a kernel process when it
executes a system call and starts executing
kernel code

ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer


11

Data Flow Between Kernel and User Space

q Since users and the kernel do not share memory


address space, the mechanism for moving data
between them is important
q When a system call is executed, the arguments to
the call and the corresponding kernel routine
identification are passed from user space to
kernel space
q Kernel routine ID is usually passed either via a
hardware machine register or via the stack
q System call arguments are passed in the u area
(user area) of the calling process

12
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer

6
q u area of a process (user structure and kernel
stack) contains information about the process the
kernel needs while the process is running
u Open files, root, current directory, arguments to current
system call, and process text, stack, and data segment
sizes
u A pointer to the process table entry containing
information for scheduling such as priority
u User file descriptor table and information about open
files
u Kernel stack for the process (empty when executing in
user mode)
q Remember, user cannot access kernel space but
kernel space can access user space
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer
13

Unix Command Interface and Commands

q Unix command interface is a separate program


referred to as the shell
q The shell provides the user interface between the
user and the kernel
q Unix commands and utilities, like the shell, are
also separate programs
q They are part of a Unix distribution, and are
considered part of Unix but not part of the kernel

14
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer

7
Unix System Services

q Unix provides a number of system services such


as systems administration, system
reconfiguration, and file system maintenance
q Other services include
u Customization of system parameters
u Rebuilding of kernel with user drivers
u Creation and definition of user accounts
u Set up and maintenance of access control parameters
for files and peripherals
q Most services are built into the kernel as system
calls

ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer


15

Unix System Calls

q System calls provide a programming interface that


allows user programs to access kernel functions
q There are a large number of system calls that
perform functions to manage system resources
such as memory, disk storage, and peripherals
q 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
q The shell also provides functionality equivalent to
many of the system calls

16
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer

8
System Usage Accounting Services

q Unix provides some general accounting services


q As each process terminates, an accounting record
is made available describing the resources used
by the process
u Name of the process
u Amount of user and system CPU time used
u Elapsed (wall clock) time
u Average amount of memory used
u Number of disk I/O operations done
u UID and GID of the process
u Terminal from which the process was started

ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer


17

My Best Unix System Programming Book

W. Richard Stevens, $65.95


18
ITSW 2436/KRF Copyright © 2001 by Kenneth R. Frazer

You might also like