Concurrency control

Double compare-and-swap

Double compare-and-swap (DCAS or CAS2) is an atomic primitive proposed to support certain concurrent programming techniques. DCAS takes two not necessarily contiguous memory locations and writes new values into them only if they match pre-supplied "expected" values; as such, it is an extension of the much more popular compare-and-swap (CAS) operation. DCAS is sometimes confused with the double-width compare-and-swap (DWCAS) implemented by instructions such as x86 CMPXCHG16B. DCAS, as discussed here, handles two discontiguous memory locations, typically of pointer size, whereas DWCAS handles two adjacent pointer-sized memory locations. In his doctoral thesis, Michael Greenwald recommended adding DCAS to modern hardware, showing it could be used to create easy-to-apply yet efficient software transactional memory (STM). Greenwald points out that an advantage of DCAS vs CAS is that higher-order (multiple item) CASn can be implemented in O(n) with DCAS, but requires O(n log p) time with unary CAS, where p is the number of contending processes. One of the advantages of DCAS is the ability to implement atomic deques (i.e. doubly linked lists) with relative ease.More recently, however, it has been shown that an STM can be implemented with comparable properties using only CAS. In general however, DCAS is not a silver bullet: implementing lock-free and wait-free algorithms using it is typically just as complex and error-prone as for CAS. Motorola at one point included DCAS in the instruction set for its 68k series; however, the slowness of DCAS relative to other primitives (apparently due to cache handling issues) led to its avoidance in practical contexts. As of 2015, DCAS is not natively supported by any widespread CPUs in production. The generalization of DCAS to more than two addresses is sometimes called MCAS (multi-word CAS); MCAS can be implemented by a nestable LL/SC, but such a primitive is not directly available in hardware. MCAS can be implemented in software in terms of DCAS, in various ways. In 2013, Trevor Brown, Faith Ellen, and Eric Ruppert have implemented in software a multi-address LL/SC extension (which they call LLX/SCX) that while being more restrictive than MCAS enabled them, via some automated code generation, to implement one of the best performing concurrent binary search tree (actually a ), slightly beating the JDK CAS-based skip list implementation. In general, DCAS can be provided by a more expressive hardware transactional memory. IBM POWER8 and Intel Intel TSX provide working implementations of transactional memory. Sun's cancelled Rock processor would have supported it as well. (Wikipedia).

Video thumbnail

Compare Integers, Fractions, and Mixed Numbers (Number Line and Common Denom)

This video explains how to compare integers, fractions, and mixed numbers using a number line and by obtaining a common denominator.

From playlist Adding and Subtracting Fractions

Video thumbnail

Subtract Mixed Numbers Using the Compensation Method

This video explains how to use compensation to subtract mixed number when an exchange (borrowing) is required. http://mathispower4u.com

From playlist Adding and Subtracting Mixed Numbers

Video thumbnail

Method of Pairwise Comparisons

Mathematics of Voting Determine a winner by Method of Pairwise Comparisons.

From playlist Discrete Math

Video thumbnail

Subtracting two mixed numbers - Math Practice - Tutoring Online

πŸ‘‰ Learn how to add and subtract mixed numbers. Mixed numbers are numbers with two parts: the whole number part and the fraction part. Mixed numbers are ways to represent improper fractions using proper fractions. To add or subtract mixed numbers, we first convert the mixed numbers to impr

From playlist Add and Subtract Mixed Numbers

Video thumbnail

Find the Difference of Mixed Numbers - Compare 2 Methods

This video explains how to find the difference of mixed numbers using improper fractions and using mixed numbers. A model is shown. http://mathispower4u.com

From playlist Adding and Subtracting Mixed Numbers

Video thumbnail

Ex 5: Division Involving Mixed Numbers - Compare Alternative and Traditional Methods

This video explains an alternative method that can be used to divide mixed numbers. The method involving obtaining a common denominator and then dividing the numerators. The video shows the alternative method and the traditional method of multiplying by the reciprocal.

