SlideShare a Scribd company logo
1 of 5
Download to read offline
Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com
ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129
www.ijera.com 125 | P a g e
Multiple Printer Problem with STM
Sayantan Sen, Ryan Saptarshi Ray, Hridam Basu, Utpal Kumar Ray, Parama
Bhaumik
B. E (IT) 3rd
Year Student Department of Information Technology, Jadavpur University Kolkata, India
Junior Research Fellow Department of Information Technology, Jadavpur University Kolkata, India
B. E (IT) 3rd
Year Student Department of Information Technology, Jadavpur University Kolkata, India
Associate Professor Department of Information Technology, Jadavpur University Kolkata, India
Assistant Professor Department of Information Technology, Jadavpur University Kolkata, India
Abstract
The past few years have marked the start of a historic transition from sequential to parallel computation. The
necessity to write parallel programs is increasing as systems are getting more complex while processor speed
increases are slowing down. Current parallel programming uses low-level programming constructs like threads
and explicit synchronization using locks to coordinate thread execution. Parallel programs written with these
constructs are difficult to design, program and debug. Also locks have many drawbacks which make them a
suboptimal solution.
Software Transactional Memory (STM) is a promising new approach to programming shared-memory parallel
processors. It is a concurrency control mechanism that is widely considered to be easier to use by programmers
than locking. It allows portions of a program to execute in isolation, without regard to other, concurrently
executing tasks. A programmer can reason about the correctness of code within a transaction and need not worry
about complex interactions with other, concurrently executing parts of the program
This paper shows the concept of writing code using Software Transactional Memory (STM) and the
performance comparison of codes using locks with those using STM. It also shows that STM is easier to use
than locks. This is because critical sections need not to be identified in case of STM. If we enclose the entire
code with STM, then the performance does not decrease. But in case of lock, if we enclose the whole code
within lock, performance drastically decreases.
Keywords- Parallel Programming; Multiprocessing; Locks; Transactions; Software Transactional Memory
I. INTRODUCTION
Generally one has the idea that a program
will run faster if one buys a next-generation
processor. But currently that is not the case. While
the next-generation chip will have more CPUs, each
individual CPU will be no faster than the previous
year’s model. If one wants programs to run faster,
one must learn to write parallel programs as currently
multi-core processors are becoming more and more
popular. The past few years have marked the start of
a historic transition from sequential to parallel
computation. The necessity to write parallel programs
is increasing as systems are getting more complex
while processor speed increases are slowing down.
Parallel Programming means using multiple
computing resources like processors for programming
so that the time required to perform computations is
reduced [1].
II. MULTIPLE PRINTER PROBLEM
There is a fixed amount of work. Initially,
only one printer is used to perform this work. Now if
the same work is performed using multiple printers,
then time taken should proportionately decrease. But
in case of multiple printers, as more than one printer
may try to perform the same work at the same time,
synchronization problems may occur. This paper
shows how these synchronization problems can be
overcome.
III. MULTIPLE PRINTER PROBLEM
USING LOCKS
The hardest problem that should be
overcome when writing parallel programs is that of
synchronization. Multiple threads may need to access
the same locations in memory and if careful measures
are not taken the result can be disastrous. If two
threads try to modify the same variable at the same
time, the data can become corrupt. Currently locks
are used to solve this problem. Locks ensure that a
critical section, which is a block of code that contains
variables that may be accessed by multiple threads,
can only be accessed by one thread at a time. When a
thread tries to enter a critical section, it must first
acquire that section's lock. If another thread is already
holding the lock, the former thread must wait until the
RESEARCH ARTICLE OPEN ACCESS
Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com
ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129
www.ijera.com 126 | P a g e
lock-holding thread releases the lock, which it does
when it leaves the critical section [2].
In the multiple printer problem,the printer
thread is
“print_time()”. The work which is being performed
by the printer threads is showing the number the
number of elements greater than 100 in the array “
arr[] ” .The following code snippet shows the printer
thread :
void *print_time(int * num_ptr)
{
unsigned long j,a;
int num,*number_ptr;
number_ptr=num_ptr;
num=*number_ptr;
local_min_array[num]=255;
for((j=(((num*n)/NUM_THREAD)));j<(((num+1)*n)
/NUM_THREAD);j++)
{
if(arr[j]>100)
{
pthread_mutex_lock(&mutex1);
printf("%u",arr[j]);
pthread_mutex_unlock(&mutex1);
}
}
}
The following code snippet shows how in
the printer thread the elements greater than 100 in the
array are being displayed:
if(arr[j]>100)
{
pthread_mutex_lock(&mutex1);
printf("%u",arr[j]);
pthread_mutex_unlock(&mutex1);
}
In case of multiple threads, the same printer
thread is being called multiple times.
Three lock calls have been used in the code. These
are shown below:
pthread_mutex_init(&mutex1,NULL) is used for
lock initialization.
pthread_mutex_lock(&mutex1) is used for locking.
This means that any thread which tries to access the
critical section has to first acquire the lock on
mutex1.
pthread_mutex_unlock(&mutex1) is used for
unlocking.
In this program the region where more than
one thread may access the global array arr[] at the
same time is the critical section. Thus this region is
enclosed within locks. Hence there is no
synchronization problem in the code.
IV. EXPERIMENTAL RESULTS FOR
MULTIPLE PRINTER PROBLEM
USING LOCKS
No. of
Threads
Time
taken Speedup Efficiency
1 35 1 1
2 17 2 1
3 12 2.9 0.97
4 10 3.5 0.88
5 8 3.6 0.87
6 6 4.36 0.97
7 6 5.83 0.83
8 6 5.83 0.73
9 6 5.83 0.65
10 6 5.83 0.58
11 6 5.83 0.53
12 6 5.83 0.49
The corresponding graphs are shown below:
From the above graph we can see that as the
number of threads increases, time taken decreases.
Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com
ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129
www.ijera.com 127 | P a g e
From the above graph we can see that as the
number of threads increases, speedup also increases.
But after a certain point, speedup becomes constant.
V. MULTIPLE PRINTER PROBLEM
USING STM
In case of parallel programs using locks,
certain problems like priority inversion, convoying
and deadlocks occur. The synchronization problem
can also be solved using STM. If STM is used in a
program then we do not have to use locks in the
program. Thus the problems which occur due to the
presence of locks in a program do not occur in this
type of code. The critical section of the program has
to be enclosed within a transaction. Then STM by its
internal constructs ensures synchronization in the
program.
The following code snippet shows the
printer thread :
void *print_time(int* num_ptr)
{
unsigned long j;
unsigned char byte_under_stm;
int num,*number_ptr;
number_ptr=num_ptr;
num=*number_ptr;
stm_init_thread( );
for((j=(((num*n)/NUM_THREAD)));j<(((num+1)*n)
/NUM_THREAD);j++)
{
if(arr[j]>100)
{
START(0,RW);
byte_under_stm=(unsigned
char)LOAD(&arr[j]);
printf("%u",byte_under_stm);
STORE(&arr[j], byte_under_stm);
COMMIT;
}
}
stm_exit_thread( );
pthread_exit(0);
}
The program structure is same as that of the
program for multiple printer problem using threads
and locks. The only difference is that STM is being
used in this program.
stm_init is used to initialize the TinySTM library at
the outset. It is called from the main thread before
accessing any other functions of the TinySTM
library.
stm_init_thread is used to initialize each thread that
will perform transactions. It is called once from each
thread that performs transactional operations before
the thread calls any other functions of the TinySTM
library. In this program it is called from the thread
print_time.
stm_exit is the corresponding shutdown function for
stm_init. It cleans up the TinySTM library. It is called
once from the main thread after all transactional
threads have completed execution.
stm_exit_thread is the corresponding shutdown
function for stm_init_thread. It cleans up the
transactional thread. It is called once from each
thread that performs transactional operations upon
exit. In this program it cleans up the thread
print_time.
START(0,RW) is used to start a transaction. In this
program it is used in the thread print_time.
COMMIT is used to close the transaction. In this
program it is used in the thread print_time.
byte_under_stm=(unsigned char)LOAD(&arr[j]);
stores the value of arr[j] in byte_under_stm. In this
program it is used in the thread print_time.
STORE(&arr[j], byte_under_stm) stores the value
of byte_under_stm in arr[j]. In this program it is used
in the thread print_time.
In this program the region where more than
one thread may access the global array arr[] at the
same time is the critical section. Thus this region is
enclosed within transactions using TinySTM which is
a type of STM. Hence there is no synchronization
problem in the code.
Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com
ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129
www.ijera.com 128 | P a g e
VI. EXPERIMENTAL RESULTS FOR
MULTIPLE PRINTER PROBLEM
USING STM
NO. of
Threads
Time
taken speedup Efficiency
1 35 1 1
2 17 2 1
3 12 2.9 0.97
4 10 3.5 0.88
5 8 3.6 0.87
6 6 4.36 0.97
7 6 5.83 0.83
8 6 5.83 0.73
9 6 5.83 0.65
10 6 5.83 0.58
11 6 5.83 0.53
12 6 5.83 0.49
The corresponding graphs are shown below:
From the above graph we can see that as the
number of threads increases, time taken decreases.
From the above graph we can see that as the
number of threads increases, speedup also increases.
But after a certain point, speedup becomes constant.
VII. PERFORMANCE COMPARISON
OF LOCKS AND STM
From the above experimental results, we can
see that the performances of locks and STM are
similar. We had enclosed only the critical sections of
the codes within locks and STM. When we enclosed
the entire code with STM, then the performance did
not decrease. But in case of locks, when we enclosed
the whole code within locks, performance drastically
decreased. Hence we can say that performance of
STM is better than that of locks.
VIII. CONCLUSION
STM has been shown in many ways to be a
good alternative to using locks for writing parallel
programs. STM provides a timetested model for
isolating concurrent computations from each other.
This model raises the level of abstraction for
reasoning about concurrent tasks and helps avoid
many parallel programming errors.
This paper has discussed how STM can be
used to solve the problem of synchronization in
parallel programs. STM has ensured that lock-free
parallel programs can be written. This ensures that
the problems which occur due to the presence of
locks in a program do not occur in this type of code.
This paper has also shown why STM is easier to use
than locks and has also shown that the performance
of STM is better than that of locks.
Many aspects of the semantics and
implementation of STM are still the subject of active
research. While it may still take some time to
overcome the various drawbacks, the necessity for
better parallel programming solutions will drive the
eventual adoption of STM. Once the adoption of
STM begins it will have the potential to pick up
momentum and make a very large impact on software
development in the long run. In the near future STM
will become a central pillar of parallel programming.
REFERENCES
[1] Simon Peyton Jones, “Beautiful
concurrency”.
[2] Elan Dubrofsky, “A Survey Paper on
Transactional Memory”.
[3] Pascal Felber, Christof Fetzer, Torvald
Riegel, “Dynamic Performance Tuning of
Word-Based Software Transactional
Memory”.
[4] http://en.wikipedia.org/wiki/Transactional_
memory
[5] James Larus and Christos Kozyrakis.
“Transactional Memory”
[6] Pascal Felber, Christof Fetzer, Patrick
Marlier, Torvald Riegel, “Time-Based
Software Transactional Memory”
[7] Tim Harris, James Larus, Ravi Rajwar,
“Transactional Memory”
[8] Mathias Payer, Thomas R. Gross,
“Performance Evaluation of Adaptivity in
Software Transactional Memory”
[9] Kevin E. Moore, Jayaram Bobba, Michelle
J. Moravan, Mark D. Hill, David A. Wood.,
“LogTM: Log-based Transactional
Memory”
[10] Dave Dice , Ori Shalev , Nir Shavit.,
“Transactional Locking II”
[11] http://tmware.org
Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com
ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129
www.ijera.com 129 | P a g e
[12] Maurice Herlihy, J. Eliot B. Moss,
“Transactional Memory: Architectural
Support for Lock-Free Data Structures”.
[13] Martin Schindewolf, Albert Cohen,
Wolfgang Karl, Andrea Marongiu, Luca
Benini, “Towards Transactional Memory
Support for GCC”.
[14] Virendra J. Marathe, Michael F. Spear,
Christopher Heriot, Athul Acharya, David
Eisenstat, William N. Scherer III, Michael L.
Scott, “Lowering the Overhead of
Nonblocking Software Transactional
Memory”.
[15] Utku Aydonat, Tarek S. Abdelrahman,
Edward S. Rogers Sr., “Serializability of
Transactions in Software Transactional
Memory”.
[16] Maurice Herlihy, Nir Shavit, “The Art of
Multiprocessor Programming”.
[17] Brendan Linn, Chanseok Oh, “G22.2631
project report: software transactional
memory”.
[18] http://en.wikipedia.org/wiki/Software_transa
ctional_memory
[19] http://research.microsoft.com/~simonpj/pape
rs/stm/
[20] http://www.haskell.org/haskellwiki/Software
_transactional_memory.
[21] Ryan Sapatarshi Ray,”Writing Lock Free
Code Using Software Transactional
Memory”

