NHÓM 3_2
chap 6
chap 8
Chap 5
Batch Sequential
How to implement Batch Sequential?
Usually done in batch processing language or shell script
Summary
Benefits:
Simple division between sub-systems
Each sub-system can be a stand-alone
Limitation
No interactive interface
No concurrency and low throughput
High latency
Applicable Design Domains
Data are batched
Definition
Widely used in 1950’s – 1970’s
Example: mainframe computers using COBOL
Traditional data processing model
Note: deployment can differ even for the same batch-sequential arch.
Pipe & Filter
Definition
Similar to Batch Sequence
Independent modules
Data connectors
Difference
Connectors are stream oriented
Concurrent processing
Basic Concepts
Data Sink
Filter: independent data stream transformer
Process data and write to output stream
Does not wait for batched data as a whole
Reads data from input data stream
Does not even have to know identity of i/o streams
Data Source
Pipe: data conduit
Moves data from one filter to another
Two types: character or byte streams
Data Flow Methods
Pull only (Read only)
A data sink may pull data from an upstream
Filter may pull data from an upstream
Pull/Push (Read/Write)
A filter may pull data from an upstream and push transformed data in a downstream.
Push only (Write only)
A filter may push data in a downstream
A data source may push data in a downstream
Classification of Filters
Active Filter
It works with a passive pipe that provides read/write mechanisms for pulling and pushing.
Example: UNIX pipe.
pulls in data and push out the transformed data (pull/push)
Passive filter
Lets connected pipe to push data in and pull data out.
The filter must provide read/write mechanisms in this case.
Applicable Design Domain
Data format on the data stream is simple and stable, and easy to be adapted if it is necessary.
There are significant work which can be pipelined to gain the performance
System can be broken into a series of processing steps over data stream, in each step filter consumes and moves data incrementally.
Suitable for producer/consumer model
What is data flow architecture?
click to edit
Connection can be
IO Stream
Files, Buffers, Pipes
No interaction between modules
System decomposed into modules.
Modules do not need to know identity of each other
Whole system as transformation of successive sets of data.
Process Control Model
Data
Input variable: measured input data
Manipulated variable: can be adjusted by the controller
E.g., motor rotation speed, etc.
Controlled variable: target controlled variable
E.g., Speed in a cruise control system
E.g., Temperature in an auto H/A system.
Applicable Domains
Needs to maintain an output data at a stable level.
The system has a set point which is the goal the system will reach and stay at that level.
Embedded software system involving continuing actions.
Definition
Composed of
Connectors
Sub-systems
Two types of sub-systems
executor processor unit
controller unit
Suitable for embedded System
System depends on: Control Variables
Pros and Cons
Benefits
Better for situations where no precise formula for deciding the manipulated variable
Can be completely embedded
Limitations
Requires more sensors to monitor system states
Chapter7
Hierarchical Architecture
Main-Subroutine
The purpose
to reuse the subroutines
have individual subroutines developed independently
typically data are shared by related subroutines at the same level
With object orientation
the data is encapsulated in each individual object so that the information is protected
a software system
decomposed into subroutines hierarchically refined according to the desired functionality of the system
Data is passed as parameters to subroutines from callers
Pass by reference where the subroutine may change the value of data referenced by the parameter
Pass by value where the subroutine only uses the passed data but cannot change it
a simple example of a purchase process requirement
process #5 checks stock availability, while process #6 checks the customer credentials before making the invoice
On the alternate path, process #7 checks the return policy
To continue the transaction process #3 next selects one of the two different action paths;
process #8 performs the refund transaction accordingly
The data is forwarded to the next process (circle #2) which validates the request (either return or purchase), and if the request is invalid it is rejected and the customer is notified (circle #4).
The process circle #1 receives requests from the customer and records all related information
Benefits:
easy to decompose the system based on the definition of the tasks in a top-down refinement manner
can still be used in a subsystem of OO design
Limitations:
Globally shared data in classical main-subroutines introduces vulnerabilities.
Tight coupling may cause more ripple effects of changes as compared to OO design
Master-Slave
is a variant of the main-subroutine architecture style that supports fault tolerance and system reliability
In this architecture
slaves provide replicated services to the master
the master selects a particular result among slaves by certain selection strategies
The slaves may perform the same functional task
by different algorithms and methods
by a totally different functionality.
Other characteristics of this architecture
parallel computing
accuracy of computation
Since the same task is delegated to several different implementations, inaccurate results can be ruled out easily
majority vote strategy
other algorithms
Applicable domains of master-slave architecture
used for the software system where reliability is critical
due to the replication (redundancy) of servers.
the terms master-slave or parent-child are employed to specify the dependency of one entity on another
If the master node is deleted then the slave node has reason to stay
Layered
Presentation layer
to display information
the screens with which users interact
responsible for
the structure
styling
interactivity of apps
not responsible for enforcing business rules or storing data
only communicates with the business logic layer to fetch information to display to users
For example, a software application’s presentation layer may control the colour of headings for each pet’s breed and the ability to click on a pet to view more information.
Business logic layer
is not responsible for displaying information or storing it
coordinates the end-to-end process
implements the business rules in a project
communicates with both the presentation layer and the data layer.
to enforce business rules
For example, a software application’s business logic layer may determine that the application must show only 3-year-old labradors to a specific user based on their preferences.
Data layer
The business logic layer accesses it to fetch (read) or save (create, update, delete) information
For example, a software application’s data layer may store each pet’s details and images.
to store information
Virtual Machine
is built up on an existing system and provides a virtual abstraction, a set of attributes, and operations
In most cases a virtual machine separates a programming language or application environment from an execution platform
A virtual machine may appear similar to emulation software
JVM (Java Virtual Machine) Architecture
is an abstract machine
A specification where working of Java Virtual Machine is specified
implementation provider is independent to choose the algorithm
implementation has been provided by Oracle and other companies
An implementation Its implementation is known as JRE (Java Runtime Environment)
Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is created
operation
Verifies code
Executes code
Loads code
Provides runtime environment
provides definitions for the
Register set
Garbage-collected heap
Class file format
Fatal error reporting etc
Memory area
Classloader
a subsystem of JVM which is used to load class files
Whenever we run the java program, it is loaded first by the classloader
There are three built-in classloaders in Java
Bootstrap ClassLoader:
loads the rt.jar file which contains all class files of Java Standard Edition
java.lang package classes, java.net package classes, java.util package classes, java.io package classes, java.sql package classes etc
Extension ClassLoader:
is the child classloader of Bootstrap and parent classloader of System classloader
loades the jar files located inside $JAVA_HOME/jre/lib/ext directory
System/Application ClassLoader
is the child classloader of Extension classloader
loads the classfiles from classpath
By default, classpath is set to current directory
can change the classpath using "-cp" or "-classpath" switch
Class(Method) Area
stores per-class structures
field
method data
the runtime constant pool
the code for methods.
Heap
It is the runtime data area in which objects are allocated
Stack
holds local variables and partial results, and plays a part in method invocation and return
Each thread has a private JVM stack, created at the same time as thread.
stores frames
A new frame is created each time a method is invoked. A frame is destroyed when its method invocation completes.
Program Counter Register
contains the address of the Java virtual machine instruction currently being executed
Native Method Stack
contains all the native methods used in the application.
Execution Engine
contains:
Interpreter: Read bytecode stream then execute the instructions.
Just-In-Time(JIT) compiler:
compiles parts of the byte code that have similar functionality at the same time
hence reduces the amount of time needed for compilation
used to improve the performance
the term "compiler" refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.
A virtual processor
Java Native Interface
a framework which provides an interface to communicate with another application written in another language like C, C++, Assembly etc
Java uses JNI framework to send output to the Console or interact with OS libraries.
DATA-CENTERED ARCHITECTURE
. Repository Architecture
Blackboard Architecture
Definition & Properties
• Data-centered architecture is characterized by a centralized data store that is shared by all surrounding software components
• Consists of two types of components
• The connection between the data module and the software components is either implemented by explicit or implicit method invocation
o Data store
o Software component agents
• Software components do not communicate directly but via data store
• The shared data module provides
o Insertion
o Deletion
o Update and
o Retrieval
• Classified into two categories (based on Flow Control Strategy)
o Repository
o Blackboard
Properties
Pros & Cons
Variants of Data Repository
Application Domain
Benefit:
Cons:
• Data integrity: easy to backup and restore
• System scalability and Reusability of agents: reduce the overhead of transient data between software components
• Data store reliability and availability
• High dependency between data structure of data store
• Overhead cost of moving data on network
• Suitable for large complex information system
• Data transactions drive the control flow
Virtual repository:
• Built up on the top of multiple physical repositories
• Most DB allows users to create views that are virtual repositories since they do not exist physically
• Benefits:
o Simplify the overall complexity of overall database structure
o Security management in terms of scope of data of manipulation for different users
Distributed repository system (distributed database system):
• All data are distributed over all sites linked by network
• Data are replicated in order to improve reliability and local accessibility
• Concerns
o Vertical or horizontal partitions
o Synchronization of duplicated data
o Cost of data transmission
o Collaboration (two-phase transaction commitment)
• Data store is passive
• Clients of the data store are active
o Its clients taking control of flow logic
o Client may access the repository
Interactively
Batch transaction
• Example: Database management system
Definition & Properties
Blackboard system & Components
Application Domain
Pros & Cons
Pros:
Cons:
• Scalability: easy to add new knowledge source
• Concurrency: all knowledge sources can work in parallel
• Reusability of knowledge source agents
• Tight dependency between the blackboard and knowledge source
• Synchronization of multiple agents is an issue
• Debugging and testing of the system is a challenge
• Suitable for solving immature and complex AI problems
• The problem spans multiple disciplines, each of which has complete different knowledge expertise
• Optimal, partial, or approximate solution is acceptable
• Exhausted searching is impossible
• Blackboard system:
• 1st Blackboard arch. developed in 1970’s, mainly used for
• Consists of three partitions
• How it works: data driven – a change in the data stored in Blackboard triggers one or more knowledge source might lead to more changes
• Properties:
o Each knowledge source is relatively independent
o They don’t need to interact with each other
o Only interact and respond to the blackboard subsystem
o Blackboard: used to store data (Hypothesis and fact)
o Knowledge Source: stores domain specific knowledge
o Controller: initiating the blackboard and knowledge sources
o A common knowledge base, the "blackboard", is iteratively updated by a diverse knowledge sources,
o starting with a problem specification and ending with a solution
o Speech recognition
o Weather forecast
• Data store is active
• Clients are inactive/passive
• Flow of logic is determined by the current data status
o The clients of a blackboard system are called
o A new data change may trigger events so that the knowledge sources take actions to respond to these events. These actions may result in new data and change in logic flow
Knowledge sources
Listeners or subscribers
• Example:
o Knowledge-based AI system
o voice and image recognition system
o Security system
o Business resource management systems.
IMPLICIT ASYNCHRONOUS COMMUNICATION ARCHITECTURE
. Properties & Types
Non-Buffered Event-Based Architecture
Buffered Message-Based Architecture
• Also called publisher-subscriber or producer-consumer patterns , where
o Subscribers are interested in some events or messages issued by a publisher
o Consumers are interested in some events or messages issued by a producer
• Two different modes:
o Non-buffered
o Buffered
Properties
Observer pattern
Applicable Domains
Pros & Cons
• Benefits:
• Limitations:
o Framework availability: Many vendor APIs such as Java AWT and Swing components available
o Reusability of components: Easy to plug-in new event handlers without affecting the rest of the system
o System maintenance and evolution: Easy to update both of event sources and targets.
o Independency and flexible connectivity: Dynamic registration and deregistration can be done dynamically at run-time.
o Possibility of parallel execution of event handlings.
o Difficult to test and debug the system: hard to predict and verify responses and the order of responses from the listeners.
o The event source cannot be determined: when a response finished or the sequence of all responses.
o Reliability and overhead of indirect invocations may be an issue
o There is more tight coupling between event sources and their listeners than in buffer-based implicit invocation
• Suitable for interactive GUI component communication and IDE tools.
• Suitable for applications that require loose coupling between components that need to notify or trigger other components to take actions upon asynchronous notifications.
• Suitable for the implementation of state machines.
• Suitable when event handlings in the application are not predictable
• The Observer pattern is another name used for this type of architecture.
• Subscribers is an event listener and register themselves with the event source.
• Once an event is fired off by an event source, all corresponding subscribers are notified, which then take corresponding actions.
• The non-buffered event-based implicit invocation architecture breaks the software system into two partitions:
o event sources
o event listeners
• The event registration process connects these two partitions.
• There is no buffer available between these two parties
Properties
Message-based systems
• The buffered message-based software architecture breaks the software system into three partitions
o Message producers
o Message consumers
o Message service providers
• They are connected asynchronously by either a
• This architecture is also considered data-centric
o message queue : one-to-one
o message topic: one-to-many
Message:
Messaging mechanism:
Messaging system properties:
• In a message-based system, also referred to as Fire & Forget system, a sender sends out a message and it does not care much of the response from the receivers except for guaranteed message delivery; it is typically implemented as a Message-Oriented Middleware (MOM) providing a reliable message service on a distributed system
• Messaging systems are used to build reliable, scalable, and flexible distributed applications supporting asynchronous communication
• The messaging system architecture is just a peer-to-peer client-server architecture
• The high degree of independency between components within the messaging system is one of its most important features.
• Its high scalability, interoperability in heterogeneous networks, and reliability also make the messaging system more popular
• A message is a structured data with a message id, message header, property, and a body.
• A typical example of a message is an XML document
• Messaging is a mechanism or technology that handles asynchronous or synchronous message delivery effectively and reliably.
• A messaging client can produce and send messages to other clients, they can also consume messages from other clients.
• Each client must register with a messaging destination in a connection session provided by a message service provider for creating, sending, receiving, reading, validating, and processing messages
Point-to-Point Messaging (P2P) Mechanism
• The message queue architecture is a point-to-point structure between producer and consumer
• A P2P messaging architecture is composed of message queues, senders, and receivers
• Each message is sent to a destination (a specific queue) which is maintained by the consumer; consumer clients extract messages from these queues.
• The queue retains all messages they receive either until the messages are consumed or until the messages expire
• Each message has only one consumer, i.e., the message will be “gone” once it is delivered
• This approach allows multiple message receivers but one and only one of them will get the message as determined by the message service provider.
• A sender and a receiver of a message have no timing dependencies, that is, the receiver can still get the message even it was not available when the sender sent the message
• P2P messaging requires every message sent to the message queue must be processed successfully by a consumer
• It is much more reliable than simple event-listener based system we discussed earlier
Publish-Subscribe Messaging (P&S) Mechanism
• The P&S messaging architecture is a hub-like architecture, where publisher clients send messages to a message topic that acts like a bulletin board.
• Message topic publishers and subscribers are not aware of each other
• One difference between P&S from P2P is that each topic message can have multiple consumers.
• The system delivers the messages to all its multiple subscribers instead of single receiver as in the message queue system.
• Publishers and subscribers have a timing coupling dependency.
• A message topic consumer must subscribe the topic before it is published unless subscription is a durable subscription, which is able to receive any topic messages sent while the subscribers are not active or not ready yet
click to edit