Hierarchical View and Virtual Machine Notes
Hierarchical View and Virtual Machine Notes
Main-subroutine
The aim of this style is to reuse the modules and freely develop individual modules
or subroutine. In this style, a software system is divided into subroutines by using
top-down refinement according to desired functionality of the system.
These refinements lead vertically until the decomposed modules is simple enough
to have its exclusive independent responsibility. Functionality may be reused and
shared by multiple callers in the upper layers.
There are two ways by which data is passed as parameters to subroutines, namely
● Pass by Value
● Pass by Reference
Advantages
● Easy to decompose the system based on hierarchy refinement.
Disadvantages
● Vulnerable as it contains globally shared data.
Master-Slave
This approach applies the 'divide and conquer' principle and supports fault
computation and computational accuracy. It is a modification of the main-
subroutine architecture that provides reliability of system and fault tolerance.
In this architecture, slaves provide duplicate services to the master, and the master
chooses a particular result among slaves by a certain selection strategy. The slaves
may perform the same functional task by different algorithms and methods or
totally different functionality. It includes parallel computing in which all the slaves
can be executed in parallel.
The implementation of the Master-Slave pattern follows five steps
● Specify how the computation of the task can be divided into a set of
equal sub-tasks and identify the sub-services that are needed to process
a sub-task.
● Specify how the final result of the whole service can be computed with
the help of the results obtained from processing individual sub-tasks.
● Define an interface for the sub-service identified in step 1. It will be
implemented by the slave and used by the master to delegate the
processing of individual sub-tasks.
● Implement the slave components according to the specifications
developed in the previous step.
● Implement the master according to the specifications developed in step
1 to 3.
Applications
● Suitable for applications where reliability of software is critical issue.
Advantages
● Faster computation and easy scalability.
Disadvantages
● Communication overhead.
The hypervisor, also called the virtual machine monitor, runs on the host OS and
allocates matched resources to each guest OS. When the guest makes a system-
call, the hypervisor intercepts and translates it into the corresponding system-call
supported by the host OS. The hypervisor controls each virtual machine access to
the CPU, memory, persistent storage, I/O devices, and the network.
Applications
Advantages
● Portability and machine platform independency.
Disadvantages
● Slow execution of the interpreter due to the interpreter nature.
Layered Style
In this approach, the system is decomposed into a number of higher and lower
layers in a hierarchy, and each layer has its own sole responsibility in the system.
● Each layer consists of a group of related classes that are encapsulated
in a package, in a deployed component, or as a group of subroutines in
the format of method library or header file.
● Each layer provides service to the layer above it and serves as a client
to the layer below i.e. request to layer i +1 invokes the services
provided by the layer i via the interface of layer i. The response may
go back to the layer i +1 if the task is completed; otherwise layer i
continually invokes services from layer i -1 below.
Applications
Layered style is suitable in the following areas
● Applications that involve distinct classes of services that can be
organized hierarchically.
● Any application that can be decomposed into application-specific and
platform-specific portions.
● Applications that have clear divisions between core services, critical
services, and user interface services, etc.
Advantages
● Design based on incremental levels of abstraction.
Disadvantages
● Many applications or systems are not easily structured in a layered
fashion.
● Lower runtime performance since a client’s request or a response to
client must go through potentially several layers.
● There are also performance concerns on overhead on the data
marshaling and buffering by each layer.
● Opening of interlayer communication may cause deadlocks and
“bridging” may cause tight coupling.
● Exceptions and error handling is an issue in the layered architecture,
since faults in one layer must spread upwards to all calling layers