More Related Content

Viewers also liked

FEDSPUG - SharePoint 2013 - A Brief Capability Overview
FEDSPUG - SharePoint 2013 - A Brief Capability OverviewFEDSPUG - SharePoint 2013 - A Brief Capability Overview
FEDSPUG - SharePoint 2013 - A Brief Capability OverviewScott Hoag
 
Growth and Characterization of Barium doped Potassium Hydrogen Phthalate Sing...
Growth and Characterization of Barium doped Potassium Hydrogen Phthalate Sing...Growth and Characterization of Barium doped Potassium Hydrogen Phthalate Sing...
Growth and Characterization of Barium doped Potassium Hydrogen Phthalate Sing...IJERA Editor
 
Investigation on Growth and Optical Properties of LVCC Single Crystals
Investigation on Growth and Optical Properties of LVCC Single CrystalsInvestigation on Growth and Optical Properties of LVCC Single Crystals
Investigation on Growth and Optical Properties of LVCC Single CrystalsIJERA Editor
 
The Performance Evaluation of Concrete Filled Steel Tubular Arch Bridge
The Performance Evaluation of Concrete Filled Steel Tubular Arch BridgeThe Performance Evaluation of Concrete Filled Steel Tubular Arch Bridge
The Performance Evaluation of Concrete Filled Steel Tubular Arch BridgeIJERA Editor
 
