Skip to content

race-condition-pointers.go örneği, atomic kullanılarak fix edildi#12

Open
ertugrulakca wants to merge 3 commits intoGoTurkiye:mainfrom
ertugrulakca:race-condition-pointers-fix-with-atomic
Open

race-condition-pointers.go örneği, atomic kullanılarak fix edildi#12
ertugrulakca wants to merge 3 commits intoGoTurkiye:mainfrom
ertugrulakca:race-condition-pointers-fix-with-atomic

Conversation

@ertugrulakca
Copy link
Copy Markdown

No description provided.

Comment on lines +28 to +31
func increment(rt *RaceTest, wg *sync.WaitGroup) {
atomic.AddInt32(&rt.Val, 1)
wg.Done()
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

atomic ornegi guzel olmus, aynisini farkli baska bir fonksiyonda mutex ile ornegini yapip aralarinda benchmark uyguladigimiz bir test eklesek nasil olurdu?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Çok güzel bir örnek olur aslında, ikisi arasındaki performans farkını görmüş oluruz hem,

#7 şuradaki pr da mutex ile çözümü var. Her ikisi merge edildiğinde yeni bir branch üzerinden benchmark testlerini yazarsak temiz olur diye düşünüyorum?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 istersen o PR'daki commiti cherry-pick ile bu PR'a tasiyip islemleri buradan da devam ettirebiliriz tek bir .go dosyasi uzerinden. ne dusunursun?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selamlar, ilgili pr merge edildi, buradaki süreci ilerletebilirsiniz.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

istersen o PR'daki commiti cherry-pick ile bu PR'a tasiyip islemleri buradan da devam ettirebiliriz tek bir .go dosyasi uzerinden. ne dusunursun?

102-concurrency/goroutines altında bir dizin oluşturalım o zaman, #7 deki merge ile gelen mutex lock çözümünü içerisine ekleyip benchmark testleri için tek bir dosya açarız. İlk söylediğin gibi tek bir dosyada 2 farklı metodu da eklediğimizde güzel olacaktır. Ne dersin?

En sonda dizinin görüntüsü şu şekilde olacak.

Screenshot 2021-09-29 at 17 22 04

@ertugrulakca
Copy link
Copy Markdown
Author

@Dentrax çözüm metodlarını bir dosya içerisine ekleyip, benchmark testlerini oluşturdum. Testlerin nasıl çalıştırılacağını ve örnek test sonuçlarını Readme içerisinde paylaştım.

İlgili commit: 2478c82

@Dentrax
Copy link
Copy Markdown
Collaborator

Dentrax commented Sep 30, 2021

@Dentrax çözüm metodlarını bir dosya içerisine ekleyip, benchmark testlerini oluşturdum. Testlerin nasıl çalıştırılacağını ve örnek test sonuçlarını Readme içerisinde paylaştım.

İlgili commit: 2478c82

Eline saglik README yazman da hos olmus 👍

ptal @mstrYoda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants