You are on page 1of 34

CHAP 14

SYSTEM DESIGN
Overview of system design
During system design choose high level
strategy-system architecture for solving
problem & building solution
Developer makes decision about how the
problem will e solved
Developer decides overall structure & style,
determines the organization of system into
subsystem.
During design make following decisions
ESTIMATE SYSTEM PERFORMANCE
MAKE REUSE PLAN
ORGANIZE SYSYTEM INTO SUBSYSTEM
IDENTIFY CONCURRENCY
ALLOCATE SUBSYSTEM TO H/W
MANAGE DATA STORE
HANDLE GLOBAL RESOURCE
CHOOSE S/W CONTROL STRATEGY
HANDLE BOUNDARY CONDITION
SET TRADEOFF PRIORITIES
SELECT ARCHITECTURAL STYLE
ESTIMATE SYSTEM
PERFORMANCE
Prepare a rough performance estimate
engineer call this a back of the envelope
calculation
Purpose is to Determine if system is feasible,
what you can achieve depends on the
problem.
Calculation should be fast &
involve common sense decisions
Make simplifying assumptions
ATM EX:- the bank has 40 branches & there
are equal no. of terminal in store &
supermarket.
Half terminals are busy at once & customer
takes 1 min to perform one session & most
transaction involve single deposit or withdrawal.
So we estimate about 40 transaction a min it
shows that we do not require unusually fast
computer h/w
For estimate of data storage
Count the no. of customers, Estimate amount of
data for each one & multiply.
In case of bank for data storage are diff. than
for ATM
MAKE REUSE PLAN
Reuse is advantage of OO technology
There are two ways to for reuse
Using existing things
Creating reusable new things
It is much easier to reuse existing things than to
design new things
Reusable things include models, libraries,
frameworks & patterns.
LIBRARIES:-
Good organization takes a lot of work & it can be
difficult to decide where to place everything
Its a collection of classes that are useful in many
context & classes must have accurate & thorough
description to help user.
A good class library should be
Organized in few well focused themes
Provide complete behavior for theme
Have Consistency in names & signature
across classes
Have Efficiency in time & space
Able to define subclasses for library class
Problems can arise when integrating class
libraries from multiple sources as shown below
ARGUMENT VALIDATION:-An application may
validate arguments as a collection or
individually as entered
A combination of class library some validate by
collection & other that validate by individually
yields awkward user interface

ERROR HANDLING:-class libraries use diff.


error handling techniques
Method in one library may return error code
while other may deal with error
Control Paradigms :- Applications may adopt
event driven or procedure driven control & it is
difficult to combine both kind of user interface

Group Operations:- are often insufficient &


incomplete.
EX:-object delete may require db lock , make
deletion & commit transaction
So class library must have group deletion
function

Name Collision:-Class names, public attribute &


public methods lie within global space so you
must hope that they do not collide for diff. class
FRAMEWORKS:-
Its a skeletal structure of a program that must be
elaborated to build a complete application.
Specialize abstract class, add sub classes

