© Andrew IrelandSoftware Design F28SD2 Architectural Design Andrew Ireland School of Mathematical &...
-
Upload
abigail-doyle -
Category
Documents
-
view
219 -
download
0
Transcript of © Andrew IrelandSoftware Design F28SD2 Architectural Design Andrew Ireland School of Mathematical &...
© Andrew IrelandSoftware Design F28SD2
Architectural Design
Andrew IrelandSchool of Mathematical & Computer Sciences
Heriot-Watt UniversityEdinburgh
© Andrew IrelandSoftware Design F28SD2
Motivations • Architectural design represents the most abstract
level of design• Involves the identification of subsystems and their
interconnections• Just like in designing a building or a bridge, sound
architectural decisions are crucial to the success of a project
– a bad architecture can’t be saved by good construction methods!
© Andrew IrelandSoftware Design F28SD2
Architectural Activities• Systems structuring:
– Subsystems– Communication between subsystems
• Control modelling:– Subsystems and control
• Subsystem decomposition:– Subsystems and modules– Module interconnections
© Andrew IrelandSoftware Design F28SD2
Repository Model
Automotive Parts: repository
Client Interface
Invoice Subsystem
Supplier Interface
Stock Subsystem
Note: often referred to as data-centred architecture
© Andrew IrelandSoftware Design F28SD2
Repository Model • The repository model is appropriate when there exists a
clear producer/consumer relationship between subsystems and data, e.g. command and control, inventory management, information management
• The repository imposes a data model that all subsystems will have to operate with
• Advantages: – Efficient mechanism for sharing large amounts of data between
subsystems – no need for data to be communicated between subsystems directly
– Data producers (subsystems) are decoupled from the needs of data consumers (subsystems)
– Security and archive issues are centralized
© Andrew IrelandSoftware Design F28SD2
Repository Model • Advantages (cont’d):
– Having a clearly defined data model makes integration of new subsystems a well defined task
• Disadvantages: – Imposing a single data model on all systems may impact on
performance, as well as adaptability, i.e. integration of new subsystems
– Evolution may be impeded by the use of a standard data model, i.e. converting to a new standard, may be expensive and may lead to the lose of data (data warehousing)
– Distributing a repository model over multiple machines gives rise to additional challenges, i.e. dealing with redundancy and inconsistencies
© Andrew IrelandSoftware Design F28SD2
Data-flow Model • A data-flow architecture is appropriate when input data is
transformed through a series of computational components, i.e. filters connected by pipes
• Filters operate independently of each other
• In its simplest form, a data-flow architecture takes the form of a single line of transformations
filter
filter
filter filter
filter filter
filterpipes
© Andrew IrelandSoftware Design F28SD2
Data-flow Model • Advantages:
– Promotes parallelism– Promotes component style development
• Disadvantages: – Where parallelism is exploited, load balancing and
synchronization issues may impact negatively on system performance
– Deadlock is also a potential problem via parallelization– Not well suited to error handling, e.g. ignore erroneous data or
restart the processing with the erroneous data eliminated – neither is very satisfactory
• Applications: image processing, parallel search, …
© Andrew IrelandSoftware Design F28SD2
Client-server Model
Network
Client 1 Client M…
Server 1 Server N…
© Andrew IrelandSoftware Design F28SD2
Client-server Model • A distributed systems model contains a:
– set of servers (subsystems) providing services– set of clients (subsystems) which know the
identification of the services– network which allows clients to access services via
remote procedure calls
• Typically data is also distributed across the system with no standard data model imposed
© Andrew IrelandSoftware Design F28SD2
Client-server Model • Advantages:
– Ease of system evolution, e.g. new servers can be integrated incrementally and existing servers can be upgraded transparently
– Having no standard data model provides opportunities for efficiency gains
• Disadvantages:– Having no standard data model may give rise to
unforeseen integration issues– Security and archiving becomes a distributed problem
© Andrew IrelandSoftware Design F28SD2
Peer-to-Peer Model • Peer-to-peer (P2P) is a distributed architecture
which has a strong co-operative flavour, i.e. the architecture is constructed from a set of participants, each of whom share resources
• Within P2P, a participant is a supplier and a consumer, which makes it distinct from the client-server model
• Applications: file sharing networks, e.g. Napster, Skype, sciencenet P2P search engine, …
© Andrew IrelandSoftware Design F28SD2
Peer-to-Peer Model • Advantages:
– As new nodes arrive resources increase, as well as the demands on the available resources. In contrast, as new clients join a client server architecture typically the demand increases without any additional resources (so performance decreases)
– Distributed nature of the architecture brings with it robustness benefits, i.e. no single point of failure
• Disadvantage: – Security, e.g. without encryption and proper verification
mechanisms a P2P network will be vulnerable to malicious code and viruses
© Andrew IrelandSoftware Design F28SD2
Layered Model
Kernel
Device Drivers
Service Processes
User Processes
© Andrew IrelandSoftware Design F28SD2
Layered Model • Each layer represents an abstract machine,
providing a well defined set of services• Advantages:
– promotes an incremental style of development– promotes portability and change
• Disadvantages:– cross cutting services, e.g. file handling, do not fit the
layered model– multiple layers may lead to performance issues
© Andrew IrelandSoftware Design F28SD2
Control Models • Centralized control:
– A single subsystem is responsible for controlling the operation of all the other subsystems
– Other subsystems may be given control on a temporary basis
• Event-based control:– Control is distributed, each subsystem is responsible
for its actions– Subsystems react to external events generated by
other subsystems or the operational environment, e.g. sensor input
© Andrew IrelandSoftware Design F28SD2
Centralized Control
main program
subroutineZ.1
subroutineZ.N
subroutineA.N
subroutineA.1
subroutineA
subroutineZ…
… …
call-return model
© Andrew IrelandSoftware Design F28SD2
Centralized Control
managerprocess
process 2process 1
process 3 process N
manager model
…
© Andrew IrelandSoftware Design F28SD2
Centralized Control • Call-return model:
– Hierarchical subroutine model– Control is passed down through the hierarchy– Applicable to sequential systems– Less flexible and thus easier to analyse
• Manager model:– Central control process which provides coordination between
subprocesses– Processes are executed in parallel– Applicable for concurrent systems– More flexible and thus harder to analyse
© Andrew IrelandSoftware Design F28SD2
Event-driven Control • System behaviour is driven by events, e.g.
– external stimuli - sensors– user interactions - mouse clicks, key strokes – process communications - messages from process
threads
• Example event-driven models:– Broadcast control– Interrupt-driven control
© Andrew IrelandSoftware Design F28SD2
Broadcast Control
Event and message handler
subsystem-1 subsystem-N…
© Andrew IrelandSoftware Design F28SD2
Broadcast Control • Subsystems are associated, or registered, with specific
events – subsystems decide which events to react to• Event & message handler broadcasts events to:
– All subsystems OR– Only those subsystems registered for a given event
• Advantages:– Ease of system evolution– No need for explicit identification for subsystems
• Disadvantages:– Potential conflicts arising from multiple responses to events– Not appropriate for hard real-time systems, i.e. systems which
require a response within a fixed time frame
© Andrew IrelandSoftware Design F28SD2
Interrupt-driven Control
Handler 1
Handler 2
Handler N…
Process NProcess 1 Process 2 …
…interruptvector
© Andrew IrelandSoftware Design F28SD2
Interrupt-driven Control • System involves pre-defined kinds of interrupts, i.e. events that
cause processing to be interrupted• Each interrupt is mapped onto a special area of memory known as
the interrupt vector• The interrupt vector references interrupt handlers, hardware
ensures that control is passed to the relevant interrupt handler when an interrupt occurs – a handler will typically start or stop processes
• Advantages:– Good for hard real-time systems, i.e. fast & predictable response times
• Disadvantages:– Hard to program and validate– Limited by hardware, i.e. upper bound on interrupt vector
© Andrew IrelandSoftware Design F28SD2
Subsystem Decomposition
• Subsystems typically require further decomposition, i.e. decomposition into modules
• This level of decomposition lies on the boundary of architectural design
• Two principal decomposition approaches:– Data-flow
– Object-oriented
• Both are expanded upon in the next couple of lectures …
© Andrew IrelandSoftware Design F28SD2
Summary • Learning outcomes:
– Motivations for architectural design– Systems structuring and control
• Recommended reading:– M. Shaw, D. Garlan, “Software Architecture:
Perspectives on an Emerging Discipline”, Prentice-Hall 1996
– I. Sommerville, “Software Engineering”, Addison-Wesley 2007