Concurrency in Cloud Computing
The current technology development has highly resulted to the use of modern technology in terms of management of the resources like the database and the records ,however the most spread and popular technology is the cloud computing which is a type of platform that is online based and it is used to host some applications and also some data too.
The cloud computing is provided by some services providers called the cloud services vendors and this has various advantages as follows:
- Reducing the cost ,where the capital used to purchase the computer equipments hardware and the maintenance services.
- It assists in improvement of the efficient matching in operation costs against the income of the organization.
- It also assists the organization to change the models in the businesses from capital investments to opex costs models.
- The lowing of the acquisition costs where the resources like the computing and storage hardware buying cost is eliminated.
- There is minimized managements maintenances costs where all those are done by the cloud services vendor who manages the data centers.
- There is Scalability and flexibility in the capacity of the system where the resources are scaled at high abstraction level.
In this report there is use of the concurrency process where the users of the cloud services are able to transact many operations together without interfering with each other .Therefore the concurrency is a the ability of the cloud services to enable multiple transactions by a number or multiple services users, where the users can be able to access a file at the same time and can perform various operations like editing, deleting and updating it.
This is unlike the previous versions of technologies used to store files and records like the spreadsheet which could only allow the various users view the records but cannot edit it where only one user could do operations to the files like copying which is caused by locking process which is activated automatically after the first user opens the file.
The concurrency in the cloud computing has the various advantages which make it more resourceful to its users which include the following:
- Increasing the programs throughput this is by allowing the concurrence in the execution of the programs and thus tasks completed in the unit time is also increased.
- It increases the responsiveness in the inputs and outputs of the processes where the waiting time for the concurrent programs is utilized by other programs to be executed.
- It assists in making structures of the program which is much appropriate for any concurrent programs.
The concurrency process is going to be illustrated by use of the cloud based application called the dropbox which is either accessed through internet or by use of the application installed in the computer devices, this application helps in sharing of the files like photos and videos among two users or to the public as well.
However the ERlang programming language is used to illustrate the concurrency and how the concurrency problems are overcome ,this language is used since it develops the systems whose runtime allows the concurrency and thus if the system is used by many users there will be no challenge faced in the access of the system or resources as well.
In this case we are going to use the applications called dropbox which is an application hosted in the cloud server and is used to perform concurrent processes where various users are able to access the files on the cloud servers using the dropbox application which is installed in their computers and uses internet connection to access the files in the cloud server.
ERlang Programming Language for Concurrency
However Dropbox is an online files storage service that is provided by cloud computing vendors and it mainly enables the users to do storage and sharing of documents, video, pictures and they are able to retrieve them at any time needed. Below are some of the advantages of using the dropbox application in the cloud services.
- Low Operation cost,this is because the application is readily available and no charges to use or acquire it since it is free.
- Large storage capacity-The dropbox has about 2 GB storage space which is assigned to any user of the application and this space can be increased as well to a larger one.
- It is much convenient to the users-The dropbox application has ease of use where the users can require either to use it online or even install the applications to their computers and thus enabling the users to synchronize the shared files between the connected computer and the servers or local computers.
- The application is highly accessible –This is because the application is used to access the files shared any time or in any place and the dropbox folders keep on getting updates even when the devices are offline, however the files on dropbox are also accessible using the mobile devices as well [1].
- Easy to Share – The users of the dropbox application are also able to share the documents where files can be shared to either certain users or the or to the public.
- It enables the users to do files backups-The dropbox enable secure saving of files where they are also easily accessed and thus it reduces expenses of buying storage devices like the compact disks and the Digital versatile disks.
- Easy restoration of files-The files which are deleted can be easily retrieved since after the file deletion it is preserved by the dropbox for thirty days after which it can be erased permanently.
In order to illustrate the concurrency in the cloud services ERlang program is used to show how the problems in concurrency can be resolved.
However the ERLang programming language that is used in building of real time programs or software that its availability is highly required in systems like bank, computer-telephony and the messaging systems where those systems supports concurrency, distributions and fault-tolerance in the systems.
The ERlang programming language will be used since the system developed has the following good properties:
- Good distribution.
- Faults tolerance.
- Softs real times.
- High availability without fail.
- Has hot swapping properties where the codes get updated while the system is running.
However the programming language has good characters like the :
- It has the immutability of the data.
- Has nice patterns matching.
- And it supports the functional programming as well.
The concurrency processes are very useful in the operation of the real time systems where the users are able to access the system concurrently ,however Finite State Processes is used to show the various problems encountered in the concurrency when transactions executes uncontrollably ,however in the finite state process there is use of various processes that run in a state machine where they can run concurrently in the same computer .
These processes that run in the state machine they are either overlapping or concurrent to each other in order to emulate the inherency of concurrency that can reflect the physical world.
However there are various challenges that tends to occur while developing the systems which are large and complex since they tend to cause some errors ,however there is the use of engineering process to overcome all those challenges where the finite state machine is used like the model processes .
This is however illustrated using some programming languages which shows the concurrency ,where the language used for this case is ERlang program since it supports development of systems that supports concurrency in the run-time process.
There is a model that is mainly used for the purpose of illustration of finite state process where the processes in the model involves executions of programs in sequential manner where it act as the finite state machine that change from one to another state through executions of atomic actions [7].
Below is an illustration of the model used using the lighting switch.
The above model diagram shows the processes which are sequence of on and off states and they occur as below.
Concurrency Control Techniques
ON->OFF-> ON->OFF-> ON->OFF-> ON->OFF-> ON->OFF-> ON->OFF->
Below statement is the description of actions prefix in the FSP .
Given y is one action and then N is a given process and then (y->M) gives the description of process that uses the action y which tends to have behaviours as described by process M.
The figure above figure shows how the FSP works where the actions used starts with letters which are in lowercases while the processes starts with letters which are in uppercases.
The figure below shows how the actions prefixes and recursion in FSP works as in the below figure.
[6]
- Recursion for repetitive behaviors:
Below is the syntax used for the recursive behavior in the FSP as illustrated in our lighting switch above.
SWITCH = OFF,
OFF = (on -> ON),
ON = (off-> OFF).
- Substitute the process to get better results.
SWITCH = OFF,
OFF = (on ->(off->OFF)).
- Then substitute again the process to simplify the equation.
SWITCH = (on->off->SWITCH).
However the concurrency using finite state process have some challenges as discussed here below:
The lost updates is a condition that occurs in case there are two transactions that need to have access to file or databases item and in the process they tend to make some figures wrong this is caused by any case of overwriting certain updates.
This is a problem that occurs when a transaction is executed to perform update of certain record then it fails to be successfully updated ,however another executed transaction end up accessing the item before it go back to normal state or values and thus causes a problem.
This is a problem that rises from the calculations of the summaries of certain data sets while there is another process that still doing the update of the same set of data and thus leading to an error and result becomes inconsistent. This results to be a problem since the transaction reads data which are not updated and other which are updated.
This is a problem that occurs when the scheduler has some problems of due to disorganized order of operations this end up causing poor isolations and serialization of the transactions.
In order to handle the various problem in the concurrency the various concurrency control techniques are used.
The concurrency controls are used to manage the transactions which happens to be executed simultaneously in a system which is multiprocessing by nature and this prevents the processes from interfering with each other.
However these techniques are used to ensure there is atomicity in the executions of the transactions where there is multiple users of the system and also helps in interleaving the operations like the read and write transactions and thus the results obtained end up being the same with the serial schedule executions.
Conclusion
Below are the most applicable techniques which are solutions to the concurrency problem:
The concurrency problem can be solved using this technique ,this is by assuming that the problem does not happen at all and incase it happens there will be little or no impact at all , however this technique does not happen in all problems especially those involving money.
This is a technique that is applied in the lost updates problem and this is used where any record is retrieved it is a requirement to be updated as well, however this techniques instructs the transaction to lock the processes in order the other transactions cannot have access to it [2].
This is the technique that is used to prevent concurrency problems ,however it cannot be used in the web applications .In this technique the retrieved records are then updated in later days and the records in the current state is saved is saved in a separate location. However the old record is recorded as image or and after the user commit changes is then recorded as the new image of the stored records [3].
The records before are saved they are changed to the current image which is then saved after the comparison is made between fields in the database and the one in the current image and incase the transaction note difference then it is noted that another process had already made the changes to the records previously.
However this technique is good since no blocking problem unlike the previous techniques and thus it is recommendable.
This is used to do prevention of the concurrency problems ,where the records stored have clear indication of the last date of modifications and the field of the date gets updates each time a new record is entered.
This works in a the way where before modification is made the records are saved as only the columns in the last modification date ,then before the saving of the records only the timestamps field is retrieved and compared with the current record and this technique applies the read before write technique.
This is a technique that is used to prevent concurrency problem where only a single transaction that is allowed to make modification of the records at any given time and only a few number of file will be involved thus the process will be very quickly.
This is a technique where only one document is locked instead of locking the entire files systems then the affected files are checked by scrolling all documents and creating the lock files for each.
This is where a the directory is locked instead of locking of the entire all documents ,however this will provide exclusive accessibility to files or the directories that require to be renamed and can be done using the exclusive lock documents [4]. However then the locks are shared with the parents directories using the shared lock document.
The concurrency however is however tested using the ERlang programming language below is the image of the tool used for the testing process.
To test the concurrency the below are the steps used .
- Download ERlang setup .
- Install the ERlang /OTP application .
- Execute the ERlang application as below to enter the codes
However the codes below are also used to do the testing and below are the results.
Source codes.
%This is the initialization part of the program
sequenceone.erl (raw implementation)
-module(sequenceone)
-export([make_sequence/1, get_Next/2, reset/2])
% Creating the new counters which is shared.
make_sequence() ->
spawn(fun() -> sequence_loop(1) end)
% passing the value to the loops
sequence_loop(X) ->
receive
{From, get_Next} ->
From ! {self(), X},
sequence_loop(X + 1);
reset ->
sequence_loop(1)
end.
% Retrieving the counter and incrementing it.
get_Next(Sequence) ->
Sequence ! {self(), get_Next},
receive
{Sequence, X} -> X
end.
% Then do the Re-initialization of the counters to be one.
reset(Sequence) ->
%This is the output after the counter is reset to be 1
After the execution the below is the image showing the output of the executed program showing all the transactions running in the system and they terminate after few number of loops as shown below.
During the analysis of the concurrency using the ERlang the process was successful where all the processes were displayed appropriately ,however the problems encountered were just few including the accessibility of the tools to be used which was to be downloaded ,however the other problem is the tool used is less graphical interfaced which could produce output which not so pleasant.
However sing the ERlang it makes it easy to learn and understand the processes that are running in the system .
Conclusions.
The cloud computing is an important services that are provided to the users and it has multiple of advantages where it enable the users to store their records more secure where they just require to use an application like dropbox to store and retrieve their records.
However the cloud computing also enables easy sharing of the resources between the users and allows the back up and easy restoration of the stored files .
Through the help of the concurrency the cloud services is made very efficient and improve flexibility in terms of data storage and management which is enabled by the handling of the various arising problems of the concurrency.
Therefore it is very important for various organization to embrace the cloud services and make use of the application like the dropbox to access their shared or stored files in the cloud servers.
Reference
[1] P. Aleksandar, Learning Concurrent Programming in Scala. New York: Packt Publishing, 2015.
[2] A. Krzysztof, Logics and Models of Concurrent Systems (Nato ASI Subseries F:). Berlin: Springer-Verlag Berlin, 2014.
[3] J. Armstrong, Programming Erlang: Software for a Concurrent World. Raleigh, NC: The Pragmatic Bookshelf, 2015
[4] G. Steele, The New Hacker’s Dictionary. Cambridge: MIT Press, 2015.
[5] J. Armstrong, Making reliable distributed systems in the presence of software errors. Sundbyberg: Swedish institute of computer science, 2016.
[6] R. Michel, Concurrent Programming: Algorithms, Principles, and Foundations. Redwood:Benjamin-Cummings Publishing Co., Inc, 2015.
[7] K.Jensen, Coloured Petri Nets: Modelling and Validation of Concurrent Systems. New York: Springer Publishing Company, 2016.