From playlist Multiplying and Dividing Mixed Numbers

Video thumbnail

Introduction to Similarity

This video introduces similarity and explains how to determine if two figures are similar or not. http://mathispower4u.com

From playlist Number Sense - Decimals, Percents, and Ratios

Video thumbnail

Similar Triangles Using Side-Side-Side and Side-Angle-Side

This video explains how to determine if two triangles are similar using SSS and SAS. Complete Video List: http://www.mathispower4u.yolasite.com

From playlist Similarity

Video thumbnail

Lecture 4 | Programming Paradigms (Stanford)

Lecture by Professor Jerry Cain for Programming Paradigms (CS107) in the Stanford University Computer Science department. In this lecture, Prof. Cain discusses C and C++ programming, including bit patterns, memory copy, and linear search. Programming Paradigms (CS107) introduces severa

From playlist Lecture Collection | Programming Paradigms

Video thumbnail

Finding the quotient of two mixed numbers

πŸ‘‰ Learn how to divide mixed numbers. To divide mixed numbers, we first convert the mixed numbers to improper fractions. After we have converted the mixed numbers to improper fractions, we can then multiply the first fraction by the reciprocal of the second fraction. (The reciprocal of a fr

From playlist How to Multiply and Divide Fractions

Video thumbnail

Big O

We can describe the efficiency of an algorithm, program, or a programmatic operation, in terms of the time it takes, the amount of memory it uses, or the amount of secondary storage space it needs to do its work. However, these performance measures depend on a number of factors, not least

From playlist Big O Complexity

Video thumbnail

Travelling salesperson problem (Decision Maths 1)

Powered by https://www.numerise.com/ Travelling salesperson problem (Decision Maths 1). A video showing how to calculate an upper bound and lower bound as well as the nearest neighbour solution. Finally I finish off by showing how to use the tour improvement algorithm to attempt to find

From playlist Decision Maths 1 OCR Exam Board (A-Level tutorials)

Video thumbnail

Big O Part 3 – Quadratic Complexity

The raw performance of an algorithm, program, or a programmatic operation depends on a number of factors such, not least the computer it’s running on. Big O is not concerned with this; Big O describes the way the time taken by a program (or memory or space usage) depends on the amount of

From playlist Big O Complexity

Video thumbnail

Introduction to Forth Language Programming Tutorial using Bitcoin

an introduction tutorial to the FORTH programming language and why it's important. If you truly want to understand stack machines, webassembly, bitcoin, blockchain or smart contracts then you really need to learn forth programming. although the forth language is an old programming langua

From playlist WebAssembly

Video thumbnail

Bubble Sort 1- Algorithm

This is the first of four videos about the bubble sort. This video describes the bubble sort algorithm, otherwise known as the ripple sort, or the sinking sort. The bubble sort is one of the simplest sorting algorithms and is therefore relatively easy to understand and implement. The bub

From playlist Sorting Algorithms

Video thumbnail

Week 5: Monday - CS50 2011 - Harvard University

CS50 Library. Heap. Pointers, continued. Forensics.

From playlist CS50 Lectures 2011

Video thumbnail

C Programming: sorting an array with bubble sort and quicksort (qsort)

In this session we will learn how to sort an array using bubble sort and the built-in quicksort function qsort. We will do an array of floats, an array of strings, and an array of structs.

From playlist C Programming

Video thumbnail

Determine the Sum and Difference of Mixed Numbers Using Formal Rules

This video explains how to add and subtract mixed numbers using formal rules. http://mathispower4u.com

From playlist Adding and Subtracting Mixed Numbers

Video thumbnail

Week 4: Wednesday - CS50 2011 - Harvard University

Merge sort. Structures. Dynamic memory allocation. Pointers. Debugging, continued.

From playlist CS50 Lectures 2011

Related pages

Software transactional memory | POWER8 | Compare-and-swap | Transactional memory | Skip list | Binary search tree