Extract the ancient letters from decorated
Extract the ancient letters from decoratedExtract the ancient letters from decorated
Extract the ancient letters from decoratedIJERA Editor
 
Assessment of the waste water quality parameter of the Chitrakoot Dham, Karwi
Assessment of the waste water quality parameter of the Chitrakoot Dham, KarwiAssessment of the waste water quality parameter of the Chitrakoot Dham, Karwi
Assessment of the waste water quality parameter of the Chitrakoot Dham, KarwiIJERA Editor
 
Development of Abrasive Selection Model/Chart for Palm Frond Broom Peeling Ma...
Development of Abrasive Selection Model/Chart for Palm Frond Broom Peeling Ma...Development of Abrasive Selection Model/Chart for Palm Frond Broom Peeling Ma...
Development of Abrasive Selection Model/Chart for Palm Frond Broom Peeling Ma...IJERA Editor
 
Modeling the transport of charge carriers in the active devices diode submicr...
Modeling the transport of charge carriers in the active devices diode submicr...Modeling the transport of charge carriers in the active devices diode submicr...
Modeling the transport of charge carriers in the active devices diode submicr...IJERA Editor
 
Analysis on different Data mining Techniques and algorithms used in IOT
Analysis on different Data mining Techniques and algorithms used in IOTAnalysis on different Data mining Techniques and algorithms used in IOT
Analysis on different Data mining Techniques and algorithms used in IOTIJERA Editor
 
