🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17501

Re: Tweaking threads

#17501
From: Remy Lebeau (TeamB)
Date: Wed, 12 Mar 2003 21:17
39 lines
2553 bytes
"Dennis Jones" <djones@nospam.com> wrote in message
news:3e6f8ce5$1@newsgroups.borland.com...

> Of course, only one thread at a time is actually executing at
> any given moment (one thread per processor).

Yup.  As such, threads do need to periodically yield their time slices to
other threads/processes in order to keep things rolling smoothly.

> It is also possible that having too many (active) threads can have
> potentially devestating effects on performance due to the
> overhead required to perform a context switch.

Potentially, though I don't really run across that problem very often.

I've also been hearing more leately about fibers, which allow multiple tasks
to be performed by a single thread, and the thread manually controls the
context switching between them instead of the OS.

> I seem to recall reading something once which talked about the
> optimum number of simultaneous threads per processor being
> somewhere around 3 or 4.

Yuk, way too small for today's applications.

> more than that, and your process actually begins to slow
> down (if all of the threads are active at the same time)
> because of context switching.

That can be a matter of debate.  For example, my company's software can
potentially run upwards of at least 100 threads at any given time (depending
on the size of the hardware system it is running on and managing).  Every
thread in of itself is critical, monitoring individual hardware pieces in
real-time, and we haven't notice any significant slowdowns from context
switching between them.


Gambit
Technical Details
Message-ID: <3e6fa1a8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e6deb3f@newsgroups.borland.com> <3e6e2fb9@newsgroups.borland.com> <3e6f8ce5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,47731b28ebfc1a3
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-12 20:14:33 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e6deb3f@newsgroups.borland.com> <3e6e2fb9@newsgroups.borland.com> <3e6f8ce5$1@newsgroups.borland.com>
Subject: Re: Tweaking threads
Date: Wed, 12 Mar 2003 13:17:02 -0800
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e6fa1a8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1047503272 207.175.226.26 (12 Mar 2003 13:07:52 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail