0% found this document useful (0 votes)
3 views

enterprise intro and Variants of java jvm jre

The document provides an overview of enterprise application development, emphasizing the importance of Java EE for creating scalable and secure applications. It outlines the structure of multi-tiered applications, detailing the roles of various tiers including client, web, business, and enterprise information systems. Additionally, it discusses the Java Virtual Machine (JVM) and its components, which facilitate the execution of Java applications across different platforms.

Uploaded by

John Mulama
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

enterprise intro and Variants of java jvm jre

The document provides an overview of enterprise application development, emphasizing the importance of Java EE for creating scalable and secure applications. It outlines the structure of multi-tiered applications, detailing the roles of various tiers including client, web, business, and enterprise information systems. Additionally, it discusses the Java Virtual Machine (JVM) and its components, which facilitate the execution of Java applications across different platforms.

Uploaded by

John Mulama
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

BIT 416 ENTERPRISE APPLICATION DEVELOPMENT

Enterprise applications are those apps that companies use to facilitate complex business
processes. These apps are sophisticated and involve strong business logic to run multiple
operations.

The modern industry is growing more and more digital. New devices and technology keep
emerging every now and then.The stakes of enterprise web application development are high.

Your product should satisfy thousands of different requirements such as security, ease of use,
and offline functionality. There are several unique user requirements you need to meet to build a
robust and successful enterprise application.

Here are the types of enterprise applications-

 Enterprise management systems support several business processes such as finance and
accounting, human resources, product and manufacturing, sales and marketing, etc.
 Customer relationship management systems are divided into some customer analytical apps
that gather the data on your customer service app that interacts with the clients.
 Supply chain management systems help the business plan goods delivery, analyze product
demand and track the goods.
By developing an enterprise application, you can control several aspects of your business. With
an enterprise application, you can do things like securing log-ins on your users, restricting
background processes, blocking jail broken devices, and preventing access to the phone’s
clipboard.

Overview of Enterprise Applications


This section describes enterprise applications and how they are designed and developed.
the Java EE platform is designed to help developers create large-scale, multi-tiered, scalable,
reliable, and secure network applications. A shorthand name for such applications is "enterprise
applications," so called because these applications are designed to solve the problems
encountered by large enterprises. Enterprise applications are not only useful for large
corporations, agencies, and governments, however. The benefits of an enterprise application are
helpful, even essential, for individual developers and small organizations in an increasingly
networked world.
The features that make enterprise applications powerful, like security and reliability, often make
these applications complex. The Java EE platform reduces the complexity of enterprise
application development by providing a development model, API, and runtime environment that
allow developers to concentrate on functionality.

1
Tiered Applications
In a multi-tiered application, the functionality of the application is separated into isolated
functional areas, called tiers. Typically, multi-tiered applications have a client tier, a middle tier,
and a data tier (often called the enterprise information systems tier). The client tier consists of a
client program that makes requests to the middle tier. The middle tier is divided into a web tier
and a business tier, which handle client requests and process application data, storing it in a
permanent datastore in the data tier.

Java EE application development concentrates on the middle tier to make enterprise application
management easier, more robust, and more secure.
The Client Tier
The client tier consists of application clients that access a Java EE server and that are usually
located on a different machine from the server. The clients make requests to the server. The
server processes the requests and returns a response back to the client. Many different types of
applications can be Java EE clients, and they are not always, or even often Java applications.
Clients can be a web browser, a standalone application, or other servers, and they run on a
different machine from the Java EE server.

The Web Tier


The web tier consists of components that handle the interaction between clients and the business
tier. Its primary tasks are the following:

 Dynamically generate content in various formats for the client


 Collect input from users of the client interface and return appropriate results from the
components in the business tier
 Control the flow of screens or pages on the client
 Maintain the state of data for a user's session
 Perform some basic logic and hold some data temporarily in managed beansreduced.

The Business Tier


The business tier consists of components that provide the business logic for an application.
Business logic is code that provides functionality to a particular business domain, like the
financial industry, or an e-commerce site. In a properly designed enterprise application, the core
functionality exists in the business tier components.

The following Java EE technologies are among those that are used in the business tier in Java EE
applications:

 Enterprise JavaBeans (enterprise bean) components


 JAX-RS RESTful web services
 Java Persistence API entities

2
The Enterprise Information Systems Tier
The enterprise information systems (EIS) tier consists of database servers, enterprise resource
planning systems, and other legacy data sources, like mainframes. These resources typically are
located on a separate machine from the Java EE server, and are accessed by components on the
business tier.

The following Java EE technologies are used to access the EIS tier in Java EE applications:

 The Java Database Connectivity API (JDBC)


 The Java Persistence API
 The Java EE Connector Architecture
T
ava EE Servers and Containers
A Java EE server is a server application that implements the Java EE platform APIs and provides
standard Java EE services. Java EE servers are sometimes called application servers, because
they allow you to serve application data to clients, much as web servers serve web pages to web
browsers.
Java EE servers host several application component types that correspond to the tiers in a multi-
tiered application. The Java EE server provides services to these components in the form of a
container.
Java EE containers are the interface between the component and the lower-level functionality
provided by the platform to support that component. The functionality of the container is defined
by the platform and is different for each component type. Nonetheless, the server allows the
different component types to work together to provide functionality in an enterprise application.

The Web Container


The web container is the interface between web components and the web server. A web
component can be a servlet or a JavaServer Faces Facelets page. The container manages the
component's lifecycle, dispatches requests to application components, and provides interfaces to
context data, such as information about the current request.

The EJB Container


The EJB container is the interface between enterprise beans, which provide the business logic in
a Java EE application, and the Java EE server. The EJB container runs on the Java EE server and
manages the execution of an application's enterprise beans.

The Application Client Container


The application client container is the interface between Java EE application clients (special Java
SE applications that use Java EE server components) and the Java EE server. The application
client container runs on the client machine and is the gateway between the client application and
the Java EE server components that the client uses.

3
VARIANTS ON JAVA PLATFORM (J2EE, J2SE,J2ME),
, Java is a class-based, concurrent, object-oriented computer language designed to let application
developers “write once, run anywhere”. This means that if the given line of code successfully
runs on one machine, there is not need to recompile it to run on another machines. Java code is
compiled as a class file which can run on any Java virtual machine irrespective of computer
architecture.As information technology word is very dynamic, everybody was looking for very
scalable language and due to its robustness, Java has become one of the most popular and
programmer friendly language. Java is very flexible and can be enhanced as per the requirements
to develop different kind of client-server web applications (or desktop applications) with having
high volume of users. Java has more inhouse libraries and plugins than any other programming
language.

Java is one of the most developer friendly and most in demand programming language . It is
specially design to serve client-server web applications with having huge number of users. Most
of the syntax in java is derived from C and C++ with more in-build features (libraries).
The Java programs are portable in a network (platform independent). The code written by
programmer is compiled into bytecode. This bytecode can run anywhere in a network (server or
client) with JVM which interprets the bytecode into computer understandable code. The JVM
have an optional JIT compiler which compiles the given bytecode into m/c readable code.
Programs written in java language are robust. Java programs is different from other languages
e.g. C++ as it contain no references to data external to other object(s). The JVM ensure integrity
by applying a number of checks on each object.
ava is object-oriented language where objects are thought of as “nouns” with which we relate to.
A method of a class renders object’s behaviors.
As compared to other languages java is relatively easy to learn and easy to write, specifically for
developer with background in C. Also finding errors is very easy in java.
Java language is designed to work on distributed computing which means all programs in Java
are same as sending and receiving data from a file.
Java supports multi-threaded environment which help user to write program to perform several
tasks simultaneously.
Java Editions
The Journey of Java is continuously getting matured with time in both functionality and
reachability to all services. The Java platform has mainly three different Java editions which are
defined below:

Here is the Java editions list –

J2SE(Java 2 Service Edition) is first edition of Java which was developed for writing applets
and other Java-based applications based on applets.

4
J2EE(Java 2 Enterprise Edition) is the second edition of Java architecture for developing multi-
tier enterprise applications. The basic development in J2EE was JSP pages with access to all
J2EE components, including JavaBeans and servlets. These JSP pages at the end compiled into
servlets and have all the benefits of server-side Java applications.

J2ME(Java 2 Micro Edition) is the third edition of Java architecture with the help of which
programmers use java programming language to develop programs for mobile wireless
information devices such as cellular phones and personal digital assistants devices.There are
many devices where Java application are getting used. Some of them are:

Web Applications such as irctc.co.in etc.


Desktop Applications such as video players, document readers, media player, antivirus
applications etc.
Enterprise Applications such as financial applications.
Mobile applications
Million of Games
Type of Java applications
Next important section of our Java Tutorial is about Types of Java Applications .There are
basically four types of Java applications which are explained below:

Standalone Applications
A standalone application is a program which is installed in your PC and runs only on your
computer. In case you want to use this application, you need to explicitly install it into your m/c.

Applets
An applet are compatible with Internet can share information over it. These are to be executed on
the client machine which should have Java-Compatible web browser like Internet Explorer or
Mozilla. Applets themselves are Java programs which reside on server side. Applet can be
5
implemented by embedding it into an HTML page (image or sound file) and they cannot be
executed alone. To run applet one should need to access an HTML page which has embedded
applet. Whenever web browser downloads respective HTML page, it also downloads the
installable file. This file contains Applet which executes it on the local machine.

Web Applications
As the name suggest, Web applications run on the Web Server over the internet. Web
applications can be accessed with the help of web clients (web browsers). Whenever user open
any web page by specifying the URL (Universal Resource Locator), he/she actually access some
web application.

The main components of a web application in Java are Java Servlets, Java Server Pages (JSP)
and HTML.

Java Servlets are server side Java programs which send the result (also called response) to the
client side java program. JSP pages can be thought client side java program which are
combination of HTML and Java Code. The Web Server then converts the JSP pages into Java
Servlets before execution of the program.

User access the web application by specifying the URL and the respective URL corresponds to
an HTML page. This desired HTML page is returned by the server when the user send request.
In case the respective URL corresponds to the Servlet or JSP then it is executed on the Server
side and the corresponding response will be returned to the client for rendering.

Distributed Applications
Java application is composed of different components (or Java programs). These Java
components run on different machines and can easily communicate with each other. To be more
specific we can say that Java Objects on one machine can use methods of the Java Objects from
another machine. This make Java more suitable for distributed processing in the language.

Java Virual Machine


role of Java virtual machine (short form as JVM) is to execute Java bytecode. We can state that
JVM is the component of the Java software platform where code execution happens. Right now
over 5.5 billion computer are in the market which are JVM-enabled. JVM lives inside our
PC/computer and byte code is the language for JVM. With the introduction of JVM, job of
compiler becomes very easy as it only generate byte code for JVM rather than generating
different machine code for each m/c which is the reason why java language is platform
independent.

6
A JVM executes programs containing Java bytecode instructions and are generally implemented
to run on existing operating system (windows etc). A JVM provides a run-time environment
which enables features such as exception handling which in turns provides debugging capability
for every software exception. A JVM is a part of Java Class Library (some inbuilt java classes in
the form of bytecode) to provide basic functions to developer while doing coding in Java. These
libraries with the JVM together named as Java Runtime Environment (JRE).

JVMs are compatible and available for almost all hardware and software platforms. Due to this
feature of using the same bytecode for all JVMs on all platforms makes Java to be known as a
write once and run anywhere language. This clearly describe that JVM is a crucial component of
the Java language. Java bytecode is an machine language which is typically compiled from Java
(or from other programming languages).
How JVM works

1. Classloader
Classloader is 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.
1. Bootstrap ClassLoader: This is the first classloader which is the super class of
Extension classloader. It loads the rt.jar file which contains all class files of Java

7
Standard Edition like java.lang package classes, java.net package classes, java.util
package classes, java.io package classes, java.sql package classes etc.
2. Extension ClassLoader: This is the child classloader of Bootstrap and parent classloader
of System classloader. It loades the jar files located
inside $JAVA_HOME/jre/lib/ext directory.
3. System/Application ClassLoader: This is the child classloader of Extension classloader.
It loads the classfiles from classpath. By default, classpath is set to current directory. You
can change the classpath using "-cp" or "-classpath" switch. It is also known as
Application classloader.
4. After reading .class file, class loader save the corresponding byte code in the method area.
Generally all JVMs have only one method area which is shared across classes which
holds information related to each .class file.
2. Class
After reading .class file, class loader save the corresponding byte code in the method area.
Generally all JVMs have only one method area which is shared across classes which holds
information related to each .class file. JVM Method Area stores structure of class like metadata,
the code for Java methods, and the constant runtime pool.
Class(Method) Area stores per-class structures such as the runtime constant pool, field and
method data, the code for methods.
3. Heap
Heap is an integral part of JVM memory in which the objects actually rests. JVM produces the
Class object for each .class file. It is the runtime data area in which objects are allocated. All the
Objects, arrays, and instance variables are stored in a heap. This memory is shared across
multiple threads.
4. Stack
Java Stack stores frames. It holds local variables and partial results, and plays a part in method
invocation and return. Java language Stacks store local variables, and its partial results. Each and
every thread has its own JVM language stack, created concurrently as the thread is created. A
new frame is created when method is invoked, and it is removed when method invocation
process is complete
5. PC-Registers
PC-Registers used to keep exact information of all instructions (which instruction is executing
and which is going to be executed). PC (program counter) register contains the address of the
Java virtual machine instruction currently being executed. In Java, each thread has its separate
PC register.
6. Native method
A native method used to access the runtime data of the JVM (java virtual machine). Native
Method interface enables java code to call by the native applications (programs that are specific
to the hardware and OS). The Native Method Interface is a programming framework. It allows
Java code, which is running in a JVM to call by libraries and native applications.

