'스레드안정성'에 해당되는 글 2건
- 2009/10/22 My Recent Tweets 20091021
- 2009/05/12 std::stack에 관한 소고
- My Recent Tweets 20091021
Tweet
- Tweets
- 2009/10/22 08:05
- C++, codepad, Coders at Work, CT, D 언어, Fermi, functional programming, git, Git#, GLSL, KGC2009, Lambda Calculus, Lean, llvm, NAN, OpenGL 3.2, SFINAE, TDD, TED, VS2010, WPF, 네할렘, 뽀모도로, 스레드안정성, 스크럼, 애자일, 윈폼, 정렬, 칸반, 파이썬, 프로그래밍퍼즐
-
- PlanetD - a collection of blogs about D: http://su.pr/4iAHrC #programming #
- D 언어에 관한 글 모음 블로그
- RT codemonkeyism: +1 RT surya_s: +1 for Git: http://bit.ly/2ZL224 via KentBeck #programming #
- 또다른 git 튜토리얼
- RT bjoernknafla: Great info about VS2010 - RT msinilo: VS2010b impressions on John Robbins' blog: http://j.mp/3fHUpX, concurrency profi... #
- 최근 나온 비주얼 스튜디오 2010 베타2에 관한 사용기
- C++ and functional programming idioms: http://su.pr/2CwJmd #C++ #programming #
- C++로 함수형 프로그래밍하기
- Understanding SFINAE: http://su.pr/16NfZt #C++ #programming #
- C++의 "Substitution failure is not an error"를 잘 설명한 글
- Debunking Software Engineering Myths: Does the organization matter more than the programming? http://su.pr/2ub7jl #programming #
- 조직구조가 여타 코드계측보다 코드품질과의 상관관계가 더 높다는 흥미로운 연구결과
- RT programmingjoy: LLVM DevMeeting videos posted #programming http://bit.ly/1LcON3 #
- 최근 각광을 받고 있는 LLVM 개발회의 슬라이드 및 영상 자료
- RT programmingjoy: As Timeless As Infinity - Background on floating point math and NaN values #programming http://bit.ly/1EX0JP #
- 부동소수점수와 NaN 값에 관한 설명
- RT DeliciousHot: 10 Puzzle Websites to Sharpen Your Programming Skills http://is.gd/4n4HV #programming #
- 프로그래밍 퍼즐 사이트 모음
- C++ in Coders at Work: http://su.pr/1J9Xkg #C++ #programming #
- 책 "Coders at Work"의 C++ 관련 언급들... 다들 C++을 싫어하는듯;
- RT bjoernknafla: jooones: Still using Carmack's Magic Number rqsrt? "Timing square root" by Elan Ruskin http://bit.ly/2XALz8 #programming #
- 제곱근 계산의 다양한 방법들 성능 비교!
- RT KageKirin: ldc - #LLVM #D #Compiler #programming - well I was wondering if that existed. http://tinyurl.com/5qolxn #
- LLVM D 컴파일러
- RT itshooter: The Official Microsoft WPF and Windows Forms Site http://bit.ly/QeNr6 #WPF #programming #
- 마이크로스포트 공식 WPF 및 윈폼 사이트
- psake - A build automation tool... now with less XML... http://su.pr/2cJGk0 #programming #
- 파워쉘 기반 빌드 자동화 도구
- ㅎㅎ 글쿤요. RT javawork: 세상에는 정말 많은 C++ 네트웍 라이브러리가 있군요. - http://tinyurl.com/cqf4q8 #programming #
- RT programmingjoy: Git# - First Public Release #programming http://bit.ly/1CcWOg #
- 닷넷 Git
- RT programmingjoy: Lambda Calculus #programming http://bit.ly/2Nf14V #
- RT programmingjoy: Joel Spolsky: You cannot program parallel in C, period #programming http://bit.ly/pX3ZK #
- C로는 병렬 프로그래밍이 불가능하다는 조엘의 주장
- RT eHub: codepad http://bit.ly/Zs59V #programming #
- 여러 언어를 지원하는 온라인 컴파일러
- RT programmingjoy: Sorting Algorithm Shootout #programming http://bit.ly/RAPj0 #
- 정렬 알고리즘 비교
- RT programmingjoy: Vidiowiki feature on ICFP 2009 in Edinburgh #programming http://bit.ly/cLXFj #
- 함수형 프로그래밍 국제 컨퍼런스 영상위키
- RT programmingjoy: shedskin: an experimental Python to C++ compiler #programming http://bit.ly/apENm #
- 제한적 파이썬 -> C++ 컴파일러
병렬성parallelism
- RT programmingjoy: What is this thing you call "thread safe"? #programming http://bit.ly/2odln7 #parallelism #
- 스레드안정성의 의미에 관한 고찰
- RT bjoernknafla: Intel sponsored Gamasutra article by Ryan Shrout & Leigh Davis about thread programming for Nehale... http://bit.ly/29EhcL #
- 인텔 CPU의 근래 변화와 관련 최적화 팁
- RT SoftTalkBlog: Intel Ct Technology opens for beta applications. New tool to automate data parallelism. http://bit.ly/12arQy #parallelism #
- 데이터 병렬화를 자동화해주는 인텔의 새로운 도구 Ct
개발방법론methodology
- RT istoriae: Certified ScrumMaster course를 수료했습니다. 무면허 운전을 하다가, 운전 면허를 딴 기분이랄까요? 워크샵에서 얻은 것들을 이곳에 차차 정...:http://go.kaykim.org/csmkoreawiki #
- 한국에 있었으면 저도 참가하고 싶었는데... ㅠㅠ
- Agile Self-Assessment Tool: http://su.pr/74of9p #methodology #
- ThoughtWorks에서 제시하는 애자일 자기평가 도구
- RT programmingjoy: Lean To The Extreme #programming http://bit.ly/32BwcW #
- RT LeanKitKanban: RT topsurf: here is my Personal Kanban Evolution: http://bit.ly/3Srkw #personal #Kaban #lean #gtd #methodology #
- 칸반을 열심히 사용 중인 개인의 경험담
- RT unclebobmartin: Lee Copeland on Scrumdamentalism http://tinyurl.com/ygtxtja #methodology #
- RT unclebobmartin: One more blog on TDD. TDD Triage. http://bit.ly/2z2GXG Where does TDD work and where Doesn't it? #methodology #
- TDD에 관한 엉클밥의 의견
- The Pomodoro Technique: http://su.pr/1PwcSz #methodology #
- 일인스크럼 뽀모도로 테크닉에 관한 웹사이트
- The Danger of Lean: Ignoring Social Complexity http://su.pr/2L6ag2 #methodology #
- 사회성의 복잡도를 간과하는 린의 문제점을 지적하는 글
그래픽스graphics
- RT KageKirin: OpenGL 3.2 and More #graphics #programming #presentation #paper http://tinyurl.com/yhhf39z #
- 마크 킬가드의 OpenGL 3.2 관련 슬라이드
- New DirectX MSDN Developer Center: http://su.pr/9k7BqM #graphics #
- RT nvidiadeveloper: Satisfy your "inner geek" by reading the Whitepaper on "Fermi," NVIDIA’s Next-Gen CUDA... http://is.gd/4i9du #graphics #
- NVIDIA의 차세대 GPU 페르미에 관한 백서
- RT programmingjoy: Night Vision Post Processing GLSL Shader #programming http://bit.ly/5Ah8V #graphics #
- 야간시야 셰이더 효과 예제
기타etc.
- RT seoulrain: 차 마실 때 + 아무 때나 쓸 수 있는 귀여운 웹타이머 http://steep.it/ #
- RT sioum: 수학 연구 관련해서 "지식인" 같은 웹사이트가 생겼군요. Terrence Tao 교수 블로그에서 소개되어서 알게되었습니다. http://mathoverflow.net/ #
- 스택오버플로우(아시죠, 프로그래밍 질답 사이트) 수학 버전
- RT RatRaceTrap: “Let fear be a counselor and not a jailer” --Anthony Robbins #rq #
- RT DeliciousHot: View and Share PDF's Online in HTML http://is.gd/4l4gR #
- RT 79k: http://andstudy.com/andwiki/wiki.php/KGC2009/Link KGC2009 관련자료 모음링크입니다. 게임산업에 관심있으신 분들은 보시면 좋은 자료 많은 듯 합니다. 즐거운 오후 되시기... #gamedev #
- Amazing! RT programmingjoy: 10/GUI is one of the most dramatic reimaginations of the desktop user int.... #programming http://bit.ly/3EArvd #
- 혁신적인 멀티터치 기반 데스크탑 UI
- RT gamearchitect: Diffen - Compare Anything. Diffen. Discern. Decide: http://bit.ly/PqfPD #
- 온라인 diff 도구
- RT xiles: 국내 웹서비스 모음 http://xiles.net/web_services 아직 정리가 완전히 안됐지만, 차차 정리하고 댓글/추천 등을 넣을 예정입니다. 한국에서 개발한 멋진 웹서비스들이 엄청 많아질때까지~!!! #
- RT DeliciousHot: TEDTalks as of 10.09.09 - Google Docs http://is.gd/4eT6z #
- TED 비디오 목록
- RT spolsky: StackExchange site of the day: http://epicadvice.com/ (about World of Warcraft) #
- 스택오버플로우 와우 버전;
- RT autenil: Sweet. RSS feed filtering: http://feedrinse.com/ #
- 저도 이게 좀 필요한듯...
- RT spolsky: Peek inside Fog Creek: http://training.fogcreek.com/ #
- 조엘이 트레이닝 비디오도 출시하는군요.
* 이 포스트는 blogkorea [블코채널 : 웹, 컴퓨터, it에 관련된 유용한 정보 및 소식] 에 링크 되어있습니다.
'Tweets' 카테고리의 다른 글
| My Recent Tweets 20091120 (0) | 2009/11/24 |
|---|---|
| My Recent Tweets 20091104 (0) | 2009/11/06 |
| My Recent Tweets 20091021 (0) | 2009/10/22 |
| My Recent Tweets 20090928 (0) | 2009/10/01 |
| My Recent Tweets 20090909 (0) | 2009/09/10 |
| My Recent Tweets 20090826 (0) | 2009/08/26 |
- std::stack에 관한 소고
Tweet
- Game Development
- 2009/05/12 20:34
- C++, Concurrency, condition variable, Exception, exception safety, race condition, std::stack, STL, Thread Safety, 스레드안정성, 스택, 예외, 예외안전성
-
이하의 정보는 "C++ Concurrency in Action"에서 얻은 것임을 밝힙니다.
(참고로 아직 정식 출간되지 않은 이 책의 맛보기 버전을 여기에 있는 쿠폰코드를 사용하면 싸게 구입하실 수 있습니다.)
스택하면 push/pop이 기본인데요, 이 std::stack은 실제 스택 꼭대기에 있는 놈을 리턴하는 top()과 실제 그 놈을 스택에서 꺼내는 pop() 함수가 따로 있습니다. 처음 사용할 때, 왜 이렇게 함수를 나눠놨을까 의아해 하였습니다.
이유가 있었더군요. 예외 안정성 때문이었습니다. 그냥 함수 하나로 값 리턴과 꺼내기를 한번에 수행할 경우, 그 리턴값을 지역 변수 등에 복사할 때 예외가 발생하면, 값은 못얻어왔으나 스택에서는 이미 꺼내버려 값이 사라지는 경우가 발생할 수 있습니다. 현 구현처럼 두 함수로 나눠놓으면 top()의 리턴값을 복사하는 와중에 예외가 발생하더라도 아직 꺼내진 않았기 때문에, 자료구조의 상태를 예외 발생 이전대로 안전하게 유지할 수 있는 것이죠.
근데 이러한 선택이 스레드 안전성에서는 오히려 문제가 됩니다. 아래와 같은 race 상황을 근본적으로 막을 수 없기 때문입니다. top()과 pop() 함수 등을 뮤텍스로 잘 보호해놓았어도 여전히 해결이 안되는 인터페이스 자체의 문제라 하겠습니다.
따라서 예외 안정성과 스레드 안정성을 동시에 보장할 수 있는 인터페이스를 고안해야합니다. 여러가지 해결책이 있습니다만, 다음과 같은 두가지 버전의 pop 함수를 제공해 상황에 맞게 사용자가 골라 쓸 수 있게 하는 것을 추천합니다. 위에 것은 포인터로 리턴하므로 복사 시 예외 문제가 없고, 아래 것은 출력 인자에 값을 복사한 후 pop을 하니 역시 예외 안정성이 유지됩니다.
(여러 해법들의 장단점에 대한 구체적 설명은 서두에 언급한 책을 참고해주세요.)
이 경우 빈 스택에 pop을 할 경우 예외를 던집니다. 스택이 비어 있지 않을 때가지 대기하다가 pop하는 등의 좀더 고급 동작을 원하는 경우, condition variable 같은 고급 동기화 개체를 사용해야 합니다. (위 쿠폰코드가 있는 슬라이드에 그 예가 나와있습니다.)
'Game Development' 카테고리의 다른 글
| Double-checked locking 이디엄의 함정 (2) | 2009/06/03 |
|---|---|
| Iterators Must Go! (in favor of ranges) (2) | 2009/05/15 |
| std::stack에 관한 소고 (0) | 2009/05/12 |
| 실시간 렌더링에도 temporal coherence를 활용하자! (0) | 2009/05/06 |
| Dual Quaternion Skinning (2) | 2009/04/29 |
| Mixed Resolution Rendering (0) | 2009/04/23 |












Recent comment