Smarter Cpp Atomic Smart Pointers - Efficient Concurrent Memory Management - Daniel Anderson CppCon

  Рет қаралды 14,482

CppCon

CppCon

Күн бұрын

Пікірлер: 28
@guiorgy
@guiorgy Жыл бұрын
A good speaker. Hope to listen to him again in the future.
@janfinis1614
@janfinis1614 Жыл бұрын
This is an absolute game changer for concurrent data structures. Great talk!
@tylovset
@tylovset Жыл бұрын
Best talk I've seen in a long while.
@PedroOliveira-sl6nw
@PedroOliveira-sl6nw Жыл бұрын
Phenomenal speaker and great talk
@BalanNarcis
@BalanNarcis Жыл бұрын
Amazing, this is like sqrt(complexity(HazardPointer) + complexity(RCU)) 😅. Great talk!
@wanpengqian
@wanpengqian Жыл бұрын
A very nice talk, easy to understand, thank you very much.
@alexeysubbota
@alexeysubbota Жыл бұрын
A very concise, good illustrated and informative talk. Thank you!
@dexterman6361
@dexterman6361 Жыл бұрын
Wow. Such an amazing talk! Exquisite explanation and slide details! Damn, I wish I was this smart haha
@alfonsor5643
@alfonsor5643 Жыл бұрын
Great talk, thanks for clear presentation
@JohnWilliams-gy5yc
@JohnWilliams-gy5yc Жыл бұрын
Just wondering whether we also need the *deferred_unique_ptr* counterpart?
@IasonNikolas
@IasonNikolas Жыл бұрын
What overhead this deferred logic will have in a single threaded application compared to the shared_ptr? If the compiler could reason about the threading environment and optimize out the "please don't delete it if someone else uses it" in the case of object living in a single thread, then it might make sense to add this logic straight to the shared_ptr itself! Great talk by the way.
@dennisrkb
@dennisrkb Жыл бұрын
Locks aren't bad per se. They allow OSes to detect dependencies between threads and wake up threads holding the lock to hopefully release it quicker.
@denisyaroshevskiy5679
@denisyaroshevskiy5679 Жыл бұрын
Very cool
@michellesoinne9219
@michellesoinne9219 Жыл бұрын
45 minutes in: How come the `protected_ptr->increment_ref_count();` call does not cause cache trashing like in the shared_ptr case? Yes the decrement is being deferred but nothing is said of the increment. Is it in separate memory for different threads and the deferred decrement goes through that?
@kamlot0
@kamlot0 Жыл бұрын
I belive it is related to the question at 59:15. You don't use the load() method during tree read.
@qwertyuiop-cu2ve
@qwertyuiop-cu2ve 10 ай бұрын
When I announce a hazard pointer, how do I get a guarantee that garbage collector will see my announcement in time? How to prevent that they see the bulletin board in a state just before I announced my hazard pointer? I am assuming there is a nonzero latency i.e. "travel time" between me announcing it, and the announced data becoming visible to the other thread.
@ABaumstumpf
@ABaumstumpf Жыл бұрын
This snapshot-pointer is basically what I started try implementing about 2 months ago: an owning observable pointer ( both for unique and shared ownership). But my attempt so far is using a lock cause i want to guarantee that if the actual owner of the resource (or all sh ared owners) end their lifetime the resource also is destroyed. It allows me to have a unique owner in 1 thread but still being able to acces the resource from another thread, while having the guarantee that the resource is valid at any access.
@zxuiji
@zxuiji Жыл бұрын
16:34, just attach a callback to the reference counter, example: struct GC { ... }; sem_t sem; class Gc { struct GC **m_gc; public: Gc() { m_gc = new struct GC*; *m_gc = new struct GC; ... } Gc( Gc *_gc ) { m_gc = _gc->m_gc; ... } ~Gc() { sem_wait( &sem ); if ( !(*m_gc) ) { sem_post( &sem ); return; } *m_gc = NULL; sem_post(&sem); ... } } struct A { ... }; void delete_A_callback( void* ud ) { struct A *a = ud; delete a; } class B { struct A *m_a; gcsem_t *m_sem; public: B() { m_a = new A; m_sem = gc::create( m_a, delete_A_callback ); } B( B* b ) { m_a = b->m_a; m_sem = b->m_sem; m_sem->increase_refc(); } ~B() { m_sem->decrease_refc(); } } m_sem::decrease_refc() is then responsible for deleting m_a, as for itself the gc is responsible for deleting it during collection when it sees the reference count as less than 1, assuming it hadn't been re-assigned to another object prior to that. The global semaphore is for ensuring the read occurs after the pointer has been updated by the thread responsible for deleting the GC, the same semaphore can be used for making sure the pseduo semaphores are deleted before another thread can learn they even exist, this is both fast and flexible, as long as you don't try to delete the pointers directly then no issues will occur
@piotrarturklos
@piotrarturklos Жыл бұрын
Interesting. I find it hard to wrap my head around this though, as there are quite a few names used that aren't defined and I find it hard to come up with the intent for all of them at the same time. Also, GC and Gc is confusing. Is GC intended to be global and Gc in a scope around some algorithm somewhere?
@mentalisttraceur
@mentalisttraceur Жыл бұрын
"Just [~50 lines of code]"
@mentalisttraceur
@mentalisttraceur Жыл бұрын
I'm exaggerating for humor. I'm sure it's a good solution some of the time, and is justifiably prefixed with a "just" to imply that it's simple/easy/clear enough to not need whatever the alternative was.
@AnkurVarsheny
@AnkurVarsheny Жыл бұрын
I sometimes wonder how Linux, Mac and Window kernel work just fine without all this expert things.
@EliHaNavi
@EliHaNavi Жыл бұрын
Linux uses RCU
@freak82music
@freak82music Жыл бұрын
What do you mean? The Linux kernel has lots of usage of the RCU. I personally can talk only for the network stack of Linux but it for sure has lots of usage of the different RCU flavors. However, according to the inventor of the RCU, who is well known in the Linux kernel community and who also has a proposal for RCU in the C++, the usage of the technique in the Kernel grows steadily.
@lexer_
@lexer_ Жыл бұрын
Amazing talk content and good presentation. The only thing that really got on my nerves was the large amount of repetition like the audience is a 5 year old with ADHD. Isn't this talk addressed to the potential implementers and the people that want to adopt this idea FOR their junior developers and not the junior developers themselves? Maybe I am too sensitive...
@masondeross
@masondeross Жыл бұрын
I think it was more to convince the junior developers that they want this rather than doing hazard/rcu themselves, and to convince the experts that it will improve things for them by not having junior devs making bugs for them while not losing unreasonable performance. I don't think this talk was meant for people who want to implement this, but to adopt it with a tiny shout out that he is open to contributions from the very few people like yourself who want to implement a production version. He was selling the concept, not teaching how to implement it, and it made for an incredibly accessible talk for all levels.
@shimadabr
@shimadabr Жыл бұрын
But not everyone in the conference are familiar with these concepts and the nuances of it i imagine.
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 102 МЛН
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 33 МЛН
-memory-safe C++ - Jim Radigan - CppCon 2022
1:05:45
CppCon
Рет қаралды 23 М.
are "smart pointers" actually smart?
9:44
Low Level
Рет қаралды 79 М.
Arvid Norberg: The C++ memory model: an intuition
25:37
SwedenCpp
Рет қаралды 17 М.