Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

akcauser
Copy link

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
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
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
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
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
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

@akcauser
Copy link
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
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