Cloud Haskell: Functional Programming
Cloud Haskell is based on the Haskell functional programming and domain specific language. These
functional programming languages are function based and work like mathematical functions. Usually,
the output here is based on the input value only. Functional programming consists of components that
are often immutable. Immutable components are the components whose states cannot be modified
after they have been created.
It is completely based on message-passing interface, that works concurrently which can be used for
highly reliable real-time application. Since the Cloud consists of several independent applications and
users, concurrency has to be ensured for a large number of requests.
The data are completely isolated and the applications cannot breach the boundary and access other
data. As mentioned earlier, the communication is completely based on message-passing model.
There are several advantages of Haskell apart from the use of Erlang’s fault tolerance model. Its main
advantage is that it is a pure functional language. All the data are immutable by default and functions
are idempotent. means the ability to functions and to restart from any points on its own without the
use of any external entity such as a distributed database when the function is aborted due to
hardware error.
This model is not designed to have a shared memory. As the model supports concurrency and these
processes are isolated, fault tolerance is expected to an extent and the failure of one process would
not affect others.
Serialization is another feature, where a programmer tries to use the distributed code, he had to run
the code in a remote system, which is not possible in Haskell versions. The model also takes care of
failure, which is an important issue in cloud. There are many ways in which failure might affect the
functioning of the system. As the number of systems connected and users increase, failure rate also
increases. Usually, to confront partial failure, the whole system is restarted. This is considered as one
of the inefficient solutions as when it comes to cloud the number of distributed nodes is high, and so
restarting a system can prove to be very costly. Thus, to maintain fault tolerance, Erlang’s method is
used. Even if a function fails because of certain reasons, it can be separately restarted without
affecting the other parts and processes. Here, the components are immutable and otherwise called
pure functions [4].
Key features
•Fault tolerant
•Domain-specific language
•Uses concurrent programming paradigm
•No shared memory
•Idempotent
•Purely functional
MultiMLton: Functional Programming
MultiMLton is specifically used for multiprocessor environments and is an extension of MLton. MLton
is an open-source, whole-program, optimizing standard ML compiler. It is used for expressing and
implementing various kinds of fine-grained parallelism. It has the capability to efficiently handle a large
number of lightweight threads. It provides additional parallelism whenever possible and whenever the
result is profitable by using deterministic concurrency within threads. This increases speed and will
eventually give good performance. It also provides message-passing aware composable speculative
actions . It provides isolation among groups of communicating threads. The communication between
the threads happens through simple message-passing techniques. It allows construction of
asynchronous events that integrate abstract synchronous communication protocols.
The MultiMLton model consists of a component that is known as a parasite. These parasites are mini
threads that depend on a main or master thread for its execution. As mentioned earlier,
communication between threads can be synchronous and asynchronous. The following figure shows
a simple communication between the parasite of one thread and another thread.
Key features
•Can efficiently handle a large number of lightweight threads.
•Suitable for multiprocessor environment.
•Deterministic concurrency is used wherever necessary.
ERLANG:
Erlang is a concurrent and functional programming language that uses asynchronous message-
passing techniques for communication. Here, communication can be done only through a message-
passing mechanism. Creating and deleting processes are very easy, and message-passing
processors require less memory; hence, it is considered as lightweight. It follows a process based on
a model of concurrency.
This programming model is used to develop real-time systems where timing is very critical. Fault
tolerance is one of the important properties of Erlang. It does not have a shared memory as
mentioned earlier; all the interactions are done through message passing. It has good memory
management system and allocates and deallocates memory automatically with dynamic (runtime)
garbage collection. Thus, a programmer need not worry about the memory management, and thereby
memory-related errors can be avoided. One of the most striking properties of Erlang is that it allows
code replacement in the runtime. A user can change the code while a program is running and can use
the same new code simultaneously.
Erlang, by definition, is a declarative language. It can also be regarded as a functional programming
language. Functional programming languages are the languages that depend only on input data. This
property is usually called immutability. This is the base property that makes functional programming
the most suitable programming model for cloud. These properties allow the programmers to use
concurrency and to scale the system, which is one of the important properties of cloud.
Key features
•Fault tolerant
•Robust
•Concurrent
•Uses functional programming model
Cloud I
An open-source cloud computing framework that allows building a cloud platform (a private cloud)
without actual virtualization. It is basically for back-end server processing tasks.
CloudI is built over the Erlang programming language. It is aimed at being fault tolerant and has a
highly scalable architecture . It consists of a messaging application programming interface (API) that
allows CloudI services to send requests.
CloudI API supports both publish/supply and request/reply messages. Apart from fault tolerance,
which is one of its important properties, CloudI can easily support other languages or a polyglot
environment.
Here, all the communications is done through CloudI API. The following figure depicts the
interrelations and the communication between the CloudI service instance and process service
instances. The CloudI messaging bus acts as an interface between the APIs and the Erlang VM.
Each process service consists of CloudI API and is responsible for communication.
Key features
•Uses functional programming model
•Fault tolerant
•Supports many languages
•Supports extensive scalability