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


Groups > comp.lang.c > #65195

Re: thread-safe random numbers...

From "Chris M. Thomasson" <nospam@nospam.nospam>
Newsgroups comp.lang.c
Subject Re: thread-safe random numbers...
Date 2015-07-10 14:23 -0700
Organization Aioe.org NNTP Server
Message-ID <mnpd54$a7m$1@speranza.aioe.org> (permalink)
References <mk61l9$ap4$1@speranza.aioe.org> <5b63a727-afb4-42c2-93d6-844989aa7e58@googlegroups.com> <mnpbbs$67h$1@speranza.aioe.org> <1970f801-752a-415f-935e-0a12e39eaff5@googlegroups.com>

Show all headers | View raw


> "Rick C. Hodgin"  wrote in message news:1970f801-752a-415f-935e-> > 
> 0a12e39eaff5@googlegroups.com...

> > On Friday, July 10, 2015 at 4:53:28 PM UTC-4, Chris M. Thomasson wrote:
[...]
> > Why not create an instance of PRNG on a per-thread basis? I
> > want to try and avoid threads fighting over shared location(s)
> > as much as possible. A semaphore would work fine, however, the
> > overheads would be way too much for some of my applications
> > Rick.

> That would work.  You'd have to bear in mind that the random numbers
> in use would be re-used in each thread (unless possibly you seeded
> them differently, or used different algorithms in each).

:^)

You read my mind wrt trying to use different PRNG algorithms
in each thread. There could be a "pool of algorithms" that
threads choose from. After they make the choice they seed the
selected PRNG and use it. Just a very simple idea.

All of this functionality wrt choosing an algorithm and seeding
it can be accomplished during the "constructor" of a thread's
specific storage. tss_t in C11.

This has to scale MUCH better than using mutual exclusion...

FWIW, I actually have to use the emulation layer for C11 pretty
soon because my fractal cypher algorithm happens to be
embarrassingly parallel in nature...

;^)
make the choice they seed the selected PRNG and use it. 

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-05-27 20:22 -0700
  Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-05-28 11:11 -0700
  Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-05-28 11:19 -0700
    Re: thread-safe random numbers... Rosario19 <Ros@invalid.invalid> - 2015-05-29 07:28 +0200
  Re: thread-safe random numbers... James Kuyper <jameskuyper@verizon.net> - 2015-05-28 14:22 -0400
    Re: thread-safe random numbers... Keith Thompson <kst-u@mib.org> - 2015-05-28 12:38 -0700
      Re: thread-safe random numbers... James Kuyper <jameskuyper@verizon.net> - 2015-05-28 16:42 -0400
      Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-05-28 13:57 -0700
      Re: thread-safe random numbers... Nobody <nobody@nowhere.invalid> - 2015-05-29 22:42 +0100
  Re: thread-safe random numbers... Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-10 11:56 -0700
    Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 14:03 -0700
      Re: thread-safe random numbers... Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-11 13:44 -0700
  Re: thread-safe random numbers... "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-07-10 12:01 -0700
    Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 13:53 -0700
      Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 13:58 -0700
      Re: thread-safe random numbers... "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-07-10 14:04 -0700
        Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 14:23 -0700
          Re: thread-safe random numbers... Keith Thompson <kst-u@mib.org> - 2015-07-10 17:12 -0700
            Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 18:58 -0700
      Re: thread-safe random numbers... Rosario19 <Ros@invalid.invalid> - 2015-07-11 11:13 +0200

csiph-web