8
7. Execution Block
It is a type of software that is used to test software, hardware, or complete systems. The test
execution engine never carries any information about the tested product.
It contains:
 A virtual processor
 Interpreter: Read bytecode stream then execute the instructions.
 Just-In-Time(JIT) compiler: It is used to improve the performance. JIT compiles parts of
the byte code that have similar functionality at the same time, and hence reduces the
amount of time needed for compilation. Here, 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.
8. Native Interface
Java Native Interface (JNI) is 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.
9. ) Native Method Libraries

Native Libraries is a collection of the Native Libraries (C, C++), which are needed by the
Execution Engine.
JVM Vs JRE Vs JDK
Now let’s sort out the difference between JVM ,JRE and JDK . How does these differ from each
other – JVM Vs JRE Vs JDK .

JRE ( Java Runtime Environment )


Java Runtime Environment is within which the java virtual machine actually runs. JRE contains
Java virtual Machine and other files except development tools (debugger and compiler). So
developer can run the source code in JRE but he/she cannot develop and compile the code.
JRE is Java runtime environment which is the implementation of JVM i.e the specifications
which are defined in JVM are implemented and creates corresponding environment for the
execution of code.JRE comprises mainly java binaries and other classes to execute the program
alike of JVM it physically exists. Along with Java binaries JRE also consist of various
technologies of deployment, user interfaces to interact with code executed, some base libraries
for different functionalities and language and util based libraries.

9
JVM ( Java Virtual Machine )
JVM is the abbreviation for Java virtual machine which is basically specification that provides a
runtime environment in which Java byte code can be executed i.e it is something which is
abstract and its implementation is independent to choose the algorithm and has been provided by
Sun and other companies. It is JVM which is responsible for converting Byte code to the
machine specific code. It can also run those programs which are written in other languages and
compiled to Java bytecode.The JVM performs the mentioned tasks: Loads code, Verifies code,
Executes code, Provides runtime environment.
As per above discussion, JVM runs the program by using libraries and files provided by Java
Runtime Environment.

10
JDK ( Java Development Kit )
JDK is abbreviation for Java Development Kit which includes all the tools, executable and
binaries required to compile, debug and execute a Java Program.JDK is platform dependent i.e
there is separate installers for Windows, Mac, and Unix systems.JDK includes both JVM and
JRE and is entirely responsible for code execution. It is the version of JDK which represent
version of Java.Java Development Kit can be considered as the super-set of JRE. JDK includes
all features that JRE has and over and above it contains development tools such like compiler,
debugger etc. The JDK contains a private Java Virtual Machine (JVM) and a few other resources
such as an interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation
generator (Javadoc), etc. to complete the development of a Java Application.

Following are the important differences between JDK,JRE and JVM

JDK JRE JVM


The full form of JDK is Java The full form of JRE is Java The full form of JVM is Java
Development Kit. Runtime Environment. Virtual Machine.
It is a software bundle which
JVM executes Java byte code and
JDK is a software development kit provides Java class libraries with
provides an environment for
to develop applications in Java. necessary components to run Java
executing it.
code.
JVM is highly platform
JDK is platform dependent. JRE is also platform dependent.
independent.
It contains tools for developing, It contains class libraries and other
Software development tools are
debugging, and monitoring java supporting files that JVM requires
not included in JVM.
code. to execute the program.

11
It is the superset of JRE It is the subset of JDK. JVM is a subset of JRE.
The JDK enables developers to
create Java programs that can be The JRE is the part of Java that It is the Java platform component
executed and run by the JRE and creates the JVM. that executes source code.
JVM.
JRE only contain environment to JVM bundled in both software
JDK comes with the installer.
execute source code. JDK and JRE.
JVM = Only Runtime
JDK = Java Runtime Environment JRE = Java Virtual Machine (JVM)
environment for executing the
(JRE) + Development tools + Libraries to run the application
Java byte code.
JDK is primarily used for code On other hand JRE is majorly JVM on other hand specifies all
execution and has prime responsible for creating the implementations and
functionality of development. environment for code execution. responsible to provide these
implementations to JRE.

J2EE(Java Platform, Enterprise Edition):


1. The Enterprise edition of Java has a superior usage of Java, like a growth of web services,
networking, server-side scripting and further a variety of web-based applications.
2. It is a community-driven edition, i.e. there are many of nonstop offerings from industry
experts, Java developers, and other open source organizations. Apart from this, it uses numerous
components of J2SE, as well as, holds features like Servlets, Java Message Services and more.
3. It uses Website designing tools like HTML, CSS, JavaScript, Ajax, Jquery etc, so as to
build web pages and web services.
4. There are also countless languages like .net and PHP, which can perform that task,
however, what distinguishes it from other languages is the flexibility, compatibility and
protection features, which are not that much major in other languages.
J2SE (Java Platform, Standard Edition):
1. Moving on to this one, Also well-known as Core Java, this is the most basic and standard
version of Java. It’s the purest appearance of Java, a basic establishment for all other editions.
2. It consists of a large range of common purpose API’s (like java.lang, java.util) as well as
many particular purpose APIs.
3. J2SE is used to create applications for Desktop.
4. In addition, it consists all the basics of Java the language, variables, operators, data types,
Arrays, looping, Streams, Strings Java Database Connectivity(JDBC) and much more.
5. This edition gave the well-known JVM of Java, the heart of Java development. Because
of this, Java has a wide usage.
J2ME(Java Platform, Micro Edition):
1. This used for the applications running on small devices, mobiles, and embedded systems.

12
2. Limitations included partial processing power, battery drawback, small display etc.
3. J2ME uses many libraries and API’s of J2SE, with, several of its own.
4. The basic aim of this edition was to work on wireless devices, mobiles etc.
5. Operating systems targeting Java ME have been implemented by DoCoMo in the form of
DoJa, and by SavaJe as SavaJe OS.
JavaFX
It is used to develop rich internet applications. It uses a lightweight user interface API.

Relationship between JVM, JRE, and JDK.

Features of Java
The primary objective of Java programming language creation was to make it portable, simple
and secure programming language. Apart from this, there are also some excellent features which
play an important role in the popularity of this language.
Simple
Java is very easy to learn, and its syntax is simple, clean and easy to understand. According to
Sun Microsystem, Java language is a simple programming language because:
o Java syntax is based on C++ (so easier for programmers to learn it after C++).
o Java has removed many complicated and rarely-used features, for example, explicit
pointers, operator overloading, etc.
o There is no need to remove unreferenced objects because there is an Automatic Garbage
Collection in Java.

Object-oriented
Java is an object-oriented programming language. Everything in Java is an object. Object-
oriented means we organize our software as a combination of different types of objects that
incorporate both data and behavior.

13
Object-oriented programming (OOPs) is a methodology that simplifies software development
and maintenance by providing some rules.
Platform Independent

