Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Intrusive data structure 소개
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Jongbin Oh
May 09, 2022
Programming
0
210
Intrusive data structure 소개
Jongbin Oh
May 09, 2022
Tweet
Share
More Decks by Jongbin Oh
See All by Jongbin Oh
NDC22 <달빛조각사>에서 서버 테스트 코드를 작성하는 방법
ohyecloudy
0
380
트위터 봇 개발 후기
ohyecloudy
0
180
UML 적절하게 사용하기
ohyecloudy
0
240
Multithread design pattern
ohyecloudy
0
63
적당한 스터디 발표자료 만들기
ohyecloudy
0
250
넘쳐나는 정보 소화 노하우
ohyecloudy
0
65
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
ohyecloudy
0
1.7k
비트 경제와 공짜
ohyecloudy
0
48
내가 본 미드 이야기
ohyecloudy
0
56
Other Decks in Programming
See All in Programming
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
280
Raku Raku Notion 20260128
hareyakayuruyaka
0
180
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
130
CSC307 Lecture 05
javiergs
PRO
0
500
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.2k
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
390
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.4k
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
140
Package Management Learnings from Homebrew
mikemcquaid
0
220
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6.1k
CSC307 Lecture 04
javiergs
PRO
0
660
Featured
See All Featured
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
67
Typedesign – Prime Four
hannesfritz
42
2.9k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
160
Speed Design
sergeychernyshev
33
1.5k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
140
What's in a price? How to price your products and services
michaelherold
247
13k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
54
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Odyssey Design
rkendrick25
PRO
1
500
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
The SEO Collaboration Effect
kristinabergwall1
0
350
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Transcript
head obj head 0 obj head obj head list link
link link head obj head 0 obj head obj head list link link link data data data element element element intrusive slist non-intrusive slist intrusive data structure 소개 http://ohyecloudy.com ohyecloudy http://cafe.naver.com/architect1 아꿈사 2012.01.07
intrusive가 어떤 건지 살펴본다 어려운 개념은 아님 단지 낯선 느낌일
뿐 표준 라이브러리에서 채택된 경우는 없음
Soukup J.: Intrusive Data Structures, C++ Report, Vol.10 (1998) http://www.codefarms.com/publications/intrusiv/Intrusive.pdf
이 문서를 바탕으로 발표자료를 만들었습니다.
boost::intrusive intrusive로 구현된 자료구조. 우리에겐 boost가 있어요. 예제로 boost를 사용.
간단하게만 사용합니다. http://www.boost.org/doc/libs/1_48_0/doc/html/intrusive.html
intrusive data structure?
data structure는 자료구조 intrusive는? 일단 단어 정리부터
끼어드는, 침입적인 뭔가 끼어 넣는 것이다.
non-intrusive intrusive STL에 정의된 모든 자료구조 일반적인 표준 라이브러리
non-intrusive list에서 원소 삽입한다면? 지금부터는 설명이 쉬운 list로 설명
None
Memory node(lLink, rLink, data)를 동적 할당. 복사 data data new
data와 link를 저장할 수 있는 node를 할당 data는 복사. 우리가
포인터를 원소 타입으로 지정하는 이유. std::list<BigObject> ssibal; (X) std::list<BigObject*> okayList; (O)
intrusive list에서 원소 삽입한다면?
뭐야! non-intrusive랑 똑같잖아!
Memory node(lLink, rLink, data)를 동적 할당. 복사 data data new
다르다! node 할당이 따로 필요 없음. 원소가 link 정보를 가지고 있다.
struct BigObject { BigObject* lLink; BigObject* rLink; Data m_a; Data
m_b; … }; node(lLink,rLink,data)를 따로 할당할 필요가 없음. 원소 자체에 다 포함되어 있으니깐 BigObject는 리스트 원소. 리스트를 구성하는데 필요한 link 정보를 가지고 있다.
non-intrusive intrusive lLink data rLink node BigObject address of BigObject
lLink rLink
정리하면 non-intrusive와 다르게 intrusive는 node가 갖고 있는 정보를 원소가 다
가지고 있다 list를 예로 들면 lLink, rLink를 원소가 가짐
특 징
추가 메모리 할당이 없다 이미 다 정의했다. link 정보를 멤버로
정의한다.
bi-directional access 가능 원소에 link 정보가 다 있다. 원소에서 unlink가
가능하다. lLink, rLink를 다 알고 있음.
struct MyClass : public boost::intrusive::list_base_hook<> { int m_data; }; typedef
boost::intrusive:: list<MyClass> MyList; lLink, rLink와 같은 링크 정보
MyClass elem; MyList container; container.push_front(elem); container.remove(elem); or elem.unlink(); 컨테이너 연산으로
리스트에서 제거 원소 연산으로 리스트에서 제거
추가 포인터 점프가 없어 빠르다 데이터에 접근할 때 한번 더
점프 pointer가 원소일 때 non-intrusive 원소에 접근 == 데이터에 접근 intrusive
공짜 수명제어 제공 링크 여부를 알 수 있어서 원소에서 소멸자에서
link 여부 검사 컨테이너에서 안 빼내고 해제 경고 혹은 소멸자에서 자동으로 제거
class MyClass : public boost::intrusive::list_base_hook<> { public: MyClass () {}
~MyClass () { unlink(); } int m_data; }; 소멸자에서 unlink()하면 해제된 놈이 컨테이너에 남아있는 경우가 없다.
primitive type을 그냥 못 넣는다 int를 넣으려면? 멤버를 int로 갖는
클래스 정의 불편 이런 불편이 기여하지 않았을까? 표준 구현이 non-intrusive가 되는데 추측
정 리
intrusive data structure는 링크와 같은 node 구성 요소를 원소가 들고
있음 추가 메모리 할당이 필요 없다 bi-directional access 가능 추가 포인터 점프가 없어 빠르다 공짜 수명제어 제공 primitive type을 그냥 넣지는 못한다
단점이 적다 link 때문에 코드가 더러워져 원소에서 unlink와 같은 연산이
가능해 주의필요 우수한 구현 방법 Intrusive and non-intrusive containers - boost http://bit.ly/xR8vPI
CC BY-NC-SA 3.0