Maintenance cost reduction of a hydraulic excavator through oil analysis
Maintenance cost reduction of a hydraulic excavator through oil analysisMaintenance cost reduction of a hydraulic excavator through oil analysis
Maintenance cost reduction of a hydraulic excavator through oil analysisIJERA Editor
 
3D printing device for numerical control machine and wood deposition
3D printing device for numerical control machine and wood deposition3D printing device for numerical control machine and wood deposition
3D printing device for numerical control machine and wood depositionIJERA Editor
 
A Mathematical Model for the Genetic Variation of Prolactin and Prolactin Rec...
A Mathematical Model for the Genetic Variation of Prolactin and Prolactin Rec...A Mathematical Model for the Genetic Variation of Prolactin and Prolactin Rec...
A Mathematical Model for the Genetic Variation of Prolactin and Prolactin Rec...IJERA Editor
 
Investigation on Divergent Exit Curvature Effect on Nozzle Pressure Ratio of ...
Investigation on Divergent Exit Curvature Effect on Nozzle Pressure Ratio of ...Investigation on Divergent Exit Curvature Effect on Nozzle Pressure Ratio of ...
Investigation on Divergent Exit Curvature Effect on Nozzle Pressure Ratio of ...IJERA Editor
 

Viewers also liked (20)

FEDSPUG - SharePoint 2013 - A Brief Capability Overview
FEDSPUG - SharePoint 2013 - A Brief Capability OverviewFEDSPUG - SharePoint 2013 - A Brief Capability Overview
FEDSPUG - SharePoint 2013 - A Brief Capability Overview
 
Growth and Characterization of Barium doped Potassium Hydrogen Phthalate Sing...
Growth and Characterization of Barium doped Potassium Hydrogen Phthalate Sing...Growth and Characterization of Barium doped Potassium Hydrogen Phthalate Sing...
Growth and Characterization of Barium doped Potassium Hydrogen Phthalate Sing...
 
P04497113
P04497113P04497113
P04497113
 
Q0440596102
Q0440596102Q0440596102
Q0440596102
 
Ay044316318
Ay044316318Ay044316318
Ay044316318
 
Investigation on Growth and Optical Properties of LVCC Single Crystals
Investigation on Growth and Optical Properties of LVCC Single CrystalsInvestigation on Growth and Optical Properties of LVCC Single Crystals
Investigation on Growth and Optical Properties of LVCC Single Crystals
 
The Performance Evaluation of Concrete Filled Steel Tubular Arch Bridge
The Performance Evaluation of Concrete Filled Steel Tubular Arch BridgeThe Performance Evaluation of Concrete Filled Steel Tubular Arch Bridge
The Performance Evaluation of Concrete Filled Steel Tubular Arch Bridge
 
Extract the ancient letters from decorated
Extract the ancient letters from decoratedExtract the ancient letters from decorated
Extract the ancient letters from decorated
 
Q045058791
Q045058791Q045058791
Q045058791
 
M045077578
M045077578M045077578
M045077578
 
Assessment of the waste water quality parameter of the Chitrakoot Dham, Karwi
Assessment of the waste water quality parameter of the Chitrakoot Dham, KarwiAssessment of the waste water quality parameter of the Chitrakoot Dham, Karwi
Assessment of the waste water quality parameter of the Chitrakoot Dham, Karwi
 
Development of Abrasive Selection Model/Chart for Palm Frond Broom Peeling Ma...
Development of Abrasive Selection Model/Chart for Palm Frond Broom Peeling Ma...Development of Abrasive Selection Model/Chart for Palm Frond Broom Peeling Ma...
Development of Abrasive Selection Model/Chart for Palm Frond Broom Peeling Ma...
 
Modeling the transport of charge carriers in the active devices diode submicr...
Modeling the transport of charge carriers in the active devices diode submicr...Modeling the transport of charge carriers in the active devices diode submicr...
Modeling the transport of charge carriers in the active devices diode submicr...
 
Analysis on different Data mining Techniques and algorithms used in IOT
Analysis on different Data mining Techniques and algorithms used in IOTAnalysis on different Data mining Techniques and algorithms used in IOT
Analysis on different Data mining Techniques and algorithms used in IOT
 
Maintenance cost reduction of a hydraulic excavator through oil analysis
Maintenance cost reduction of a hydraulic excavator through oil analysisMaintenance cost reduction of a hydraulic excavator through oil analysis
Maintenance cost reduction of a hydraulic excavator through oil analysis
 
3D printing device for numerical control machine and wood deposition
3D printing device for numerical control machine and wood deposition3D printing device for numerical control machine and wood deposition
3D printing device for numerical control machine and wood deposition
 
A044080105
A044080105A044080105
A044080105
 
