Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #6335

Re: More precision about my new inventions of scalable algorithms..

From "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups comp.programming.threads, comp.lang.c++
Subject Re: More precision about my new inventions of scalable algorithms..
Date 2021-02-21 14:35 -0800
Organization Aioe.org NNTP Server
Message-ID <s0un78$f7i$1@gioia.aioe.org> (permalink)
References (6 earlier) <s0rsf4$1nos$1@gioia.aioe.org> <s0u11c$pf9$1@dont-email.me> <1rxYH.126875$gb5.90507@fx10.iad> <s0uahi$gfi$1@dont-email.me> <YPzYH.90667$4i7.33994@fx44.iad>

Cross-posted to 2 groups.

Show all headers | View raw


On 2/21/2021 12:58 PM, Richard Damon wrote:
> On 2/21/21 1:58 PM, Bonita Montero wrote:
>>> 60 People come up and submit their jobs at basically the same time.
>>> Each Job is going to take 1 minute of CPU time to run. Which of these
>>> scheduling algorithms is 'fairer'
>>> Method 1, First job in line run to completion, then the second job is
>>> run to completion, then the 3rd and so on. So the first person gets his
>>> results after a minute, next a minute later, and so on so the last gets
>>> their results 60 minutes later.
>>> Method 2, All the jobs are loaded into memory at once, and time sliced
>>> between them, each getting 1 second of time, then the next, and so on.
>>> Every job will finish at the end of the hour.
>>> Many people will label the second method as 'fairer' as everyone gets
>>> the same pain, but no one in the second example was any better off then
>>> in the first, and almost everyone worse, so by most efficiency measures
>>> it is clearly worse.
>>
>> You can't compare that to the discussed issue because there's no
>> opportunity to capture all the CPU-time by one task.
> 
> The key point isn't what resource was being managed, but how do we
> really define 'fair'. The key part about the example was that many
> people thought that the second method was fairer, because there was much
> less difference is response times to all clients, even though it was at
> the cost of making almost everyone wait longer than they needed to in
> the first. The first method has an average response time of 1/2 the
> second, and no one got worse performance. Only by a metric on variation
> in response can the second be shown to be superior, but some think that
> makes it fairer.
> 
> To define 'fairness' we need to define some metric to measure it.
> Normally we can't get 'perfect' fairness except in vary special
> conditions. Normally we define a system as 'fair' if every client can
> get some reasonable amount of the resource (even if it isn't a 'fair
> share'). Tighter definitions of 'fairness' might try to limit the
> inequities in allocation (and if the clients are identical in needs, we
> need ways to 'fairly' allocate needs to measure inequality). Generally,
> attempts to make a system 'fairer' can often impact the efficiency of
> the system. In my example, to reduce the variance in the wait times, the
> average wait time doubled, and perhaps by increasing the number of
> context switches we might have actually increased the total time to run
> all the jobs.
> 
> My key point is that the first step is we need to define what we want to
> meet as 'fair', and then we can decide if a given strategy will meet
> that definition (and maybe how well).
> 
> Thus, if you want to call something 'unfair', you need to define what
> you mean by fair. It is quite possible to define a RW-lock that will see
> to it that as long as no locker fails to release its lock in a
> reasonable time period, all requests WILL get met eventually. It just
> requires that at some point after a write request gets queue, the system
> stops granting new read requests (so the writer will get eventually get
> in when all current readers end), and that a somewhat fair method (like
> oldest) is used for granting requests when the system is free. Yes,
> perhaps the simplest RW-lock will not be able to do this, but then the
> issue isn't about RW-locks in general, but that style of
> implementations. IF you are using some other definition of 'fair', you
> need to define it.
> 

I agree. Fwiw, my rwmutex does not allow readers to starve out writers 
and vise versa. So, if a writer requests the lock while there are a shit 
load of concurrent readers, it will wait until all of the readers in the 
current "batch" are completed and will automatically own the lock for 
write access after that. If a batch of readers come in while the writer 
is doing its thing, they will be released all at once and automatically 
own reader access once the writer is finished. This way, readers cannot 
stave out writers and vise versa. Now, if one does not desire that type 
of alternating, basically a classic bakery algorihtm like behavior, then 
do NOT use my rwmutex.

https://vorbrodt.blog/2019/02/14/read-write-mutex

I like how he gave me proper credit. Nice. :^)

Actually, my rwmutex is pretty short and sweet with no loops.

Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

More precision about my new inventions of scalable algorithms.. Amine Moulay Ramdane <aminer68@gmail.com> - 2021-02-18 11:07 -0800
  Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-19 23:27 +0100
    Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-19 14:48 -0800
      Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-20 00:01 +0100
        Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-19 15:17 -0800
          Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-20 08:50 +0100
            Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-20 12:46 -0800
              Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-20 12:52 -0800
              Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-21 17:16 +0100
                Re: More precision about my new inventions of scalable algorithms.. Richard Damon <Richard@Damon-Family.org> - 2021-02-21 13:15 -0500
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-21 19:58 +0100
                Re: More precision about my new inventions of scalable algorithms.. Richard Damon <Richard@Damon-Family.org> - 2021-02-21 15:58 -0500
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-21 14:35 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-22 06:54 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-21 22:00 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-22 07:40 +0100
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-22 09:20 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-22 14:54 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-23 08:38 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-23 00:25 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-23 20:17 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-23 11:29 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-24 18:20 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-25 01:49 -0800
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-23 14:13 -0800
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-23 14:14 -0800
                Re: More precision about my new inventions of scalable algorithms.. Richard Damon <Richard@Damon-Family.org> - 2021-02-23 16:51 -0500
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-24 18:22 +0100
                Re: More precision about my new inventions of scalable algorithms.. Richard Damon <Richard@Damon-Family.org> - 2021-02-24 13:28 -0500
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-24 17:16 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-25 07:08 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-24 23:39 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-25 09:49 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-25 01:05 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-25 11:43 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-25 03:09 -0800
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-25 03:10 -0800
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-24 23:43 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-22 06:52 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-21 22:10 -0800
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-21 21:47 -0800
                Re: More precision about my new inventions of scalable algorithms.. Bonita Montero <Bonita.Montero@gmail.com> - 2021-02-22 06:51 +0100
                Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-21 22:01 -0800
        Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-19 15:32 -0800
          Re: More precision about my new inventions of scalable algorithms.. "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-19 15:37 -0800
      Re: More precision about my new inventions of scalable algorithms.. Amine Moulay Ramdane <aminer68@gmail.com> - 2021-02-19 15:14 -0800

csiph-web