Java is platform independent because it is different from other languages like C, C++, etc. which
are compiled into platform specific machines while Java is a write once, run anywhere language.
A platform is the hardware or software environment in which a program runs.
There are two types of platforms software-based and hardware-based. Java provides a software-
based platform.
The Java platform differs from most other platforms in the sense that it is a software-based
platform that runs on top of other hardware-based platforms. It has two components:
1. Runtime Environment
2. API(Application Programming Interface)
Java code can be executed on multiple platforms, for example, Windows, Linux, Sun Solaris,
Mac/OS, etc. Java code is compiled by the compiler and converted into bytecode. This bytecode
is a platform-independent code because it can be run on multiple platforms, i.e., Write Once and
Run Anywhere (WORA).
Secured
Java is best known for its security. With Java, we can develop virus-free systems. Java is secured
because:
o No explicit pointer
o Java Programs run inside a virtual machine sandbox

14
o Classloader: Classloader in Java is a part of the Java Runtime Environment (JRE) which
is used to load Java classes into the Java Virtual Machine dynamically. It adds security by
separating the package for the classes of the local file system from those that are
imported from network sources.
o Bytecode Verifier: It checks the code fragments for illegal code that can violate access
rights to objects.
o Security Manager: It determines what resources a class can access such as reading and
writing to the local disk.
Java language provides these securities by default. Some security can also be provided by an
application developer explicitly through SSL, JAAS, Cryptography, etc.
Robust
The English mining of Robust is strong. Java is robust because:
o It uses strong memory management.
o There is a lack of pointers that avoids security problems.
o Java provides automatic garbage collection which runs on the Java Virtual Machine to
get rid of objects which are not being used by a Java application anymore.
o There are exception handling and the type checking mechanism in Java. All these points
make Java robust.
Architecture-neutral
Java is architecture neutral because there are no implementation dependent features, for example,
the size of primitive types is fixed.
In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes
of memory for 64-bit architecture. However, it occupies 4 bytes of memory for both 32 and 64-
bit architectures in Java.
Portable
Java is portable because it facilitates you to carry the Java bytecode to any platform. It doesn't
require any implementation.
High-performance
Java is faster than other traditional interpreted programming languages because Java bytecode is
"close" to native code. It is still a little bit slower than a compiled language (e.g., C++). Java is
an interpreted language that is why it is slower than compiled languages, e.g., C, C++, etc.
Distributed
Java is distributed because it facilitates users to create distributed applications in Java. RMI and
EJB are used for creating distributed applications. This feature of Java makes us able to access
files by calling the methods from any machine on the internet.
Multi-threaded
A thread is like a separate program, executing concurrently. We can write Java programs that
deal with many tasks at once by defining multiple threads. The main advantage of multi-
threading is that it doesn't occupy memory for each thread. It shares a common memory area.
Threads are important for multi-media, Web applications, etc.

15
Types of Java Applications
There are mainly 4 types of applications that can be created using Java programming:
1) Standalone Application
Standalone applications are also known as desktop applications or window-based applications.
These are traditional software that we need to install on every machine. Examples of standalone
application are Media player, antivirus, etc. AWT and Swing are used in Java for creating
standalone applications.
2) Web Application
An application that runs on the server side and creates a dynamic page is called a web
application. Currently, Servlet, JSP, Struts, Spring, Hibernate, JSF, etc. technologies are used for
creating web applications in Java.
3) Enterprise Application
An application that is distributed in nature, such as banking applications, etc. is called an
enterprise application. It has advantages like high-level security, load balancing, and clustering.
In Java, EJB is used for creating enterprise applications.
4) Mobile Application
An application which is created for mobile devices is called a mobile application. Currently,
Android and Java ME are used for creating mobile applications.

The requirement for Java Hello World Example


For executing any Java program, the following software or application must be properly installed.
o Install the JDK if you don't have installed it, download the JDK and install it.
o Create the Java program
o Compile and run the Java program
o
class Simple{
public static void main(String args[]){
System.out.println("Hello Java");
}
}
Compilation Flow:
When we compile Java program using javac tool, the Java compiler converts the source code into
byte code.

16
Parameters used in First Java Program
Let's see what is the meaning of class, public, static, void, main, String[], System.out.println().
o class keyword is used to declare a class in Java.
o public keyword is an access modifier that represents visibility. It means it is visible to all.
o static is a keyword. If we declare any method as static, it is known as the static method.
The core advantage of the static method is that there is no need to create an object to
invoke the static method. The main() method is executed by the JVM, so it doesn't
require creating an object to invoke the main() method. So, it saves memory.
o void is the return type of the method. It means it doesn't return any value.
o main represents the starting point of the program.
o String[] args or String args[] is used for command line argument.
o System.out.println() is used to print statement. Here, System is a class, out is an object
of the PrintStream class, println() is a method of the PrintStream clas
public static void main(String[] args)
public static void main(String []args)
public static void main(String args[])
public static void main(String... args)

17
DISTRIBUTED SYSTEM
Introduction
A distributed system is a software system in which components located on networked
computers communicate and coordinate their actions by passing messages. The components
interact with each other in order to achieve a common goal.
Distributed systems Principles
A distributed system consists of a collection of autonomous computers, connected
through a network and distribution middleware, which enables computers to coordinate their
activities and to share the resources of the system, so that users perceive the system as a single,
integrated computing facility. A distributed system is a collection of computer programs that
utilize computational resources across multiple, separate computation nodes to achieve a
common, shared goal. Also known as distributed computing or distributed databases, it relies on
separate nodes to communicate and synchronize over a common network. These nodes typically
represent separate physical hardware devices but can also represent separate software processes,
or other recursive encapsulated systems. Distributed systems aim to remove bottlenecks or
central points of failure from a system.
Distributed computing is a system of software components spread over different computers but
running as a single entity. A distributed system can be an arrangement of different configurations,
such as mainframes, computers, workstations, and minicomputers.

Distributed System
Sharing resources such as hardware, software, and data is one of the principles of cloud
computing. With different levels of openness to the software and concurrency, it’s easier to
process data simultaneously through multiple processors. The more fault-tolerant an application
is, the more quickly it can recover from a system failure.

18
Organizations have turned to distributed computing systems to handle data generation explosion
and increased application performance needs. These distributed systems help businesses scale as
data volume grows. This is especially true because the process of adding hardware to a
distributed system is simpler than upgrading and replacing an entire centralized system made up
of powerful servers.
Distributed systems consist of many nodes that work together toward a single goal. These
systems function in two general ways, and both of them have the potential to make a huge
difference in an organization.

Also known as distributed computing and distributed databases, a distributed system is a


collection of independent components located on different machines that share messages with
each other in order to achieve common goals.
As such, the distributed system will appear as if it is one interface or computer to the end-user.
The hope is that together, the system can maximize resources and information while preventing
failures, as if one system fails, it won't affect the availability of the service.
Centralised System Characteristics
 One component with non-autonomous parts
 Component shared by users all the time
 All resources accessible
 Software runs in a single process
 Single Point of control
 Single Point of failure
