<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ko">
	<id>http://junhoahn.kr/noriwiki/index.php?action=history&amp;feed=atom&amp;title=Test_and_test_and_set</id>
	<title>Test and test and set - 편집 역사</title>
	<link rel="self" type="application/atom+xml" href="http://junhoahn.kr/noriwiki/index.php?action=history&amp;feed=atom&amp;title=Test_and_test_and_set"/>
	<link rel="alternate" type="text/html" href="http://junhoahn.kr/noriwiki/index.php?title=Test_and_test_and_set&amp;action=history"/>
	<updated>2026-05-14T21:50:05Z</updated>
	<subtitle>이 문서의 편집 역사</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>http://junhoahn.kr/noriwiki/index.php?title=Test_and_test_and_set&amp;diff=291&amp;oldid=prev</id>
		<title>Ahn9807: 새 문서: 분류: 동시성 프로그래밍  == 개요 == test and test and set은 기존 Test and set의 단점을 극복하기 위해서 만들어졌다. 모든 test_and_set은 기존의 val값이 무었이든 상관없이 cache line invalidation을 요구한다. 이는 Multicore환경에서 performance저하를 일으켜서 Scalability을 저하시킨다. 이 문제를 해결하기 위해서 Test and test and set은 우선 set없는 test를 수행하여 변수를 확인하...</title>
		<link rel="alternate" type="text/html" href="http://junhoahn.kr/noriwiki/index.php?title=Test_and_test_and_set&amp;diff=291&amp;oldid=prev"/>
		<updated>2023-02-04T04:39:20Z</updated>

		<summary type="html">&lt;p&gt;새 문서: &lt;a href=&quot;/noriwiki/index.php?title=%EB%B6%84%EB%A5%98:%EB%8F%99%EC%8B%9C%EC%84%B1_%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D&quot; title=&quot;분류:동시성 프로그래밍&quot;&gt;분류: 동시성 프로그래밍&lt;/a&gt;  == 개요 == test and test and set은 기존 &lt;a href=&quot;/noriwiki/index.php?title=Test_and_set&quot; title=&quot;Test and set&quot;&gt;Test and set&lt;/a&gt;의 단점을 극복하기 위해서 만들어졌다. 모든 test_and_set은 기존의 val값이 무었이든 상관없이 cache line invalidation을 요구한다. 이는 &lt;a href=&quot;/noriwiki/index.php?title=Multicore&quot; title=&quot;Multicore&quot;&gt;Multicore&lt;/a&gt;환경에서 performance저하를 일으켜서 Scalability을 저하시킨다. 이 문제를 해결하기 위해서 Test and test and set은 우선 set없는 test를 수행하여 변수를 확인하...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;새 문서&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[분류: 동시성 프로그래밍]]&lt;br /&gt;
&lt;br /&gt;
== 개요 ==&lt;br /&gt;
test and test and set은 기존 [[Test and set]]의 단점을 극복하기 위해서 만들어졌다. 모든 test_and_set은 기존의 val값이 무었이든 상관없이 cache line invalidation을 요구한다. 이는 [[Multicore]]환경에서 performance저하를 일으켜서 Scalability을 저하시킨다. 이 문제를 해결하기 위해서 Test and test and set은 우선 set없는 test를 수행하여 변수를 확인하고 특정조건에서만 test and set을 요구한다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
class TasSpinLock&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    ALWAYS_INLINE void Enter()&lt;br /&gt;
    {&lt;br /&gt;
        // atomic_bool::exchange() returns previous value of Locked&lt;br /&gt;
        while (Locked.exchange(true, std::memory_order_acquire) == true);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    ALWAYS_INLINE void Leave()&lt;br /&gt;
    {&lt;br /&gt;
        Locked.store(false, std::memory_order_release);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
private:&lt;br /&gt;
    alignas(CACHELINE_SIZE) std::atomic_bool Locked = {false};&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
static_assert(sizeof(TasSpinLock) == CACHELINE_SIZE, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 단점 ==&lt;br /&gt;
# [[Thundering Herd]]문제가 역시 발생한다. 이 문제를 해결하고자 임의의 (혹은 여러 파라미터로 결정되는 시간의) backoff즉 지연을 주어서 각 스레드가 특정한 지연뒤에 TTAS를 실행시키도록 하는 방법도 있다. 이 방식을 TATAS with exponential backoff라고 한다. &lt;br /&gt;
&lt;br /&gt;
== 참고 ==&lt;br /&gt;
# https://geidav.wordpress.com/tag/test-and-test-and-set/&lt;/div&gt;</summary>
		<author><name>Ahn9807</name></author>
	</entry>
</feed>