PATTERNS:-
Its a proven solution to general problem.
Various patterns target diff. phases of s/w
development lifecycle.
There are patterns for analysis, architecture,
design & implementation. also achieve reuse by
using existing patterns
Benefits of patterns
A pattern is more likely to be correct & robust
than untested, custom solution
When you use patterns, you tap into language
that is familiar to many developer
Information is avail that documents patterns,
explaining their meaning
Regard pattern as extending modeling
language
ATM EX:- transaction offers some possibility of
reuse & there is commercial s/w to support
them.
ORGANIZE SYSYTEM INTO
SUBSYSTEM
First step in system design is to divide the system
into pieces.
Each major pieces of a system is called
subsystem that is based on some common
themes, functionalities or execution on same
kind of h/w
A sub system is a group of classes,
associations, operations , events & constraints
that are interrelated & have a well defined small
interface with other subsystem
Each subsystem can be designed independently
without affecting others.
Relationship between two subsystem can be
Decomposition of system organized into
horizontal layers or vertical partitions.
LAYERS:=
Its an ordered set of virtual world each built
in terms of ones below it & providing
implementation basis for one above it.
Object in each layer can be independent
A subsystem knows about layer below it but has
no knowledge of layer above it
Ex ;-in graphic system windows are made from
screen operations which are implemented using
pixel operation.
Each layer has its own set of classes &
operations
Closed layered architecture each layer is built
only in terms of immediate lower layer so it
reduces dependencies b/w layers
Open layered architecture a layer can use
feature of any lower layer to any depth
PARTITIONS
It vertically divides a system into several
independent sub system each provides one kind
of service & have similar level of abstraction
Ex:- Computer OS includes a file system,
process control, virtual memory management &
device control
The subsystem may have some knowledge of
each other but this knowledge is not deep
IDENTIFY CONCURRENCY
Identify objects that must be active concurrently
& objects that have mutually exclusive activity
IDENTIFY INHERENT CONCURRENCY
If two object receives events at same time
without interacting then they are concurrent &
fold them onto single thread of control
You need not implement two subsystem that are
inherently concurrent as separate H/W units
H/W interrupts,OS & tasking mechanisms
simulates logical concurrency in uniprocessor
DEFINING CONCURRENT TASKS
BY examining state diagram of objects &
exchange of events among them you can fold
many objects onto single thread of control
A thread of control is a path through which only
single object at a time is active
A thread remains until object send an event to
another object & wait for another events.
ATM EX:- while bank is verifying account or
processing transaction the atm machine is idle.
If a central computer directly controls the ATM
we can combine ATM object with bank
transaction object as single task
ALLOCATE SUBSYSTEM
Allocate each concurrent subsystem to a H/W
unit, general purpose processor or a specialized
functional units as follows
Estimate performance needs & resources
needed to satisfy them
Decision to use multiple processor or h/w
functional unit is based on a need for higher
performance.
The no of processor required depends upon
volume of computation & speed of machine
ATM EX:-a single CPU would enough for each
ATM because it simply provides user interface &
some local processing.
Choose hardware or software
implementation:-
You must decide which subsystem will
implemented in h/w & which in s/w.
Two main reason for implementing subsystem in
h/w
Cost :- Existing h/w provides exactly functionality
required.
Performance:- the system requires a higher
performance than general purpose CPU can
provide & more efficient h/w is available
ATM EX:- general purpose computer is suffice for
ATM, consortium & Bank
Allocate software subsystem to processors to
satisfy performance needs & minimize
interprocessor communication :-
Reasons for assigning task to processor
Logistics:-Certain task required at specific
locations to control h/w or to permit independent
operation
Communication limit :- response time exceed
available communication bandwidth between task
& piece of h/w
Computation limits:-assign independent
subsystem to separate processors.
Determine the connectivity of physical units
that implements the sub system (topology)
MANAGEMENT OF DATA STORAGE
For data storage use separately or in
combination data structure & databases.
Different kind of data store provide tradeoff
among cost, access time, capacity & reliability.
Ex:- personal computer may use memory data
structure & files. An accounting system may
use database
Files are cheap, simple & permanent, file
operation are low level. File implementation
may vary for diff. computer system
Following are kind of data that belongs to files
Data with high volume & low information
density
Modest quantities of data with simple structure
Data that are accessed sequentially
DATABASE managed by DBMS are another kind
of data store
It makes application easier to port to diff. H/W &
OS.
Following are kind of data that belongs to
database
Data that requires updates at fine level by
multiple user
Data that must accessed by multiple application
program
Data that required coordinated updates via
HANDLE GLOBAL RESOURCE
System designer must identify global resources &
determine mechanisms for controlling access to
them
There are several kind of global resources
PHYSICAL UNITS:- processors, tape drives &
communication satellites
SPACES:-disk space, a workstation screen &
button on mouse
LOGICAL NAME:-object IDs, filenames & class
name
ACCESS TO SHARED DATA:- database
If a resource is physical object then it can control
itself by establishing a protocol for obtaining
access.
If a resource is logical such as object id OR DB
then use guardian object which own each global
resource & control access to it.
One guardian object can control several
resources. All access must pass through guardian
object
In time critical application cost of passing all
access to resource is too high & client must
access resource directly.
In this case locks can be used
A lock is logical object associated with some
defined subset of resource that gives lock holder
the right access directly
Do not use direct access to shared resources
unless it is absolutely necessary
ATM EX:- Bank code & account number are
global resources.
Bank code must be unique within context of
consortium.
Account code must be unique within context
of bank
CHOOSE S/W CONTROL
STRATEGY
Two kind of controls flows in s/w system
EXTERNAL CONTROL concerns flow of
externally visible vents among objects.
That can be divided into procedure driven,
event driven & concurrent
INTERNAL CONTROL refers to flow of control
within process
It exists only in implementation
Three kinds of control flow are common :-
procedure call, quasi concurrent intertask calls &
concurrent intertask calls
Procedure driven control
Control resides within program code.
Procedure request external input & then wait for
it; when input arrives, control resumes within
procedure
Adv:- easy to implement with conventional
language
DisAdv:-requires concurrency inherent in objects
to be mapped into sequential flow of control
Designer must convert events into operations
between objects
Procedure driven paradigm is suitable only if
state model shows regular alternation of input &
output events
Event driven control
Control resides within dispatcher or monitor that
OS provides
Developers attach application procedure to events
dispatcher calls procedure when corresponding
events occur.
More difficult to implement with standard lang.
than procedure driven control.
It permits more flexible control, simulate co-
operating processes within single thread,
They are more modular & can handle error better
than procedure driven system
Concurrent control
Control resides concurrently in several
independent objects each a separate task
It implements events directly as one way
messages between objects. A task can wait for
input but other task continues execution
If there are multiple CPUs then different tasks
can execute concurrently
INTERNAL CONTROL
Expand operations on objects into low-level
operations on same or other object
interaction are similar to external object
interaction bcs it uses same implementation
mechanisms.
External interaction involve waiting for events &
can not force other object to respond
Object generate internal operations as part of
implementation algorithm so their form of
response is predictable
So its like procedure call Here caller issues a
request & waits for response.
ATM EX :- event driven control is
appropriate
ATM services single user so there is little
need for concurrent control
ATM must be responsive in its user
interaction so event driven control is
much better than procedure driven control
HANDLE BOUNDARY CONDITION
INTIALIZATION:-
System must proceed from initial state to
sustainable steady state.
It should initialize constant data, parameters,
global variables, tasks, guardian objects.
During initialization only subsystem of functionality
of system is available
TERMINATION:-
Simpler than initialization bcs many internal object
can simply be abandoned.
Task must release external resource that it
reserved.
In concurrent system one task must notify other
task of its termination.
FAILURE:-
its a unplanned termination of a system.
Failure can arise from
user error,
exhaustion of system resource,
external breakdown
bugs in s/w
often detected as impossible
inconsistency
Good system designer plans for orderly failure.
Good designer plans for graceful exit on fatal
bugs & recording or printing as much
information about failure as possible before
SETTING TRADE OFF PRIORITIES

You might also like