Distributed System Characteristics
 Multiple autonomous components
 Components are not shared by all users
 Resources may not be accessible
 Software runs in concurrent processes on different processors
 Multiple Points of control
 Multiple Points of failure
Examples of distributed systems and applications of distributed computing include the following:
 telecommunication networks:
 telephone networks and cellular networks,
 computer networks such as the Internet,
 wireless sensor networks,
 routing algorithms;
 network applications:
 World wide web and peer-to-peer networks,
 massively multiplayer online games and virtual reality communities,
 distributed databases and distributed database management systems,

19
 network file systems,
 distributed information processing systems such as banking systems and airline reservation
systems;
 real-time process control:
 aircraft control systems,
 industrial control systems;
 parallel computation:
 scientific computing, including cluster computing and grid computing and various volunteer
computing projects (see the list of distributed computing projects),
 distributed rendering in computer graphics.
Common Characteristics
Certain common characteristics can be used to assess distributed systems
Resource Sharing
Resource sharing means that the existing resources in a distributed system can be accessed or
remotely accessed across multiple computers in the system. Computers in distributed systems
shares resources like hardware (disks and printers), software (files, windows and data objects)
and data. Hardware resources are shared for reductions in cost and convenience. Data is shared
for consistency and exchange of information.
Resources are managed by a software module known as a resou rce manager. Every resource has
its own management policies and methods.
Openness
Openness is concerned with extensions and improvements of distributed systems. This
characteristic allows us to reuse a distributed system for multiple functions or to process varying
sets of data. The distributed system must be open in terms of Hardware and Softwares. In order to
make a distributed system open,
1. A detailed and well-defined interface of components must be published.
2. Should standardize the interfaces of components
3. The new component must be easily integrated with existing components

Concurrency
Concurrency is a property of a system representing the fact that multiple activities are executed at
the same time. The concurrent execution of activities takes place in different components running
on multiple machines as part of a distributed system. In addition, these activities may perform
some kind of interactions among them. Concurrency reduces the latency and increases
the throughput of the distributed system.
Scalability

Consider an emerging new web-service, which is being developed while it still wasn’t known
and popular with users. Now say, suddenly word spreads around about this fantastic new
possibility and the service willstar t to have 1000% more hits each month from all around the