Bc044335338
Bc044335338Bc044335338
Bc044335338
 
A Mathematical Model for the Genetic Variation of Prolactin and Prolactin Rec...
A Mathematical Model for the Genetic Variation of Prolactin and Prolactin Rec...A Mathematical Model for the Genetic Variation of Prolactin and Prolactin Rec...
A Mathematical Model for the Genetic Variation of Prolactin and Prolactin Rec...
 
Investigation on Divergent Exit Curvature Effect on Nozzle Pressure Ratio of ...
Investigation on Divergent Exit Curvature Effect on Nozzle Pressure Ratio of ...Investigation on Divergent Exit Curvature Effect on Nozzle Pressure Ratio of ...
Investigation on Divergent Exit Curvature Effect on Nozzle Pressure Ratio of ...
 

Similar to S044125129

Secure Text Transfer Using Diffie-Hellman Key Exchange Based On Cloud
Secure Text Transfer Using Diffie-Hellman Key Exchange Based On CloudSecure Text Transfer Using Diffie-Hellman Key Exchange Based On Cloud
Secure Text Transfer Using Diffie-Hellman Key Exchange Based On CloudIRJET Journal
 
Cloud Module 3 .pptx
Cloud Module 3 .pptxCloud Module 3 .pptx
Cloud Module 3 .pptxssuser41d319
 
Java Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data StructuresJava Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data StructuresHitendra Kumar
 
Parallelization of Graceful Labeling Using Open MP
Parallelization of Graceful Labeling Using Open MPParallelization of Graceful Labeling Using Open MP
Parallelization of Graceful Labeling Using Open MPIJSRED
 
Migration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsMigration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsZvi Avraham
 
Letselectronic.blogspot.com robotic arm based on atmega mcu controlled by win...
Letselectronic.blogspot.com robotic arm based on atmega mcu controlled by win...Letselectronic.blogspot.com robotic arm based on atmega mcu controlled by win...
Letselectronic.blogspot.com robotic arm based on atmega mcu controlled by win...Aymen Lachkhem
 
Performance Analysis of Parallel Algorithms on Multi-core System using OpenMP
Performance Analysis of Parallel Algorithms on Multi-core System using OpenMP Performance Analysis of Parallel Algorithms on Multi-core System using OpenMP
Performance Analysis of Parallel Algorithms on Multi-core System using OpenMP IJCSEIT Journal
 
How to make fewer errors at the stage of code writing. Part N1.
How to make fewer errors at the stage of code writing. Part N1.How to make fewer errors at the stage of code writing. Part N1.
How to make fewer errors at the stage of code writing. Part N1.PVS-Studio
 
How to make fewer errors at the stage of code writing. Part N1
How to make fewer errors at the stage of code writing. Part N1How to make fewer errors at the stage of code writing. Part N1
How to make fewer errors at the stage of code writing. Part N1Andrey Karpov
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in javaRaghu nath
 
Lesson 26. Optimization of 64-bit programs
Lesson 26. Optimization of 64-bit programsLesson 26. Optimization of 64-bit programs
Lesson 26. Optimization of 64-bit programsPVS-Studio
 
Turing Lecture - The Computer Science of Concurrency - The Early Years : Notes
Turing Lecture - The Computer Science of Concurrency - The Early Years : NotesTuring Lecture - The Computer Science of Concurrency - The Early Years : Notes
Turing Lecture - The Computer Science of Concurrency - The Early Years : NotesSubhajit Sahu
 
An eternal question of timing
An eternal question of timingAn eternal question of timing
An eternal question of timingPVS-Studio
 
Eventdriven I/O - A hands on introduction
Eventdriven I/O - A hands on introductionEventdriven I/O - A hands on introduction
Eventdriven I/O - A hands on introductionMarc Seeger
 
IRJET - Automation in Python using Speech Recognition
IRJET -  	  Automation in Python using Speech RecognitionIRJET -  	  Automation in Python using Speech Recognition
IRJET - Automation in Python using Speech RecognitionIRJET Journal
 
DYNAMIC TASK PARTITIONING MODEL IN PARALLEL COMPUTING
DYNAMIC TASK PARTITIONING MODEL IN PARALLEL COMPUTINGDYNAMIC TASK PARTITIONING MODEL IN PARALLEL COMPUTING
DYNAMIC TASK PARTITIONING MODEL IN PARALLEL COMPUTINGcscpconf
 

Similar to S044125129 (20)

Concurrency and parallel in .net
Concurrency and parallel in .netConcurrency and parallel in .net
Concurrency and parallel in .net
 
Secure Text Transfer Using Diffie-Hellman Key Exchange Based On Cloud
Secure Text Transfer Using Diffie-Hellman Key Exchange Based On CloudSecure Text Transfer Using Diffie-Hellman Key Exchange Based On Cloud
Secure Text Transfer Using Diffie-Hellman Key Exchange Based On Cloud
 
Cloud Module 3 .pptx
Cloud Module 3 .pptxCloud Module 3 .pptx
Cloud Module 3 .pptx
 
Multithreading by rj
Multithreading by rjMultithreading by rj
Multithreading by rj
 
Java Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data StructuresJava Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data Structures
 
