software transactional memory with autonomic …...transactional memory 2.software transactional...

28
Software Transactional Memory with Autonomic Management Techniques Naweiluo Zhou – Grenoble University/INRIA, France Gwenael Delaval –Grenoble University,France Eric Rutten –INRIA,France Jean-Francois Mehaut –Grenoble University/CEA,France [email protected] January 21st, 2015

Upload: others

Post on 14-Sep-2020

23 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

Software Transactional Memory withAutonomic Management Techniques

Naweiluo Zhou – Grenoble University/INRIA, FranceGwenael Delaval –Grenoble University,FranceEric Rutten –INRIA,FranceJean-Francois Mehaut –Grenoble University/CEA,France

[email protected]

January 21st, 2015

Page 2: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Overview

1 Introduction to Parallel Program

2 BackgroundTransactional MemoryAutonomic Management Techniques

3 Approaches on STM Management

4 Conclusion

5 Ongoing Work

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 2 / 28

Page 3: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Introduction to Parallel Program

1.Introduction to Parallel Program

Multi-core Processor

Multi-core processors are everywhere, moreparallelisms/concurrency levels give higher performance?

Many threads execute concurrently. Threads share data. Morethreads maybe more conflict!

Synchronization VS Computation

A high concurrency level may decline computing time, but increasesynchronization time. How to handle the trade-off betweensynchronization and computation?

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 3 / 28

Page 4: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Introduction to Parallel Program

1.Introduction to Parallel Program

Locks

A traditional way for synchronization. But:

Deadlocks, vulnerability to failures, faults...

Difficult to detect deadlocks

Hard to figure out the interaction among concurrentoperations

Transactional Memory

Lock-free, therefore no deadlocks! But really? Any problems? Whytransactional memory does not become the dominating memorysystem?

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 4 / 28

Page 5: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Transactional Memory

2.Transactional Memory

Concepts

Basic ideas are from database systems.

Shared variables are wrapped by transactions (atomic blocks)

concurrent accesses are performed inside transactions

Transactions are executed speculatively and can either commitor abort. no other intermediate status

conflict

rollback

abort

commitno conflict

a

Tx start

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 5 / 28

Page 6: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Transactional Memory

2.Transactional Memory

Three concepts

1 Commit: a transactionsucceeds—changes aremade

2 Abort: a transaction hasa conflict — changes arediscarded

3 Rollback: re-execute theaborted transactions

conflict

rollback

abort

commitno conflict

a

Tx start

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 6 / 28

Page 7: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Transactional Memory

2.Transactional MemoryExample

consider three threads read/write data to the objects of differentmemory locations. Access occur inside transactions

1 2 3 4 5 6 7 8 9 10 11 12

Atomic{...

}

Atomic{...

}

Atomic{...

}

OK OK OK

No conflict

thread1 thread2 thread3

r r w wr r

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 7 / 28

Page 8: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Transactional Memory

2.Transactional Memory

Example

consider three threads read/write data from/to the objects ofdifferent memory locations. Access occur inside transactions

1 2 3 4 5 6 7 8 9 10 11 12

Atomic{...

}

Atomic{...

}

Atomic{...

}

OK No OK

conflict

thread1 thread2 thread3

r rw

rrr w

1 2

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 8 / 28

Case1

thread1 reads object3thread2 reads object3

Case2

thread2 reads object7thread3 reads object7

Page 9: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Transactional Memory

2.Transactional Memory

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 9 / 28

When to dectect the conflict:Different TM systems have different choices...It is hard to tell which one is better...

Eager

detect every memory access

transaction2

transaction1

time lineconflict? conflict?

Lazy

detect at commit time

transaction2

transaction1

time lineconflict?

Page 10: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Transactional Memory

2.Transactional Memory

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 10 / 28

How to solve the conflict–contention managermainly are based on three policies: Aggressive, Suicide, Backoff.It is hard to tell which one is better...

Three policies:

