* [PATCH] Update Answer to Quick Quiz 5.27 @ 2017-05-09 8:48 Junchang Wang 2017-05-09 14:56 ` Akira Yokosawa 0 siblings, 1 reply; 7+ messages in thread From: Junchang Wang @ 2017-05-09 8:48 UTC (permalink / raw) To: perfbook; +Cc: Junchang Wang Oops. Forgot the summary in previous email. Resend the patch. The Answer to Quick Quiz 5.27 is a bit hard to follow. Rewrite it. Signed-off-by: Junchang Wang <junchangwang@gmail.com> --- count/count.tex | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/count/count.tex b/count/count.tex index cc47554..6dfc7a6 100644 --- a/count/count.tex +++ b/count/count.tex @@ -1258,13 +1258,13 @@ machine. fast and scalable while allowing readers to also enjoy reasonable performance and scalability? \QuickQuizAnswer{ - One approach would be to maintain a global approximation - to the value. - Readers would increment their per-thread variable, but when it - reached some predefined limit, atomically add it to a global - variable, then zero their per-thread variable. - This would permit a tradeoff between average increment overhead - and accuracy of the value read out. + One approach would be to add a global variable maintaining a + approximation to the exact value. An updater would increment its + per-thread variable, and when its value reaches predefined limit, + atomically add the value to the global variable, then zero its + per-thread variable. Readers simply return the value of global variable, + enjoying reasonable performance. This would permit a tradeoff between + average increment overhead and accuracy of the value read out. The reader is encouraged to think up and try out other approaches, for example, using a combining tree. -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Update Answer to Quick Quiz 5.27 2017-05-09 8:48 [PATCH] Update Answer to Quick Quiz 5.27 Junchang Wang @ 2017-05-09 14:56 ` Akira Yokosawa 2017-05-09 15:21 ` Junchang Wang 0 siblings, 1 reply; 7+ messages in thread From: Akira Yokosawa @ 2017-05-09 14:56 UTC (permalink / raw) To: Junchang Wang; +Cc: perfbook, Paul E. McKenney, Akira Yokosawa On 2017/05/09 16:48:12 +0800, Junchang Wang wrote: > Oops. Forgot the summary in previous email. Resend the patch. > > > The Answer to Quick Quiz 5.27 is a bit hard to follow. Rewrite it. > > Signed-off-by: Junchang Wang <junchangwang@gmail.com> > --- > count/count.tex | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/count/count.tex b/count/count.tex > index cc47554..6dfc7a6 100644 > --- a/count/count.tex > +++ b/count/count.tex > @@ -1258,13 +1258,13 @@ machine. > fast and scalable while allowing readers to also enjoy > reasonable performance and scalability? > \QuickQuizAnswer{ > - One approach would be to maintain a global approximation > - to the value. > - Readers would increment their per-thread variable, but when it > - reached some predefined limit, atomically add it to a global > - variable, then zero their per-thread variable. > - This would permit a tradeoff between average increment overhead > - and accuracy of the value read out. > + One approach would be to add a global variable maintaining a > + approximation to the exact value. An updater would increment its > + per-thread variable, and when its value reaches predefined limit, > + atomically add the value to the global variable, then zero its > + per-thread variable. Readers simply return the value of global variable, > + enjoying reasonable performance. This would permit a tradeoff between > + average increment overhead and accuracy of the value read out. > > The reader is encouraged to think up and try out other approaches, > for example, using a combining tree. > Hi Junchang, What confused you seems to be a simple typo. Isn't the following one-liner sufficient for you? Thanks, Akira --8<---->8-- From 725b32938e0cbc245e5a528fd475951bb8be1de5 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa <akiyks@gmail.com> Date: Tue, 9 May 2017 23:39:57 +0900 Subject: [PATCH] count: Fix typo in Answer to Quick Quiz 5.27 Reported-by: Junchang Wang <junchangwang@gmail.com> Signed-off-by: Akira Yokosawa <akiyks@gmail.com> --- count/count.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/count/count.tex b/count/count.tex index cc47554..096b53d 100644 --- a/count/count.tex +++ b/count/count.tex @@ -1260,7 +1260,7 @@ machine. \QuickQuizAnswer{ One approach would be to maintain a global approximation to the value. - Readers would increment their per-thread variable, but when it + Updaters would increment their per-thread variable, but when it reached some predefined limit, atomically add it to a global variable, then zero their per-thread variable. This would permit a tradeoff between average increment overhead -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Update Answer to Quick Quiz 5.27 2017-05-09 14:56 ` Akira Yokosawa @ 2017-05-09 15:21 ` Junchang Wang 2017-05-09 22:38 ` Akira Yokosawa 0 siblings, 1 reply; 7+ messages in thread From: Junchang Wang @ 2017-05-09 15:21 UTC (permalink / raw) To: Akira Yokosawa; +Cc: perfbook, Paul E. McKenney Hi Akira, That's the major point. Fair enough :-) Thanks, --Jason On Tue, May 9, 2017 at 10:56 PM, Akira Yokosawa <akiyks@gmail.com> wrote: > On 2017/05/09 16:48:12 +0800, Junchang Wang wrote: >> Oops. Forgot the summary in previous email. Resend the patch. >> >> >> The Answer to Quick Quiz 5.27 is a bit hard to follow. Rewrite it. >> >> Signed-off-by: Junchang Wang <junchangwang@gmail.com> >> --- >> count/count.tex | 14 +++++++------- >> 1 file changed, 7 insertions(+), 7 deletions(-) >> >> diff --git a/count/count.tex b/count/count.tex >> index cc47554..6dfc7a6 100644 >> --- a/count/count.tex >> +++ b/count/count.tex >> @@ -1258,13 +1258,13 @@ machine. >> fast and scalable while allowing readers to also enjoy >> reasonable performance and scalability? >> \QuickQuizAnswer{ >> - One approach would be to maintain a global approximation >> - to the value. >> - Readers would increment their per-thread variable, but when it >> - reached some predefined limit, atomically add it to a global >> - variable, then zero their per-thread variable. >> - This would permit a tradeoff between average increment overhead >> - and accuracy of the value read out. >> + One approach would be to add a global variable maintaining a >> + approximation to the exact value. An updater would increment its >> + per-thread variable, and when its value reaches predefined limit, >> + atomically add the value to the global variable, then zero its >> + per-thread variable. Readers simply return the value of global variable, >> + enjoying reasonable performance. This would permit a tradeoff between >> + average increment overhead and accuracy of the value read out. >> >> The reader is encouraged to think up and try out other approaches, >> for example, using a combining tree. >> > > Hi Junchang, > > What confused you seems to be a simple typo. > Isn't the following one-liner sufficient for you? > > Thanks, Akira > > --8<---->8-- > From 725b32938e0cbc245e5a528fd475951bb8be1de5 Mon Sep 17 00:00:00 2001 > From: Akira Yokosawa <akiyks@gmail.com> > Date: Tue, 9 May 2017 23:39:57 +0900 > Subject: [PATCH] count: Fix typo in Answer to Quick Quiz 5.27 > > Reported-by: Junchang Wang <junchangwang@gmail.com> > Signed-off-by: Akira Yokosawa <akiyks@gmail.com> > --- > count/count.tex | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/count/count.tex b/count/count.tex > index cc47554..096b53d 100644 > --- a/count/count.tex > +++ b/count/count.tex > @@ -1260,7 +1260,7 @@ machine. > \QuickQuizAnswer{ > One approach would be to maintain a global approximation > to the value. > - Readers would increment their per-thread variable, but when it > + Updaters would increment their per-thread variable, but when it > reached some predefined limit, atomically add it to a global > variable, then zero their per-thread variable. > This would permit a tradeoff between average increment overhead > -- > 2.7.4 > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Update Answer to Quick Quiz 5.27 2017-05-09 15:21 ` Junchang Wang @ 2017-05-09 22:38 ` Akira Yokosawa 2017-05-09 23:05 ` Junchang Wang 0 siblings, 1 reply; 7+ messages in thread From: Akira Yokosawa @ 2017-05-09 22:38 UTC (permalink / raw) To: Junchang Wang; +Cc: perfbook, Paul E. McKenney, Akira Yokosawa On 2017/05/09 23:21:33 +0800, Junchang Wang wrote: > Hi Akira, > > That's the major point. Fair enough :-) > So, are you OK with me submitting the patch with your Acked-by? Thanks, Akira > > Thanks, > --Jason > > > On Tue, May 9, 2017 at 10:56 PM, Akira Yokosawa <akiyks@gmail.com> wrote: >> On 2017/05/09 16:48:12 +0800, Junchang Wang wrote: >>> Oops. Forgot the summary in previous email. Resend the patch. >>> >>> >>> The Answer to Quick Quiz 5.27 is a bit hard to follow. Rewrite it. >>> >>> Signed-off-by: Junchang Wang <junchangwang@gmail.com> >>> --- >>> count/count.tex | 14 +++++++------- >>> 1 file changed, 7 insertions(+), 7 deletions(-) >>> >>> diff --git a/count/count.tex b/count/count.tex >>> index cc47554..6dfc7a6 100644 >>> --- a/count/count.tex >>> +++ b/count/count.tex >>> @@ -1258,13 +1258,13 @@ machine. >>> fast and scalable while allowing readers to also enjoy >>> reasonable performance and scalability? >>> \QuickQuizAnswer{ >>> - One approach would be to maintain a global approximation >>> - to the value. >>> - Readers would increment their per-thread variable, but when it >>> - reached some predefined limit, atomically add it to a global >>> - variable, then zero their per-thread variable. >>> - This would permit a tradeoff between average increment overhead >>> - and accuracy of the value read out. >>> + One approach would be to add a global variable maintaining a >>> + approximation to the exact value. An updater would increment its >>> + per-thread variable, and when its value reaches predefined limit, >>> + atomically add the value to the global variable, then zero its >>> + per-thread variable. Readers simply return the value of global variable, >>> + enjoying reasonable performance. This would permit a tradeoff between >>> + average increment overhead and accuracy of the value read out. >>> >>> The reader is encouraged to think up and try out other approaches, >>> for example, using a combining tree. >>> >> >> Hi Junchang, >> >> What confused you seems to be a simple typo. >> Isn't the following one-liner sufficient for you? >> >> Thanks, Akira >> >> --8<---->8-- >> From 725b32938e0cbc245e5a528fd475951bb8be1de5 Mon Sep 17 00:00:00 2001 >> From: Akira Yokosawa <akiyks@gmail.com> >> Date: Tue, 9 May 2017 23:39:57 +0900 >> Subject: [PATCH] count: Fix typo in Answer to Quick Quiz 5.27 >> >> Reported-by: Junchang Wang <junchangwang@gmail.com> >> Signed-off-by: Akira Yokosawa <akiyks@gmail.com> >> --- >> count/count.tex | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/count/count.tex b/count/count.tex >> index cc47554..096b53d 100644 >> --- a/count/count.tex >> +++ b/count/count.tex >> @@ -1260,7 +1260,7 @@ machine. >> \QuickQuizAnswer{ >> One approach would be to maintain a global approximation >> to the value. >> - Readers would increment their per-thread variable, but when it >> + Updaters would increment their per-thread variable, but when it >> reached some predefined limit, atomically add it to a global >> variable, then zero their per-thread variable. >> This would permit a tradeoff between average increment overhead >> -- >> 2.7.4 >> >> > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Update Answer to Quick Quiz 5.27 2017-05-09 22:38 ` Akira Yokosawa @ 2017-05-09 23:05 ` Junchang Wang 2017-05-11 0:47 ` [PATCH] count: Fix typo in " Akira Yokosawa 0 siblings, 1 reply; 7+ messages in thread From: Junchang Wang @ 2017-05-09 23:05 UTC (permalink / raw) To: Akira Yokosawa; +Cc: perfbook, Paul E. McKenney Hi Akira, Sure. Please go ahead. Thanks a lot. --Jason On Wed, May 10, 2017 at 6:38 AM, Akira Yokosawa <akiyks@gmail.com> wrote: > On 2017/05/09 23:21:33 +0800, Junchang Wang wrote: >> Hi Akira, >> >> That's the major point. Fair enough :-) >> > > So, are you OK with me submitting the patch with your Acked-by? > > Thanks, Akira >> >> Thanks, >> --Jason >> >> >> On Tue, May 9, 2017 at 10:56 PM, Akira Yokosawa <akiyks@gmail.com> wrote: >>> On 2017/05/09 16:48:12 +0800, Junchang Wang wrote: >>>> Oops. Forgot the summary in previous email. Resend the patch. >>>> >>>> >>>> The Answer to Quick Quiz 5.27 is a bit hard to follow. Rewrite it. >>>> >>>> Signed-off-by: Junchang Wang <junchangwang@gmail.com> >>>> --- >>>> count/count.tex | 14 +++++++------- >>>> 1 file changed, 7 insertions(+), 7 deletions(-) >>>> >>>> diff --git a/count/count.tex b/count/count.tex >>>> index cc47554..6dfc7a6 100644 >>>> --- a/count/count.tex >>>> +++ b/count/count.tex >>>> @@ -1258,13 +1258,13 @@ machine. >>>> fast and scalable while allowing readers to also enjoy >>>> reasonable performance and scalability? >>>> \QuickQuizAnswer{ >>>> - One approach would be to maintain a global approximation >>>> - to the value. >>>> - Readers would increment their per-thread variable, but when it >>>> - reached some predefined limit, atomically add it to a global >>>> - variable, then zero their per-thread variable. >>>> - This would permit a tradeoff between average increment overhead >>>> - and accuracy of the value read out. >>>> + One approach would be to add a global variable maintaining a >>>> + approximation to the exact value. An updater would increment its >>>> + per-thread variable, and when its value reaches predefined limit, >>>> + atomically add the value to the global variable, then zero its >>>> + per-thread variable. Readers simply return the value of global variable, >>>> + enjoying reasonable performance. This would permit a tradeoff between >>>> + average increment overhead and accuracy of the value read out. >>>> >>>> The reader is encouraged to think up and try out other approaches, >>>> for example, using a combining tree. >>>> >>> >>> Hi Junchang, >>> >>> What confused you seems to be a simple typo. >>> Isn't the following one-liner sufficient for you? >>> >>> Thanks, Akira >>> >>> --8<---->8-- >>> From 725b32938e0cbc245e5a528fd475951bb8be1de5 Mon Sep 17 00:00:00 2001 >>> From: Akira Yokosawa <akiyks@gmail.com> >>> Date: Tue, 9 May 2017 23:39:57 +0900 >>> Subject: [PATCH] count: Fix typo in Answer to Quick Quiz 5.27 >>> >>> Reported-by: Junchang Wang <junchangwang@gmail.com> >>> Signed-off-by: Akira Yokosawa <akiyks@gmail.com> >>> --- >>> count/count.tex | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/count/count.tex b/count/count.tex >>> index cc47554..096b53d 100644 >>> --- a/count/count.tex >>> +++ b/count/count.tex >>> @@ -1260,7 +1260,7 @@ machine. >>> \QuickQuizAnswer{ >>> One approach would be to maintain a global approximation >>> to the value. >>> - Readers would increment their per-thread variable, but when it >>> + Updaters would increment their per-thread variable, but when it >>> reached some predefined limit, atomically add it to a global >>> variable, then zero their per-thread variable. >>> This would permit a tradeoff between average increment overhead >>> -- >>> 2.7.4 >>> >>> >> > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] count: Fix typo in Answer to Quick Quiz 5.27 2017-05-09 23:05 ` Junchang Wang @ 2017-05-11 0:47 ` Akira Yokosawa 2017-05-11 3:15 ` Paul E. McKenney 0 siblings, 1 reply; 7+ messages in thread From: Akira Yokosawa @ 2017-05-11 0:47 UTC (permalink / raw) To: Paul E. McKenney; +Cc: Junchang Wang, perfbook, Akira Yokosawa From 557aa593d97bf2b8cc47ff14fbcaf3f80703866a Mon Sep 17 00:00:00 2001 From: Akira Yokosawa <akiyks@gmail.com> Date: Tue, 9 May 2017 23:39:57 +0900 Subject: [PATCH] count: Fix typo in Answer to Quick Quiz 5.27 Reported-by: Junchang Wang <junchangwang@gmail.com> Signed-off-by: Akira Yokosawa <akiyks@gmail.com> Acked-by: Junchang Wang <junchangwang@gmail.com> --- count/count.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/count/count.tex b/count/count.tex index cc47554..096b53d 100644 --- a/count/count.tex +++ b/count/count.tex @@ -1260,7 +1260,7 @@ machine. \QuickQuizAnswer{ One approach would be to maintain a global approximation to the value. - Readers would increment their per-thread variable, but when it + Updaters would increment their per-thread variable, but when it reached some predefined limit, atomically add it to a global variable, then zero their per-thread variable. This would permit a tradeoff between average increment overhead -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] count: Fix typo in Answer to Quick Quiz 5.27 2017-05-11 0:47 ` [PATCH] count: Fix typo in " Akira Yokosawa @ 2017-05-11 3:15 ` Paul E. McKenney 0 siblings, 0 replies; 7+ messages in thread From: Paul E. McKenney @ 2017-05-11 3:15 UTC (permalink / raw) To: Akira Yokosawa; +Cc: Junchang Wang, perfbook On Thu, May 11, 2017 at 09:47:58AM +0900, Akira Yokosawa wrote: > >From 557aa593d97bf2b8cc47ff14fbcaf3f80703866a Mon Sep 17 00:00:00 2001 > From: Akira Yokosawa <akiyks@gmail.com> > Date: Tue, 9 May 2017 23:39:57 +0900 > Subject: [PATCH] count: Fix typo in Answer to Quick Quiz 5.27 > > Reported-by: Junchang Wang <junchangwang@gmail.com> > Signed-off-by: Akira Yokosawa <akiyks@gmail.com> > Acked-by: Junchang Wang <junchangwang@gmail.com> Queued and pushed, thank you both! Thanx, Paul > --- > count/count.tex | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/count/count.tex b/count/count.tex > index cc47554..096b53d 100644 > --- a/count/count.tex > +++ b/count/count.tex > @@ -1260,7 +1260,7 @@ machine. > \QuickQuizAnswer{ > One approach would be to maintain a global approximation > to the value. > - Readers would increment their per-thread variable, but when it > + Updaters would increment their per-thread variable, but when it > reached some predefined limit, atomically add it to a global > variable, then zero their per-thread variable. > This would permit a tradeoff between average increment overhead > -- > 2.7.4 > > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-05-11 3:15 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-09 8:48 [PATCH] Update Answer to Quick Quiz 5.27 Junchang Wang 2017-05-09 14:56 ` Akira Yokosawa 2017-05-09 15:21 ` Junchang Wang 2017-05-09 22:38 ` Akira Yokosawa 2017-05-09 23:05 ` Junchang Wang 2017-05-11 0:47 ` [PATCH] count: Fix typo in " Akira Yokosawa 2017-05-11 3:15 ` Paul E. McKenney
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.