Analyzing algorithms
Analyzing algorithmsAnalyzing algorithms
Analyzing algorithms
 
Parallelization of Graceful Labeling Using Open MP
Parallelization of Graceful Labeling Using Open MPParallelization of Graceful Labeling Using Open MP
Parallelization of Graceful Labeling Using Open MP
 
Migration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsMigration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming Models
 
Letselectronic.blogspot.com robotic arm based on atmega mcu controlled by win...
Letselectronic.blogspot.com robotic arm based on atmega mcu controlled by win...Letselectronic.blogspot.com robotic arm based on atmega mcu controlled by win...
Letselectronic.blogspot.com robotic arm based on atmega mcu controlled by win...
 
Performance Analysis of Parallel Algorithms on Multi-core System using OpenMP
Performance Analysis of Parallel Algorithms on Multi-core System using OpenMP Performance Analysis of Parallel Algorithms on Multi-core System using OpenMP
Performance Analysis of Parallel Algorithms on Multi-core System using OpenMP
 
How to make fewer errors at the stage of code writing. Part N1.
How to make fewer errors at the stage of code writing. Part N1.How to make fewer errors at the stage of code writing. Part N1.
How to make fewer errors at the stage of code writing. Part N1.
 
How to make fewer errors at the stage of code writing. Part N1
How to make fewer errors at the stage of code writing. Part N1How to make fewer errors at the stage of code writing. Part N1
How to make fewer errors at the stage of code writing. Part N1
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Lesson 26. Optimization of 64-bit programs
Lesson 26. Optimization of 64-bit programsLesson 26. Optimization of 64-bit programs
Lesson 26. Optimization of 64-bit programs
 
Turing Lecture - The Computer Science of Concurrency - The Early Years : Notes
Turing Lecture - The Computer Science of Concurrency - The Early Years : NotesTuring Lecture - The Computer Science of Concurrency - The Early Years : Notes
Turing Lecture - The Computer Science of Concurrency - The Early Years : Notes
 
Chap7 slides
Chap7 slidesChap7 slides
Chap7 slides
 
An eternal question of timing
An eternal question of timingAn eternal question of timing
An eternal question of timing
 
Eventdriven I/O - A hands on introduction
Eventdriven I/O - A hands on introductionEventdriven I/O - A hands on introduction
Eventdriven I/O - A hands on introduction
 
IRJET - Automation in Python using Speech Recognition
IRJET -  	  Automation in Python using Speech RecognitionIRJET -  	  Automation in Python using Speech Recognition
IRJET - Automation in Python using Speech Recognition
 
DYNAMIC TASK PARTITIONING MODEL IN PARALLEL COMPUTING
DYNAMIC TASK PARTITIONING MODEL IN PARALLEL COMPUTINGDYNAMIC TASK PARTITIONING MODEL IN PARALLEL COMPUTING
DYNAMIC TASK PARTITIONING MODEL IN PARALLEL COMPUTING
 

Recently uploaded

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