Aggressive: I detect conflicts, Icommit my work, others abort

Suicide: I detect the conflict, Ikill my work, others continue

Backoff: I detect the conflict, Iwait then I continue

The policy is a parameter which can becontrolled later.

Backoff policy:

transaction2

transaction1

time lineconflict?

wait

Page 11: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Transactional Memory

2.Transactional Memory

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 11 / 28

Locks vs TM on synchronization cost

Locks

time wastes onacquiring locks everyaccess

time wastes on waitingfor acquiring locks

TM

time wastes on abortand then re-execute

time wastes onchecking conflicts (canbe low though)

Page 12: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Transactional Memory

2.Transactional Memory —Implementation of TM

Software Transactional Memory (STM)Implements all the transactional semantics in software (e.g.TinySTM, SwissTM...)

Hardware Transactional Memory (HTM)Implements all the transactional semantics in hardware

Hybrid Transactional Memory (HyTM)STM accelerated by hardware

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 12 / 28

Page 13: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Transactional Memory

2.Software Transactional Memory

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 13 / 28

Main STM issues:

Too many parameters need to managee.g.CM policy, concurrency level...

An application behaviour changes online, parameters setstatically

...

—Can we have everything adaptive and automatic?—Yes, building an autonomic control system!

Page 14: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Autonomic Management Techniques

2.Autonomic Management

A system is regarded as an autonomic control system if it has oneof the features:

Self-configuration: a new component learns the systemconfigurations

Self-optimization: seek to improve performance & effeciency

Self-healing: recover from failures

Self-protection: defend against attacks

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 14 / 28

Page 15: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Autonomic Management Techniques

2.Autonomic Management Techniques

Elements of a feedbackcontrol loop:

1 Managed element: anysoftware or hardwareresource

2 Autonomic manager— asoftware component:monitor, plan, knowledge

3 Sensor: collect information

4 Effector: carry out changes Figure : A feedback control loop

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 15 / 28

Page 16: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Autonomic Management Techniques

2.Autonomic Management Techniques

Components of theautonomic manager:

1 Monitor: sampling

2 Analyser:

3 Knowledge

4 Plan: use the knowledge ofthe system to docomputation

5 Execute: make changesFigure : A feedback control loop

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 16 / 28

Page 17: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Autonomic Management Techniques

2.Autonomic Management Techniques

Components of theautonomic manager:

1 Managed elements: TMapplications, STM systemkernel

2 Controllers: CM controller,concurrency level controller,coordinating controller

3 Sensor: statisticcollector–sampling

4 Effector: Parameters set inSTM

applications

sampling

STM kernel

STM CM controller

concurrency controller

swap CM adjust concurrency

statistics collector

control

coordination controller

Figure : Feedback control loops onSTM

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 17 / 28

Page 18: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Autonomic Management Techniques

Autonomic Management Techniques

We use a control approach to achieve autonomic management

Control techniques for supervising computing systems in thisproject

Feedback control loops

Using reactive synchronous language: design safe autonomicloops

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 18 / 28

Page 19: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Background

Autonomic Management Techniques

BibiliographyThe thesis extends the work of Xin AN [1], Macio Bastos Castro[2],Soguy Mak Kare Gueye [3]

1 An, Xin. ”High Level Design and Control of Adaptive MultiprocessorSystems-on-Chip.” PhD diss., Grenoble University, 2013.

2 Castro, Marcio Bastos. ”Improving the Performance ofTransactional Memory Applications on Multicores: A MachineLearning-Based Approach. ” PhD diss., Universit de Grenoble, 2012

3 Gueye, Soguy Mak Kare. Modular coordination of autonomicmanagers by discrete control. PhD diss., Universit de Grenoble,2014 (French)