20
Globe. But the property of a distributed system to respond to growing number of requests is
called Scalability. Scalability is the ability to work when the system load or the number of users
increases. Scalability is mainly concerned about how the distributed system handles
the growth as the number of users for the system increases. Mostly we scale the distributed
system by adding more computers in the network.
With designing and maintaining scalable distributed systems there exist a number of challenges:
(1) How to control the cost of physical resources? { one could build a perfect system with an
unlimited amount of resources while, on the other hand, one could always try to minimise the
cost as much as possible with taking certain risks. As one cannot exactly predict the future, the
answer here would be flexibility.
(2) How to control performance loss? This is one of the main aims in designing reliable and
lively distributed systems. General idea is to spread the load around in the system dynamically.
(3) Preventing software resources running out. For example, IPV4 32-bit Internet addresses were
predicted to run out already around the Millennium time.
(4) Avoiding performance bottlenecks. This is actually one of the main concerns with the
challenge (2).Careful planning and designing of the system is the way to go.
Fault Tolerance
In a distributed system hardware, software, network anything can fail. The system must be
designed in such a way that it is available all the time even after something has failed.
Transparency
transparency - Concealment from the user and the application programmer of the separation of
components in a Distributed Systems for the system to be perceived as a whole rather than a
collection of independent components.
One can say that there exist access transparency - the user percieves (accesses) the distributed
system as it were a single node instead of (possibly complex) set of queries between different
nodes. Also, the user does not care where exactly the piece of information came from - location
transparency - nor does the user care that accessed resource physical location got recently
changed from a server in US to Ireland – mobility transparency. Distributed systems should be
perceived by users and application programmers as a whole rather than as a collection of
cooperating components. Transparency can be of various types like access, location, concurrency,
replication, etc
Heterogeneity
Heterogeneity refers to the ability for the system to operate on a variety of different hardware
and software components. This is achieved through the implementation of middle-ware in the
software layer. The goal of the middle-ware is to abstract and interpret the programming
procedural calls such that the distributed processing can be achieved on a variety of differing
nodes.

Types of Distributed Systems

21
The nodes in the distributed systems can be arranged in the form of client/server systems or peer
to peer systems. Details about these are as follows −

Client/Server Systems
In client server systems, the client requests a resource and the server provides that resource. A
server may serve multiple clients at the same time while a client is in contact with only one
server. Both the client and server usually communicate via a computer network and so they are a
part of distributed systems.

Peer to Peer Systems


The peer to peer systems contains nodes that are equal participants in data sharing. All the tasks
are equally divided between all the nodes. The nodes interact with each other as required as share
resources. This is done with the help of a network.

Advantages of Distributed Systems


Some advantages of Distributed Systems are as follows −

i. All the nodes in the distributed system are connected to each other. So nodes can easily
share data with other nodes.
ii. More nodes can easily be added to the distributed system i.e. it can be scaled as required.
iii. Failure of one node does not lead to the failure of the entire distributed system. Other
nodes can still communicate with each other.
iv. Resources like printers can be shared with multiple nodes rather than being restricted to
just one.
Disadvantages of Distributed Systems
Some disadvantages of Distributed Systems are as follows −
i. Security :It is difficult to provide adequate security in distributed systems because the
nodes as well as the connections need to be secured.
ii. Manageability: Some messages and data can be lost in the network while moving from
one node to another.
iii. Complexity:The database connected to the distributed systems is quite complicated and
difficult to handle as compared to a single user system.
iv. Overloading may occur in the network if all the nodes of the distributed system try to
send data at once.
v. Unpredictability: • Unpredictable responses depending on the system organisation and
network load.

22
Multiprocessor systems (tightly coupled)
 The desire for increased throughput has led to system designs in which multiple streams of
processing occurs in parallel. Tightly coupled systems have two or more processors in close
communication, sharing the computer bus and sometimes the clock, memory, and peripheral
devices. Communication usually takes place through the shared memory. (see Fig. 6left)
 Multiprocessor systems have three main advantages:
1. Increased throughput. By increasing the number of processors, we expect to get more
work done in less time. When multiple processors cooperate on a task, a certain amount
of overhead is incurred in keeping all the parts working correctly. This overhead, plus
contention for shared resources, lowers the expected gain from additional processors.
2. Economy of scale. Multiprocessor systems can cost less than equivalent multiple single-
processor systems, because they can share peripherals, mass storage, and power supplies.
3. Increased reliability. If functions can be distributed properly among several processors,
then the failure of one processor will not halt the system, only slow it down. If we have
ten processors and one fails, then each of the remaining nine processors can pick up a
share of the work of the failed processor. Thus, the entire system runs only 10 percent
slower, rather than failing altogether.
 The multiple-processor systems in use today are of two types.
1. Some systems use asymmetric multiprocessing, in which each processor is assigned a
specific task. A master processor controls the system; the other processors either look to
the master for instruction or have predefined tasks. This scheme defines a master-slave
relationship.
2. The most common systems use symmetric multiprocessing (SMP), in which each
processor performs all tasks within the OS. SMP means that all processors are peers; no
master-slave relationship exists between processors

 The benefit of SMP model is that many processescan run simultaneously. However, we must
carefully control I/O to ensure that the data reach the appropriate processor. Also, since the CPUs
are separate, one may be sitting idle while another is overloaded, resulting in inefficiencies.
 Virtually all modern OSs-including Windows, Windows XP, Mac OS x, and Linux-now provide
support for SMP.
 The difference between symmetric and asymmetric multiprocessing may result from either
hardware or software. Special hardware can differentiate the multiple processors, or the software
can be written to allow only one master and multiple slaves.
\
Sharing resources
All distributed systems involve certain resources to be shared between the components with the
end users. What are these resources? The resources can be Hardware (computers, servers,
computer clusters, laptops, tablets, smartphones and smart-watches, Internet of Things (IoT)
devices, sensors, data bandwidth on routes between nodes, CPU cycles etc.) Another group of
resources can be described with the common term – Data. This involves data stored in databases,

23
storage devices etc. But this includes also all kind of software together with its development
(both proprietary as well as community-developed open source software.)
To be able to access some resource one needs to be able to name it. This means, we need a (i)
namespace for identification of a group of resources.
In order to get it working in a distributed environment there should be a mechanism for
(ii) name translation to network address. And of course, in case of multiple access, possibly in
a competing setup, well-defined
(iii) synchronization is needed to avoid unconsistencies, dead-lock and starvation situations.
How to characterize a distributed system?
From above we can conclude, that distributed systems are characterized by
(a) concurrency of components, meaning that all parts of a distributed system are independent
and at the same time are competing for shared resources.
(b) lack of a global clock. This means, that each processor on each node is running on its own
clockrate and there is no synchroniztion of CPU clocks. Independence of the components yields
also
(c) independent failures of components, meaning that the design of a distributed system needs to
take into account the fact that whichever node can crash at whichever time or become
unavailable because of broken communication.
Cloud-based software, the backbone of distributed systems, is a complicated network of
servers that anyone with an internet connection can access. In a distributed system, components
and connectors arrange themselves in a way that eases communication. Components are modules
with well-defined interfaces that can be replaced or reused. Similarly, connectors are
communication links between modules that mediate coordination or cooperation among
components.

Architectural models
The architecture of a system is its structure in terms of separately specified components and their
interrelationships. The overall goal is to ensure that the structure will meet present and likely
future demands on it. Major concerns are to make the system reliable, manageable, adaptable and
cost-effective. The architectural design of a building has similar aspects – it determines not only
its appearance but also its general structure and architectural style (gothic, neo-classical, modern)
and provides a consistent frame of reference for the design.
Software layers
The concept of layering is a familiar one and is closely related to abstraction. In a layered
approach, a complex system is partitioned into a number of layers, with a given layer making use
of the services offered by the layer below. A given layer therefore offers a software abstraction,
with higher layers being unaware of implementation details, or indeed of any other layers
beneath
them.

24
In terms of distributed systems, this equates to a vertical organization of services into service
layers. A distributed service can be provided by one or more server processes, interacting with
each other and with client processes in order to maintain a consistent system-wide view of the
service’s resources. For example, a network time service is implemented on the Internet based on
the Network Time Protocol (NTP) by server processes running on hosts throughout the Internet
that supply the current time to any client that requests it and adjust their version of the current
time as a result of interactions with each other. Given the complexity of distributed systems, it is
often helpful to organize such services into layers. the important terms platform and middleware,
which define as follows:
The important terms platform and middleware, which is defined as follows:
A platform for distributed systems and applications consists of the lowest-level hardware and
software layers. These low-level layers provide services to the layers above them, which are
implemented independently in each computer, bringing the system’s programming interface up
to a level that facilitates communication and coordination between processes. Intel x86/Windows,
Intel x86/Solaris, Intel x86/Mac OS X, Intel x86/Linux and ARM/Symbian are major examples.
– Remote Procedure Calls – Client programs call procedures in server programs
– Remote Method Invocation – Objects invoke methods of objects on distributed hosts
– Event-based Programming Model – Objects receive notice of events in other objects in which
they have interest
Middleware
• Middleware: software that allows a level of programming beyond processes and message
passing
– Uses protocols based on messages between processes to provide its higher-level abstractions
such as remote invocation and events
– Supports location transparency
– Usually uses an interface definition language (IDL) to define interfaces
Interfaces in Programming Languages
– Current PL allow programs to be developed as a set of modules that communicate with each
other. Permitted interact ions between modules are defined by interfaces
– A specified interface can be implemented by different modules without the need to modify
other modules using the interface
• Interfaces in Distributed Systems
– When modules are in different processes or on different hosts there are limitations
on the interactions that can occur. Only actions with parameters that are fully specified and
understood can communicate effectively to request or provide services to modules in another
process
– A service interface allows a client to request and a server to provide particular services
– A remote interface allows objects to be passed as arguments to and results from distributed
modules
• Object Interfaces

25
– An interface defines the signatures of a set of methods, including arguments, argument types,
return values and exceptions. Implementation details are not included in an interface.
A class may implement an interface by specifying behavior for each method in the interface.

1. software architecture
i) Layered architecture
Layered architecture provides a modular approach to software. By separating each component, it
is more efficient. For example, the open systems interconnection (OSI) model uses a layered
architecture for better results. It does this by contacting layers in sequence, which allows it to
reach its goal. In some instances, the implementation of layered architecture is in cross-layer
coordination. Under cross-layer, the interactions can skip any adjacent layer until it fulfills the
request and provides better performance results.

Layered Architecture
Layered architecture is a type of software that separates components into units. A request goes
from the top down, and the response goes from the bottom up. The advantage of layered
architecture is that it keeps things orderly and modifies each layer independently without
affecting the rest of the system.
ii) Object-based architecture
Object-based architecture centers around an arrangement of loosely coupled objects with no
specific architecture like layers. Unlike layered architecture, object-based architecture doesn’t
have to follow any steps in a sequence. Each component is an object, and all the objects can
interact through an interface (or connector). Under object-based architecture, such interactions
between components can happen through a direct method call.

26
Object-based Architecture
At its core, communication between objects happens through method invocations, often called
remote procedure calls (RPC). Popular RPC systems include Java RMI and Web Services and
REST API Calls. The primary design consideration of these architectures is that they are less
structured. Here, component equals object, and connector equals RPC or RMI.
iii) Data-centered architecture
Data-centered architecture works on a central data repository, either active or passive. Like most
producer-consumer scenarios, the producer (business) produces items to the common data store,
and the consumer (individual) can request data from it. Sometimes, this central repository can be
just a simple database.

