文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 外语学习 > 英语学习 > Speculative Lock Elision Enabling Highly Concurrent Multithreaded Execution
侵权投诉

Speculative Lock Elision Enabling Highly Concurrent Multithreaded Execution

Serialization of threads due to critical sections is a fundamental bottleneck to achieving high performance in multithreaded programs. Dynamically, such serialization may be unnecessary because these critical sections could have safely executed concurrentl

Appears in the proceedings of the 34th International Symposium on Microarchitecture (MICRO), Dec. 3-Dec. 5, 2001, Austin, Texas.

Speculative Lock Elision: Enabling Highly Concurrent Multithreaded Execution

Ravi Rajwar and James R. GoodmanComputer Sciences DepartmentUniversity of Wisconsin-Madison

Madison, WI 53706 USA{rajwar, goodman}@cs.wisc.edu

Abstract

Serializationofthreadsduetocriticalsectionsisafun-damentalbottlenecktoachievinghighperformanceinmul-tithreadedprograms.Dynamically,suchserializationmaybeunnecessarybecausethesecriticalsectionscouldhavesafelyexecutedconcurrentlywithoutlocks.Currentproces-sorscannotfullyexploitsuchparallelismbecausetheydonothavemechanismstodynamicallydetectsuchfalseinter-thread dependences.

WeproposeSpeculativeLockElision(SLE),anovelmicro-architecturaltechniquetoremovedynamicallyunnecessarylock-inducedserializationandenablehighlyconcurrentmultithreadedexecution.Thekeyinsightisthatlocksdonotalwayshavetobeacquiredforacorrectexe-cution.Synchronizationinstructionsarepredictedasbeingunnecessaryandelided.Thisallowsmultiplethreadstoconcurrentlyexecutecriticalsectionsprotectedbythesamelock.Misspeculationduetointer-threaddatacon- ictsisdetectedusingexistingcachemechanismsandroll-backisusedforrecovery.Successfulspeculativeelisionisvalidated and committed without acquiring the lock.

SLEcanbeimplementedentirelyinmicroarchitecturewithoutinstructionsetsupportandwithoutsystem-levelmodi cations,istransparenttoprogrammers,andrequiresonlytrivialadditionalhardwaresupport.SLEcanprovideprogrammersafastpathtowritingcorrecthigh-perfor-mance multithreaded programs.

1 Introduction

Explicithardwaresupportformultithreadedsoftware,eitherintheformofsharedmemorymultiprocessorsorhardwaremultithreadedarchitectures,isbecomingincreas-inglycommon[9,21,38,2].Assuchsupportbecomesavailable,applicationdevelopersareexpectedtoexploitthesedevelopmentsbyemployingmultithreadedprogram-ming.Whileserverworkloadshavetraditionallydisplayedabundantthread-levelparallelism,increasingevidenceindicatesdesktopapplicationsmayalsodisplaysuchparal-lelismifprogrammersfocuseffortsonexploitingtheseemerging architectures.

Inmultithreadedprograms,synchronizationmecha-nisms—usuallylocks—areoftenusedtoguaranteethreadshaveexclusiveaccesstoshareddataforacriticalsectionofcode.Athreadacquiresthelock,executesitscriticalsec-tion,andreleasesthelock.Allotherthreadswaitforthelockuntilthefirstthreadhascompleteditscriticalsection,serializingaccessandthusmakingtheentirecriticalsec-tion appear to execute atomically.

Foravarietyofreasons,concurrentaccessestoashareddatastructurebymultiplethreadswithinacriticalsectionmayinfactnotconflict,andsuchaccessesdonotrequireserialization.TwosuchexamplesareshowninFigure1.Figure1ashowsanexamplefromamultithreadedapplica-tionocean[40].Sinceastoreinstruction(line3)toasharedobjectispresent,thelockisrequired.However,mostdynamicexecutionsdonotperformthestoreopera-tionandthusdonotrequirethelock.Additionally,multiplethreadsmayupdatedifferentfieldsofasharedobject,whileholdingthesharedobjectlock,andoftentheseupdatesdonotconflict.Suchanexample,involvingupdatesofahashtable,isshowninFigure1b.Thisexam-pleissimilartoathread-safehash-tableimplementationfromSHORE, a database object repository [5].

Intheseexamples,conventionalspeculativeexecutioninout-of-orderprocessorscannottakeadvantageoftheparallelismpresentbecausethethreadswillfirstwaitforafreelockandthenacquirethelockinaserializedmanner.

a)

1.LOCK(locks->error_lock)

2.if (local_error > multi->err_multi)3.multi->err_multi = local_err;4.UNLOCK(locks->error_lock)b)

Thread 1

Thread 2

LOCK(hash_tbl.lock)

var = hash_tbl.lookup(X)if (!var)

hash_tbl.add(X);UNLOCK(hash_tbl.lock)

LOCK(hash_tbl.lock)

var = hash_tbl.lookup(Y)if (!var)

hash_tbl->add(Y);UNLOCK(hash_tbl.lock)

Figure1.Twoexamplesofpotentialparallelismmaskedbydynamically unnecessary synchronization.

第1页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email