Other related works:3. D. Rughetti, P. Di Sanzo, B. Ciciani, and F. Quaglia. Machine learning-based self-adjusting concurrency insoftware transactional memory systems. In Modeling, Analysis Simulation of Computer and TelecommunicationSystems (MASCOTS), 2012 IEEE 20th International Symposium on, pages 278285, Aug 2012.4. 4. M. Ansari, C. Kotselidis, K. Jarvis, M. Lujn, C. Kirkham, and I. Watson. Advanced concurrency control fortransactional memory using transaction commit rate. In Proceedings of the 14th International Euro-Par Conferenceon Parallel Processing, Euro-Par 08, pages 719728, Berlin, Heidelberg, 2008. Springer-Verlag.

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 19 / 28

Page 20: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Approaches on STM Management

Experimental Platform

Hardware

SMP machine (12 Intel core, 64G memory) & SMP machine (192Intel cores, 756G memory)

Software

STM: tinySTM...

Control: heptagon

Benchmark: Eigenbench, STAMP

Programming languages: C/C++, heptagon (reactivelanguage)

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 20 / 28

Page 21: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Approaches on STM Management

3.Approaches on STM Management

Questions we will answer:

Is the performance of TM applications affected by differentconfigurations and parameters? How much?

How can we deal with different TM applications?

Are there possible feedback control loops?

Problems we will solve

Optimize configurations at runtime

As little changes as possible to the TM applications

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 21 / 28

Page 22: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Approaches on STM Management

3.Approaches on STM ManagementA profile example

1st profiling

non-profiling period (�med by Tx) ...

profile concurrency level (�med by tx)

Program starts A profile period starts

con�nue profile?

max profile �mes reaches if profile?

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 22 / 28

Page 23: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Approaches on STM Management

3.Approaches on STM Management

A feedback control loop on concurrency level:

1 control objective: highthroughput–more commitsper sec..

2 sensor: commits, aborts.

3 effector: changeconcurrency level (inc. ordec., how many), profile ornot.

4 controller: analyse commitsand aborts, make decision.

5 managed element: STM &benchmarks.

1st profiling

non-profiling period (�med by Tx) ...

profile concurrency level (�med by tx)

Program starts A profile period starts

con�nue profile?

max profile �mes reaches if profile?

Figure : A profiling example

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 23 / 28

Page 24: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Approaches on STM Management

3.Approaches on STM Management

A feedback control loop on concurrency level:

STM TM apps

thread number

>min thread number&& commit ratio low

<max thread number&& commit ratio high

commitsaborts

increasethread number

decreasethread number

Figure : A simple feedbackcontrol loop on concurrency level

1st profiling

non-profiling period (�med by Tx) ...

profile concurrency level (�med by tx)

Program starts A profile period starts

con�nue profile?

max profile �mes reaches if profile?

Figure : A profiling example

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 24 / 28

Page 25: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Approaches on STM Management

3.Approaches on STM Management

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 25 / 28

STM:

Dynamic ContentionManagement

Dynamic ConcurrencyAdaptation

Dynamic Thread mappingpolicies

Control Method

Identify autonomic loops forSTM

Implement feedback controlloops with STM

Control coordinating of differentloops

Integration

Integration of STM and Control Approach

Page 26: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Conclusion

4.Conclusion

Parallel program needs to manage the trade-off betweencomputing time and synchronization time

Transactional memory emerges as a promising way to overcomethe shortcomings of traditional lock-based system

Using feedback control loops to better manage STM togetherwith its applications at runtime

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 26 / 28

Page 27: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Ongoing Work

5.Ongoing Work

Integrate feedback control loops into STM system

Integrate thread mapping polices together with concurrencylevel adjustment

More monitoring inputs

New contention manager Policies

New profiling strategies

...

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 27 / 28

Page 28: Software Transactional Memory with Autonomic …...Transactional Memory 2.Software Transactional Memory Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut Naweiluo.Zhou@inria.fr

STM with Autonomic Management Techniques

Ongoing Work

Questions?

Grenoble University/INRIA, France Zhou, Delaval, Rutten, Mehaut [email protected] 28 / 28