Data-centered Architecture
All communication between objects happens through a data storage system in a data-centered
system. It supports its stores’ components with a persistent storage space such as an SQL
database, and the system stores all the nodes in this data storage.
iv) Event-based architecture

In event-based architecture, the entire communication is through events. When an event occurs,
the system gets the notification. This means that anyone who receives this event will also be
notified and has access to information. Sometimes, these events are data, and at other times they

27
are URLs to resources. As such, the receiver can process what information they receive and act
accordingly.

Event-Based Architecture
One significant advantage of event-based architecture is that the components are loosely coupled.
Eventually, it means that it’s easy to add, remove, and modify them. To better understand this,
think of publisher-subscriber systems, enterprise services buses, or akka.io. One advantage of
event-based architecture is allowing heterogeneous components to communicate with the bus,
regardless of their communication protocols.
2. System architecture
System-level architecture focuses on the entire system and the placement of components of a
distributed system across multiple machines. The client-server architecture and peer-to-peer
architecture are the two major system-level architectures that hold significance today. An
example would be an ecommerce system that contains a service layer, a database, and a web
front.
i) Client-server architecture

As the name suggests, client-server architecture consists of a client and a server. The server is
where all the work processes are, while the client is where the user interacts with the service and
other resources (remote server). The client can then request from the server, and the server will
respond accordingly. Typically, only one server handles the remote side; however, using
multiple servers ensures total safety.

28
Client-server Architecture
Client-server architecture has one standard design feature: centralized security. Data such as
usernames and passwords are stored in a secure database for any server user to have access to
this information. This makes it more stable and secure than peer-to-peer. This stability comes
from client-server architecture, where the security database can allow resource usage in a more
meaningful way. The system is much more stable and secure, even though it isn’t as fast as a
server. The disadvantages of a distributed system are its single point of failure and not being as
scalable as a server.
ii) Peer-to-peer (P2P) architecture
A peer-to-peer network, also called a (P2P) network, works on the concept of no central control
in a distributed system. A node can either act as a client or server at any given time once it joins
the network. A node that requests something is called a client, and one that provides something is
called a server. In general, each node is called a peer.

Peer-to-Peer Architecture
If a new node wishes to provide services, it can do so in two ways. One way is to register with a
centralized lookup server, which will then direct the node to the service provider. The other way

29
is for the node to broadcast its service request to every other node in the network, and whichever
node responds will provide the requested service.
P2P networks of today have three separate sections:
 Structured P2P: The nodes in structured P2P follow a predefined distributed data
structure.
 Unstructured P2P: The nodes in unstructured P2P randomly select their neighbors.
 Hybrid P2P: In a hybrid P2P, some nodes have unique functions appointed to
them in an orderly manner.

Types of distributed architectures


Overview
Distributed systems are becoming increasingly popular as organizations look for ways to scale
their operations and improve their overall efficiency. These systems are composed of multiple
components that work together to achieve a common goal, and the architecture of these systems
plays a critical role in determining their overall performance and reliability., we will explore
some of the most popular architecture styles in distributed systems and provide examples of each.
In distributed architecture, components are presented on different platforms and several
components can cooperate with one another over a communication network in order to achieve a
specific objective or goal.
 In this architecture, information processing is not confined to a single machine rather it is
distributed over several independent computers.
 A distributed system can be demonstrated by the client-server architecture which forms
the base for multi-tier architectures; alternatives are the broker architecture such as
CORBA, and the Service-Oriented Architecture (SOA).
 There are several technology frameworks to support distributed architectures,
including .NET, J2EE, CORBA, .NET Web services, AXIS Java Web services, and
Globus Grid services.
 Middleware is an infrastructure that appropriately supports the development and
execution of distributed applications. It provides a buffer between the applications and
the network.
 It sits in the middle of system and manages or supports the different components of a
distributed system. Examples are transaction processing monitors, data convertors and
communication controllers etc.
Middleware as an infrastructure for distributed system

30
The basis of a distributed architecture is its transparency, reliability, and availability.
The following table lists the different forms of transparency in a distributed system −
Sr.No. Transparency & Description

1 Access:Hides the way in which resources are accessed and the differences in data
platform.

2 Location:Hides where resources are located.

3 Technology:Hides different technologies such as programming language and OS from


user.

4 Migration / Relocation:Hide resources that may be moved to another location which


are in use.

5 Replication:Hide resources that may be copied at several location.

6 Concurrency:Hide resources that may be shared with other users.

7 Failure:Hides failure and recovery of resources from user.

8 Persistence:Hides whether a resource ( software ) is in memory or disk.

Client-Server Architecture
The client-server architecture is the most common distributed system architecture which
decomposes the system into two major subsystems or logical processes −
 Client − This is the first process that issues a request to the second process i.e. the server.
 Server − This is the second process that receives the request, carries it out, and sends a
reply to the client.

31
In this architecture, the application is modelled as a set of services that are provided by servers
and a set of clients that use these services. The servers need not know about clients, but the
clients must know the identity of servers, and the mapping of processors to processes is not
necessarily 1 In this architecture, clients connect to servers in order to access resources and
services. The servers provide the resources and services, while the clients request and consume
them.
One example of a client-server architecture is a web server. In this case, the web server is the
server and the clients are the web browsers that connect to the server in order to access web
pages. The server provides the web pages and other resources, while the clients request and
consume them.
Another example of a client-server architecture is a file server. In this case, the file server is the
server and the clients are the computers that connect to the server in order to access files. The
server provides the files, while the clients request and consume them.

Client-server Architecture can be classified into two models based on the functionality of the
client −
Thin-client model
In thin-client model, all the application processing and data management is carried by the server.
The client is simply responsible for running the presentation software.
 Used when legacy systems are migrated to client server architectures in which legacy
system acts as a server in its own right with a graphical interface implemented on a client
 A major disadvantage is that it places a heavy processing load on both the server and the
network.
Thick/Fat-client model
In thick-client model, the server is only in charge for data management. The software on the
client implements the application logic and the interactions with the system user.
 Most appropriate for new C/S systems where the capabilities of the client system are
known in advance

32
 More complex than a thin client model especially for management. New versions of the
application have to be installed on all clients.

Advantages
 Separation of responsibilities such as user interface presentation and business logic
processing.
 Reusability of server components and potential for concurrency
 Simplifies the design and the development of distributed applications
 It makes it easy to migrate or integrate existing applications into a distributed
environment.
 It also makes effective use of resources when a large number of clients are accessing a
high-performance server.
Disadvantages
 Lack of heterogeneous infrastructure to deal with the requirement changes.
 Security complications.
 Limited server availability and reliability.
 Limited testability and scalability.
 Fat clients with presentation and business logic together.
