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


Groups > comp.lang.c > #138925

Re: Multithreading

From "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>
Newsgroups comp.lang.c
Subject Re: Multithreading
Date 2018-12-22 16:10 -0800
Organization n/a
Message-ID <pvmjpd$gap$2@dont-email.me> (permalink)
References (1 earlier) <slrnq1g86m.1p1h.grahn+nntp@frailea.sa.invalid> <5c1a999a.911828906@news.xmission.com> <slrnq1lkbj.1p1h.grahn+nntp@frailea.sa.invalid> <5c1e08e6.1136929031@news.xmission.com> <BBwTD.167981$_35.159996@fx46.iad>

Show all headers | View raw


On 12/22/2018 11:52 AM, Scott Lurndal wrote:
> nobody@example.org (Scott) writes:
>> On 19 Dec 2018 23:17:07 GMT, Jorgen Grahn <grahn+nntp@snipabacken.se>
>> wrote:
> 
>> What I'm running into now is irritating. I added the thread management
>> bits, it works, it produces correct results, but the performance is
>> perverse - the more threads I run, the slower it gets. Based on clues
>> popping up while chasing other bugs, am I right in thinking that
>> multiple threads calling malloc and friends could be a source of pain?
>> If so, I think I have a remedy for that. If not...well, I'll be stuck
>> looking for some other excuse.
>>
> 
> It generally doesn't make sense to have more _active_[*] threads than
> cores/hardware threads.
> 
> Certainly malloc/free must be thread-safe, which implies some level
> of serialization of those calls - which for performance reasons, one
> should disfavor.   Pool based allocators (using atomics to manage the
> lookaside list) may be less expensive, but you'll still be contending
> for the cache lines that hold the pool metadata; for that reason, per-thread
> pool allocators may be more efficent.
> 
> Best case, you allocate everything you need up front.

Hard to disagree with that! :^)

> 
> [*] e.g. cpu-bound activities with little or no I/O
> 

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


Thread

Multithreading nobody@example.org (Scott) - 2018-12-16 21:48 +0000
  Re: Multithreading Joey Pabalinas <joeypabalinas@gmail.com> - 2018-12-16 17:11 -1000
  Re: Multithreading rbowman <bowman@montana.com> - 2018-12-16 21:00 -0700
  Re: Multithreading Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-12-17 22:19 +0000
    Re: Multithreading Joey Pabalinas <joeypabalinas@gmail.com> - 2018-12-17 12:45 -1000
    Re: Multithreading nobody@example.org (Scott) - 2018-12-19 19:48 +0000
      Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-19 11:58 -0800
      Re: Multithreading Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-12-19 23:17 +0000
        Re: Multithreading "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-19 15:31 -0800
          Re: Multithreading "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-19 15:34 -0800
        Re: Multithreading nobody@example.org (Scott) - 2018-12-22 10:43 +0000
          Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-22 03:41 -0800
            Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-22 03:46 -0800
          Re: Multithreading Thiago Adams <thiago.adams@gmail.com> - 2018-12-22 07:14 -0800
          Re: Multithreading rbowman <bowman@montana.com> - 2018-12-22 11:41 -0700
            Re: Multithreading "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-22 16:09 -0800
          Re: Multithreading scott@slp53.sl.home (Scott Lurndal) - 2018-12-22 19:52 +0000
            Re: Multithreading "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-22 16:10 -0800
            Re: Multithreading nobody@example.org (Scott) - 2018-12-23 23:11 +0000
              Re: Multithreading "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-23 15:24 -0800
                Re: Multithreading "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-23 15:25 -0800
                Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-24 02:05 -0800
              Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-24 02:08 -0800
  Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-18 07:18 -0800
    Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-18 07:51 -0800
      Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-19 09:24 -0800
        Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-19 09:55 -0800
          Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-19 11:02 -0800
            Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-19 11:16 -0800
              Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-19 11:25 -0800
          Re: Multithreading "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-19 15:37 -0800
            Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-19 16:03 -0800
              Re: Multithreading fir <profesor.fir@gmail.com> - 2018-12-20 08:02 -0800

csiph-web