S044125129

  • 1. Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129 www.ijera.com 125 | P a g e Multiple Printer Problem with STM Sayantan Sen, Ryan Saptarshi Ray, Hridam Basu, Utpal Kumar Ray, Parama Bhaumik B. E (IT) 3rd Year Student Department of Information Technology, Jadavpur University Kolkata, India Junior Research Fellow Department of Information Technology, Jadavpur University Kolkata, India B. E (IT) 3rd Year Student Department of Information Technology, Jadavpur University Kolkata, India Associate Professor Department of Information Technology, Jadavpur University Kolkata, India Assistant Professor Department of Information Technology, Jadavpur University Kolkata, India Abstract The past few years have marked the start of a historic transition from sequential to parallel computation. The necessity to write parallel programs is increasing as systems are getting more complex while processor speed increases are slowing down. Current parallel programming uses low-level programming constructs like threads and explicit synchronization using locks to coordinate thread execution. Parallel programs written with these constructs are difficult to design, program and debug. Also locks have many drawbacks which make them a suboptimal solution. Software Transactional Memory (STM) is a promising new approach to programming shared-memory parallel processors. It is a concurrency control mechanism that is widely considered to be easier to use by programmers than locking. It allows portions of a program to execute in isolation, without regard to other, concurrently executing tasks. A programmer can reason about the correctness of code within a transaction and need not worry about complex interactions with other, concurrently executing parts of the program This paper shows the concept of writing code using Software Transactional Memory (STM) and the performance comparison of codes using locks with those using STM. It also shows that STM is easier to use than locks. This is because critical sections need not to be identified in case of STM. If we enclose the entire code with STM, then the performance does not decrease. But in case of lock, if we enclose the whole code within lock, performance drastically decreases. Keywords- Parallel Programming; Multiprocessing; Locks; Transactions; Software Transactional Memory I. INTRODUCTION Generally one has the idea that a program will run faster if one buys a next-generation processor. But currently that is not the case. While the next-generation chip will have more CPUs, each individual CPU will be no faster than the previous year’s model. If one wants programs to run faster, one must learn to write parallel programs as currently multi-core processors are becoming more and more popular. The past few years have marked the start of a historic transition from sequential to parallel computation. The necessity to write parallel programs is increasing as systems are getting more complex while processor speed increases are slowing down. Parallel Programming means using multiple computing resources like processors for programming so that the time required to perform computations is reduced [1]. II. MULTIPLE PRINTER PROBLEM There is a fixed amount of work. Initially, only one printer is used to perform this work. Now if the same work is performed using multiple printers, then time taken should proportionately decrease. But in case of multiple printers, as more than one printer may try to perform the same work at the same time, synchronization problems may occur. This paper shows how these synchronization problems can be overcome. III. MULTIPLE PRINTER PROBLEM USING LOCKS The hardest problem that should be overcome when writing parallel programs is that of synchronization. Multiple threads may need to access the same locations in memory and if careful measures are not taken the result can be disastrous. If two threads try to modify the same variable at the same time, the data can become corrupt. Currently locks are used to solve this problem. Locks ensure that a critical section, which is a block of code that contains variables that may be accessed by multiple threads, can only be accessed by one thread at a time. When a thread tries to enter a critical section, it must first acquire that section's lock. If another thread is already holding the lock, the former thread must wait until the RESEARCH ARTICLE OPEN ACCESS
  • 2. Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129 www.ijera.com 126 | P a g e lock-holding thread releases the lock, which it does when it leaves the critical section [2]. In the multiple printer problem,the printer thread is “print_time()”. The work which is being performed by the printer threads is showing the number the number of elements greater than 100 in the array “ arr[] ” .The following code snippet shows the printer thread : void *print_time(int * num_ptr) { unsigned long j,a; int num,*number_ptr; number_ptr=num_ptr; num=*number_ptr; local_min_array[num]=255; for((j=(((num*n)/NUM_THREAD)));j<(((num+1)*n) /NUM_THREAD);j++) { if(arr[j]>100) { pthread_mutex_lock(&mutex1); printf("%u",arr[j]); pthread_mutex_unlock(&mutex1); } } } The following code snippet shows how in the printer thread the elements greater than 100 in the array are being displayed: if(arr[j]>100) { pthread_mutex_lock(&mutex1); printf("%u",arr[j]); pthread_mutex_unlock(&mutex1); } In case of multiple threads, the same printer thread is being called multiple times. Three lock calls have been used in the code. These are shown below: pthread_mutex_init(&mutex1,NULL) is used for lock initialization. pthread_mutex_lock(&mutex1) is used for locking. This means that any thread which tries to access the critical section has to first acquire the lock on mutex1. pthread_mutex_unlock(&mutex1) is used for unlocking. In this program the region where more than one thread may access the global array arr[] at the same time is the critical section. Thus this region is enclosed within locks. Hence there is no synchronization problem in the code. IV. EXPERIMENTAL RESULTS FOR MULTIPLE PRINTER PROBLEM USING LOCKS No. of Threads Time taken Speedup Efficiency 1 35 1 1 2 17 2 1 3 12 2.9 0.97 4 10 3.5 0.88 5 8 3.6 0.87 6 6 4.36 0.97 7 6 5.83 0.83 8 6 5.83 0.73 9 6 5.83 0.65 10 6 5.83 0.58 11 6 5.83 0.53 12 6 5.83 0.49 The corresponding graphs are shown below: From the above graph we can see that as the number of threads increases, time taken decreases.
  • 3. Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129 www.ijera.com 127 | P a g e From the above graph we can see that as the number of threads increases, speedup also increases. But after a certain point, speedup becomes constant. V. MULTIPLE PRINTER PROBLEM USING STM In case of parallel programs using locks, certain problems like priority inversion, convoying and deadlocks occur. The synchronization problem can also be solved using STM. If STM is used in a program then we do not have to use locks in the program. Thus the problems which occur due to the presence of locks in a program do not occur in this type of code. The critical section of the program has to be enclosed within a transaction. Then STM by its internal constructs ensures synchronization in the program. The following code snippet shows the printer thread : void *print_time(int* num_ptr) { unsigned long j; unsigned char byte_under_stm; int num,*number_ptr; number_ptr=num_ptr; num=*number_ptr; stm_init_thread( ); for((j=(((num*n)/NUM_THREAD)));j<(((num+1)*n) /NUM_THREAD);j++) { if(arr[j]>100) { START(0,RW); byte_under_stm=(unsigned char)LOAD(&arr[j]); printf("%u",byte_under_stm); STORE(&arr[j], byte_under_stm); COMMIT; } } stm_exit_thread( ); pthread_exit(0); } The program structure is same as that of the program for multiple printer problem using threads and locks. The only difference is that STM is being used in this program. stm_init is used to initialize the TinySTM library at the outset. It is called from the main thread before accessing any other functions of the TinySTM library. stm_init_thread is used to initialize each thread that will perform transactions. It is called once from each thread that performs transactional operations before the thread calls any other functions of the TinySTM library. In this program it is called from the thread print_time. stm_exit is the corresponding shutdown function for stm_init. It cleans up the TinySTM library. It is called once from the main thread after all transactional threads have completed execution. stm_exit_thread is the corresponding shutdown function for stm_init_thread. It cleans up the transactional thread. It is called once from each thread that performs transactional operations upon exit. In this program it cleans up the thread print_time. START(0,RW) is used to start a transaction. In this program it is used in the thread print_time. COMMIT is used to close the transaction. In this program it is used in the thread print_time. byte_under_stm=(unsigned char)LOAD(&arr[j]); stores the value of arr[j] in byte_under_stm. In this program it is used in the thread print_time. STORE(&arr[j], byte_under_stm) stores the value of byte_under_stm in arr[j]. In this program it is used in the thread print_time. In this program the region where more than one thread may access the global array arr[] at the same time is the critical section. Thus this region is enclosed within transactions using TinySTM which is a type of STM. Hence there is no synchronization problem in the code.
  • 4. Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129 www.ijera.com 128 | P a g e VI. EXPERIMENTAL RESULTS FOR MULTIPLE PRINTER PROBLEM USING STM NO. of Threads Time taken speedup Efficiency 1 35 1 1 2 17 2 1 3 12 2.9 0.97 4 10 3.5 0.88 5 8 3.6 0.87 6 6 4.36 0.97 7 6 5.83 0.83 8 6 5.83 0.73 9 6 5.83 0.65 10 6 5.83 0.58 11 6 5.83 0.53 12 6 5.83 0.49 The corresponding graphs are shown below: From the above graph we can see that as the number of threads increases, time taken decreases. From the above graph we can see that as the number of threads increases, speedup also increases. But after a certain point, speedup becomes constant. VII. PERFORMANCE COMPARISON OF LOCKS AND STM From the above experimental results, we can see that the performances of locks and STM are similar. We had enclosed only the critical sections of the codes within locks and STM. When we enclosed the entire code with STM, then the performance did not decrease. But in case of locks, when we enclosed the whole code within locks, performance drastically decreased. Hence we can say that performance of STM is better than that of locks. VIII. CONCLUSION STM has been shown in many ways to be a good alternative to using locks for writing parallel programs. STM provides a timetested model for isolating concurrent computations from each other. This model raises the level of abstraction for reasoning about concurrent tasks and helps avoid many parallel programming errors. This paper has discussed how STM can be used to solve the problem of synchronization in parallel programs. STM has ensured that lock-free parallel programs can be written. This ensures that the problems which occur due to the presence of locks in a program do not occur in this type of code. This paper has also shown why STM is easier to use than locks and has also shown that the performance of STM is better than that of locks. Many aspects of the semantics and implementation of STM are still the subject of active research. While it may still take some time to overcome the various drawbacks, the necessity for better parallel programming solutions will drive the eventual adoption of STM. Once the adoption of STM begins it will have the potential to pick up momentum and make a very large impact on software development in the long run. In the near future STM will become a central pillar of parallel programming. REFERENCES [1] Simon Peyton Jones, “Beautiful concurrency”. [2] Elan Dubrofsky, “A Survey Paper on Transactional Memory”. [3] Pascal Felber, Christof Fetzer, Torvald Riegel, “Dynamic Performance Tuning of Word-Based Software Transactional Memory”. [4] http://en.wikipedia.org/wiki/Transactional_ memory [5] James Larus and Christos Kozyrakis. “Transactional Memory” [6] Pascal Felber, Christof Fetzer, Patrick Marlier, Torvald Riegel, “Time-Based Software Transactional Memory” [7] Tim Harris, James Larus, Ravi Rajwar, “Transactional Memory” [8] Mathias Payer, Thomas R. Gross, “Performance Evaluation of Adaptivity in Software Transactional Memory” [9] Kevin E. Moore, Jayaram Bobba, Michelle J. Moravan, Mark D. Hill, David A. Wood., “LogTM: Log-based Transactional Memory” [10] Dave Dice , Ori Shalev , Nir Shavit., “Transactional Locking II” [11] http://tmware.org
  • 5. Sayantan Sen et al Int. Journal of Engineering Research and Applications www.ijera.com ISSN : 2248-9622, Vol. 4, Issue 4( Version 1), April 2014, pp.125-129 www.ijera.com 129 | P a g e [12] Maurice Herlihy, J. Eliot B. Moss, “Transactional Memory: Architectural Support for Lock-Free Data Structures”. [13] Martin Schindewolf, Albert Cohen, Wolfgang Karl, Andrea Marongiu, Luca Benini, “Towards Transactional Memory Support for GCC”. [14] Virendra J. Marathe, Michael F. Spear, Christopher Heriot, Athul Acharya, David Eisenstat, William N. Scherer III, Michael L. Scott, “Lowering the Overhead of Nonblocking Software Transactional Memory”. [15] Utku Aydonat, Tarek S. Abdelrahman, Edward S. Rogers Sr., “Serializability of Transactions in Software Transactional Memory”. [16] Maurice Herlihy, Nir Shavit, “The Art of Multiprocessor Programming”. [17] Brendan Linn, Chanseok Oh, “G22.2631 project report: software transactional memory”. [18] http://en.wikipedia.org/wiki/Software_transa ctional_memory [19] http://research.microsoft.com/~simonpj/pape rs/stm/ [20] http://www.haskell.org/haskellwiki/Software _transactional_memory. [21] Ryan Sapatarshi Ray,”Writing Lock Free Code Using Software Transactional Memory”