Peer-to-Peer Architecture
The peer-to-peer architecture is another popular architecture style in distributed systems. In this
architecture, all components of the system are equal and can act as both clients and servers. This
means that each component can provide resources and services as well as request and consume
them.
One example of a peer-to-peer architecture is a file-sharing network. In this case, each computer
on the network can act as both a client and a server, providing files to other computers and also
requesting and consuming files from other computers.
Another example of a peer-to-peer architecture is a distributed hash table (DHT). In this case,
each node in the DHT can act as both a client and a server, providing resources and services as
well as requesting and consuming resources and services from other nodes

Multi-Tier Architecture (n-tier Architecture)

33
Multi-tier architecture is a client–server architecture in which the functions such as presentation,
application processing, and data management are physically separated. By separating an
application into tiers, developers obtain the option of changing or adding a specific layer, instead
of reworking the entire application. It provides a model by which developers can create flexible
and reusable applications.

The most general use of multi-tier architecture is the three-tier architecture. A three-tier
architecture is typically composed of a presentation tier, an application tier, and a data storage
tier and may execute on a separate processor.
Presentation Tier
Presentation layer is the topmost level of the application by which users can access directly such
as webpage or Operating System GUI (Graphical User interface). The primary function of this
layer is to translate the tasks and results to something that user can understand. It communicates
with other tiers so that it places the results to the browser/client tier and all other tiers in the
network.
Application Tier (Business Logic, Logic Tier, or Middle Tier)
Application tier coordinates the application, processes the commands, makes logical decisions,
evaluation, and performs calculations. It controls an application’s functionality by performing
detailed processing. It also moves and processes data between the two surrounding layers.
Data Tier
In this layer, information is stored and retrieved from the database or file system. The
information is then passed back for processing and then back to the user. It includes the data
persistence mechanisms (database servers, file shares, etc.) and provides API (Application
Programming Interface) to the application tier which provides methods of managing the stored
data.

34
Advantages
 Better performance than a thin-client approach and is simpler to manage than a thick-
client approach.
 Enhances the reusability and scalability − as demands increase, extra servers can be
added.
 Provides multi-threading support and also reduces network traffic.
 Provides maintainability and flexibility
Disadvantages
 Unsatisfactory Testability due to lack of testing tools.
 More critical server reliability and availability.

Microservices Architecture
The microservices architecture is a relatively new architecture style that is gaining popularity in
distributed systems. In this architecture, the system is composed of a collection of small,
independently deployable services that work together to achieve a common goal.
One example of a microservices architecture is a online marketplace. In this case, the system is
composed of a collection of small, independently deployable services such as a product catalog
service, an inventory management service, and a checkout service. Each service can be
developed, deployed, and scaled independently, which allows for greater flexibility and
scalability.
Another example of a microservices architecture is a social media platform. In this case, the
system is composed of a collection of small, independently deployable services such as a user
profile service, a newsfeed service, and a messaging service. Each service can be developed,
deployed, and scaled independently, which allows for greater flexibility and scalability.

35
Event-Driven Architecture
The event-driven architecture is another architecture style that is gaining popularity in distributed
systems. In this architecture, the system is composed of a collection of components that
communicate with each other by sending and receiving events.
One example of an event-driven architecture is a real-time stock trading system. In this case, the
system is composed of a collection of components such as a stock market data feed, a trading
algorithm, and a trading execution engine. The components communicate with each other by
sending and receiving events such as stock market data and trading instructions.
Another example of an event-driven architecture is a sensor network. In this case, the system is
composed of a collection of sensors that collect data and send it to a central processing unit. The
sensors communicate with each other by sending and receiving events such as sensor data and
instructions. This allows for real-time data processing and decision making.

Broker Architectural Style


Broker Architectural Style is a middleware architecture used in distributed computing to
coordinate and enable the communication between registered servers and clients. Here, object
communication takes place through a middleware system called an object request broker
(software bus).
 Client and the server do not interact with each other directly. Client and server have a
direct connection to its proxy which communicates with the mediator-broker.
 A server provides services by registering and publishing their interfaces with the broker
and clients can request the services from the broker statically or dynamically by look-up.
 CORBA (Common Object Request Broker Architecture) is a good implementation
example of the broker architecture.
Components of Broker Architectural Style
The components of broker architectural style are discussed through following heads −
Broker
Broker is responsible for coordinating communication, such as forwarding and dispatching the
results and exceptions. It can be either an invocation-oriented service, a document or message -
oriented broker to which clients send a message.
 It is responsible for brokering the service requests, locating a proper server, transmitting
requests, and sending responses back to clients.
 It retains the servers’ registration information including their functionality and services as
well as location information.
 It provides APIs for clients to request, servers to respond, registering or unregistering
server components, transferring messages, and locating servers.
Stub
Stubs are generated at the static compilation time and then deployed to the client side which is
used as a proxy for the client. Client-side proxy acts as a mediator between the client and the

36
broker and provides additional transparency between them and the client; a remote object
appears like a local one.
The proxy hides the IPC (inter-process communication) at protocol level and performs
marshaling of parameter values and un-marshaling of results from the server.
Skeleton
Skeleton is generated by the service interface compilation and then deployed to the server side,
which is used as a proxy for the server. Server-side proxy encapsulates low-level system-specific
networking functions and provides high-level APIs to mediate between the server and the broker.
It receives the requests, unpacks the requests, unmarshals the method arguments, calls the
suitable service, and also marshals the result before sending it back to the client.
Bridge
A bridge can connect two different networks based on different communication protocols. It
mediates different brokers including DCOM, .NET remote, and Java CORBA brokers.
Bridges are optional component, which hides the implementation details when two brokers
interoperate and take requests and parameters in one format and translate them to another format.

Broker implementation in CORBA


CORBA is an international standard for an Object Request Broker – a middleware to manage
communications among distributed objects defined by OMG (object management group).

37
Key Components of a Distributed System
The three basic components of a distributed system include primary system controller, system
data store, and database. In a non-clustered environment, optional components consist of user
interfaces and secondary controllers.

Main Components of a Distributed System


1. Primary system controller
The primary system controller is the only controller in a distributed system and keeps track of
everything. It’s also responsible for controlling the dispatch and management of server requests
throughout the system. The executive and mailbox services are installed automatically on the
primary system controller. In a non-clustered environment, optional components consist of a user
interface and secondary controllers.
2. Secondary controller

38
The secondary controller is a process controller or a communications controller. It’s responsible
for regulating the flow of server processing requests and managing the system’s translation load.
It also governs communication between the system and VANs or trading partners.
3. User-interface client
The user interface client is an additional element in the system that provides users with important
system information. This is not a part of the clustered environment, and it does not operate on the
same machines as the controller. It provides functions that are necessary to monitor and control
the system.
4. System datastore
Each system has only one data store for all shared data. The data store is usually on the disk vault,
whether clustered or not. For non-clustered systems, this can be on one machine or distributed
across several devices, but all of these computers must have access to this datastore.
5. Database
In a distributed system, a relational database stores all data. Once the data store locates the data,
it shares it among multiple users. Relational databases can be found in all data systems and allow
multiple users to use the same information simultaneously.

39

You might also like