《系统软件与软件安全》课程教学课件(PPT讲稿,英文)Lecture-6-locks-and-CC

锁(Locks):保证了并发控制(CC)的正确性但又限制了系统的扩展性(Scalability)怎么办?
锁 (Locks): 保证了并发控制 (CC) 的正确性 但又限制了系统的扩展性 (Scalability) 怎么办? 1

计算机系统本质是什么?,提供计算,通讯和数据处理的通用基础设施(包括硬件和软件)·不再只是操作系统和CPU芯片·也不是为特殊应用专制的硬件或开发的软件·除操作系统以外的主流系统有:·存系统·数据管理系统·虚拟机系统·互联网系统·有大规模应用软件系统,如微信,云系统中的资源分享和调度系统。。·计算机系统的开发和应用具有很严格的基础性·很多系统上创新都是来源于对系统基本结构的深刻认识·系统资源管理和社会分配体制有共性·思考和分析问题不应只限于技术层面·所有的算法和解决方案都可以在社会和日常生活中找到·系统研究的最终目的"Theproofofasystem'svalueisitsexistence."AlanPerlis
计算机系统本质是什么? • 提供计算,通讯 和数据处理的通用基础设施(包括硬件和软件) • 不再只是操作系统和CPU芯片 • 也不是为特殊应用专制的硬件或开发的软件 • 除操作系统以外的主流系统有: • 存贮系统 • 数据管理系统 • 虚拟机系统 • 互联网系统 • 有大规模应用软件系统,如微信,云系统中的资源分享和调度系统 。 • 计算机系统的开发和应用具有很严格的基础性 • 很多系统上创新都是来源于对系统基本结构的深刻认识 • 系统资源管理和社会分配体制有共性 • 思考和分析问题不应只限于技术层面 • 所有的算法和解决方案都可以在社会和日常生活中找到 • 系统研究的最终目的 • “The proof of a system’s value is its existence.” Alan Perlis

Throughput drops after reaching peak (MysQl)sysbench,PKlookupsKernal mutexinSQLisa150000synchronization lock.Thisisexperimentselectsprimarykeysin5millions1rows eachbyusingthelock.PeakTX=154,236(64pros)50000·AfterthenTXdrops14%·7timeslowerthanthepeak(1024processes)256128882645121024ThreadsPerconaDBPerformance
Throughput drops after reaching peak (MySQL) 3 Kernal_mutex in SQL is a synchronization lock. This is experiment selects primary keys in 5 millions rows each by using the lock. • Peak TX =154,236 (64 pros) • After then TX drops 14% • 7 times lower than the peak (1024 processes) PerconaDB Performance

Latencyincreases as #threads increaseto contend locksSeirtcolFree(MPMC)600065004threadsusing5000spinlock running on4500IntelXeonL5640fora4000write-readworkload(dasp)aae3500comparedwiththe3000sameworkloadinlock2500freestyle200015001000ACMQueue,June20135000.20.30.60.70.10.40.50.80.9Quantile
Latency increases as # threads increase to contend locks 4 4 threads using spinlock running on Intel Xeon L5640 for a write-read workload compared with the same workload in lockfree style ACM Queue, June 2013

System Performance: High Throughput and Low LatencyOptimal PointLatency (locality)Throughput(parallelism)NumberofConcurrentProcesses
Number of Concurrent Processes Optimal Point Throughput (parallelism) Latency (locality) System Performance: High Throughput and Low Latency

Two Major Issues of Lock Usage.Waysof acquiringlocks:Minimizing network bandwidth:Minimizing overhead of waiting for locks:Maintaining a constant # of remote memory accesses per lockacquisition.Locksinconcurrencycontrol·Minimizing oreliminating unnecessary usage of locks·Minimizing execution and access latency inside critical section· Minimizing the size of the data structure to be locked·Maximizing scalability subject to serialized execution
Two Major Issues of Lock Usage • Ways of acquiring locks • Minimizing network bandwidth • Minimizing overhead of waiting for locks • Maintaining a constant # of remote memory accesses per lock acquisition • Locks in concurrency control • Minimizing or eliminating unnecessary usage of locks • Minimizing execution and access latency inside critical section • Minimizing the size of the data structure to be locked • Maximizing scalability subject to serialized execution 6

Distributed locks in production systemsFor each lock acquisition ina distributed system1. Entering the queue waiting for the lock (a remote access)2. Local spin to wait without consuming network bandwidth3. The process is informed for its turn (a remote access)4. Acquiring the lock entering the critical section (a remoteaccess).Constant number of remote accesses perlock acguisition:Network contention is minimized
Distributed locks in production systems For each lock acquisition in a distributed system 1. Entering the queue waiting for the lock (a remote access) 2. Local spin to wait without consuming network bandwidth 3. The process is informed for its turn (a remote access) 4. Acquiring the lock entering the critical section (a remote access) • Constant number of remote accesses per lock acquisition • Network contention is minimized 7

Two Phase Locking (2PL)·DBMsmustlockatuplebeforeatransactionreadsorwritesto it: Two types of locks: shared lock (read) & exclusive lock (write):Phase1:growingphase.Transaction can obtainlocksbut cannotreleaselocks.Phase2:Shrinkingphase.Transactioncanreleaselocksbutcannotobtainlocks.Variants of 2PL (based on how to avoid deadlocks):2PL-deadlockdetecfion:Abortsatransactionwhendeadlockhappens2PL-waitanddie.Oldtransactioncanwaityoungtransaction,notviceversa.2PL-woundwait:Immediatelyaborts atransactionifitslockingreguestis denied
Two Phase Locking (2PL) • DBMS must lock a tuple before a transaction reads or writes to it • Two types of locks: shared lock (read) & exclusive lock (write) • Phase 1: growing phase • Transaction can obtain locks but cannot release locks • Phase 2: Shrinking phase • Transaction can release locks but cannot obtain locks • Variants of 2PL (based on how to avoid deadlocks) • 2PL - deadlock detection • Aborts a transaction when deadlock happens • 2PL - wait and die • Old transaction can wait young transaction, not vice versa • 2PL – wound wait • Immediately aborts a transaction if its locking request is denied 8

Concurrency Control (CC).CC ensurescorrectresultsforconcurrentoperations·AbasiccomponentinOs,Ds,multiprocessors,databases,PL:Ensures serializability of data accesses to the shared data sets.Get results fast for high throughput and scalability·Optimistic Concurrency Control (OCC, Kung and Johnson,1981) has been used in several production systems: E.g., Microsoft Hekaton, Google App Engine, CoucDB, Silo,
Concurrency Control (CC) • CC ensures correct results for concurrent operations • A basic component in OS, DS, multiprocessors, databases, PL, . • Ensures serializability of data accesses to the shared data sets • Get results fast for high throughput and scalability • Optimistic Concurrency Control (OCC, Kung and Johnson, 1981) has been used in several production systems • E.g., Microsoft Hekaton, Google App Engine, CoucDB, Silo, . 9

Occ: How It Works.OCC executes g transaction in three phases:.Phase1:concurrentlocalprocessing:Reads tuples into aread set.Buffers writes into a write set.Phase 2:Validation in critical section.Validates whether serializability is guaranteed:Has any tuple in the read set been modified?.Phase 3:Commit the results in critical section or abort:Aborts: aborts the transaction if validationfails. Commits: installs the write set and commits thetransaction10
• OCC executes a transaction in three phases: • Phase 1: concurrent local processing • Reads tuples into a read set • Buffers writes into a write set • Phase 2: Validation in critical section • Validates whether serializability is guaranteed: Has any tuple in the read set been modified? • Phase 3: Commit the results in critical section or abort • Aborts: aborts the transaction if validation fails • Commits: installs the write set and commits the transaction OCC: How It Works 10
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《系统软件与软件安全》课程教学课件(PPT讲稿,英文)Lecture-7-big-volume-data-accesses.pptx
- 《系统软件与软件安全》课程教学课件(PPT讲稿,英文)Lecture-4-LSbM-tree.pptx
- 《系统软件与软件安全》课程教学课件(PPT讲稿,英文)Lecture-3-MR-model-and-systems.pptx
- 《系统软件与软件安全》课程教学课件(PPT讲稿,英文)Lecture-2-access-patterns-in-big-data.pptx
- 《系统软件与软件安全》课程教学课件(PPT讲稿,英文)Lecture-1-balanced-systems-updated.pptx
- 《系统软件与软件安全》课程教学资源(文献资料)系统软件与软件安全文献合集.pdf
- 济南大学:研究生院《人工智能》专业课程教学大纲汇编.pdf
- 济南大学:研究生院《计算机技术》专业课程教学大纲汇编.pdf
- 济南大学:研究生院《计算机科学与技术》专业课程教学大纲汇编.pdf
- 北京信息科技大学:研究生院计算机学院课程教学大纲汇编.pdf
- 湖南工业大学:计算机与人工智能学院人工智能专业课程教学大纲汇编(2023版人才培养方案).pdf
- 湖南工业大学:计算机与人工智能学院智能科学与技术专业课程教学大纲汇编(2023版人才培养方案).pdf
- 湖南工业大学:计算机与人工智能学院物联网工程专业课程教学大纲汇编(2023版人才培养方案).pdf
- 湖南工业大学:计算机与人工智能学院网络工程专业课程教学大纲汇编(2023版人才培养方案).pdf
- 湖南工业大学:计算机与人工智能学院通信工程专业课程教学大纲汇编(2023版人才培养方案).pdf
- 湖南工业大学:计算机与人工智能学院软件工程专业课程教学大纲汇编(2023版人才培养方案).pdf
- 华中科技大学:计算机科学与技术学院《机器学习》课程教学大纲(2021版).pdf
- 华中科技大学:计算机科学与技术学院《计算机图形学》课程教学大纲(2021版).pdf
- 华中科技大学:计算机科学与技术学院《计算理论》课程教学大纲(2021版).pdf
- 华中科技大学:计算机科学与技术学院《计算思维》课程教学大纲(2021版).pdf
- 《系统软件与软件安全》课程教学课件(PPT讲稿,英文)Lecture-7-SSD-sys.pptx
- 《系统软件与软件安全》课程教学课件(PPT讲稿,英文)Lecture-8-SDS-vision.pptx
- 江苏科技大学:《计算机组成原理》课程教学资源(PPT课件,完整讲稿,共十章).pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter1_1计算机基础知识.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter1_2计算机中数的表示和编码.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter2_1 8086-8088微处理器结构.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter2_2 8086-8088的寻址方式.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter2_3 8086-8088的指令系统.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter2_4逻辑指令-控制转移指令.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter2_5处理机控制-串处理指令.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter3_1汇编语言及其程序结构.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter3_2汇编语言程序举例.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter3_3 BIOS和DOS中断功能调用.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter3_4 汇编语言程序设计.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter3_5 汇编语言程序设计小结.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter4_1 PC机的总线结构和时序.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter4_2 总线与时序.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter5_0接口概述.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter5_1接口技术的基本概念.pptx
- 江苏科技大学:《微机原理与接口技术》课程教学资源(PPT课件)Chapter5_2 CPU与外设间的数据传送方式.pptx
