use sleeping threads

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: use sleeping threads?

Post by hgm »

Note that if you let the spinning thread do some long-latency operation that stalls it in the CPU it will hardly consume any resources at all, while the delay to release it from spinning can still be orders of magnitude smaller than when you need OS interference to restart it. You could for instance include a floating divide in the spinning loop. As the divide unit is not pipelined, and a divide takes dozens of clock cycles, the HT would be stalled waiting for the divide unit to become available again. And as none of the working threads would ever need the divide unit, it is basically like the core is unloaded.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: use sleeping threads

Post by michiguel »

Matthias Gemuh wrote:
michiguel wrote:...
"threads type" = spinning/sleeping
...
Miguel
... or
"Idle Threads" = spinning/sleeping.
Good suggestion. Better now to match the grammar:

"Idle Threads" = spin/sleep

Gee... after Ray's post I realized the ambiguity of "use sleeping threads" (I was blind!), so yes, it should be changed.

Miguel
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: use sleeping threads?

Post by syzygy »

Matthias Gemuh wrote:
syzygy wrote:"Use Sleeping Threads" refers to what a thread does when it is waiting for work. If set to true, the thread sleeps. If set to false, the thread spins.

... .
"Use" is the wrong verb if you want something to sleep.
"Let Threads Sleep" is better terminology if "true" makes threads sleep.
The engine uses threads that sleep when they are idle. I don't see much of a problem with "Use Sleeping Threads". Let threads sleep seems at least as confusing.

If there is any problem, it is that users have no idea that it refers to the behaviour of threads when they are idle. If this is to be solved, the option should mention "idle". "Let Idle Thread Sleep" might be OK. But the problem remains that users still won't know what this means... Any non-programmer here that knows what a spinlock is?
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: use sleeping threads

Post by Don »

Many of these suggestions assume that you have some default context and really is quite confusing.

Miguels suggestion here is the best in my opinion because it is explicit. There would be no ambiguity with "Idle Threads" = spin/sleep

Don

michiguel wrote:
Matthias Gemuh wrote:
michiguel wrote:...
"threads type" = spinning/sleeping
...
Miguel
... or
"Idle Threads" = spinning/sleeping.
Good suggestion. Better now to match the grammar:

"Idle Threads" = spin/sleep

Gee... after Ray's post I realized the ambiguity of "use sleeping threads" (I was blind!), so yes, it should be changed.

Miguel
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
shrapnel
Posts: 1339
Joined: Fri Nov 02, 2012 9:43 am
Location: New Delhi, India

Re: use sleeping threads

Post by shrapnel »

mcostalba wrote:
zullil wrote:
mcostalba wrote:
could I ask to please suggest a better name for the option ?
Please see http://talkchess.com/forum/viewtopic.ph ... 56&t=48612
hmmm I am not sure this is better.

I'd prefer simply "sleeping threads" without 'use', in the same way of 'pondering' or 'infinite analysis'....but I'm curious to see what kind of suggestion comes out from the guy from Oxfordshire here above.
Try 'uso que duerme hilos' :lol: :lol: :lol:
Stick to Programming Marco boy. You could use your native language for your Notes...using Google Translator would be less painful than reading your notes in English :lol:
i7 5960X @ 4.1 Ghz, 64 GB G.Skill RipJaws RAM, Twin Asus ROG Strix OC 11 GB Geforce 2080 Tis
kgburcham
Posts: 2016
Joined: Sun Feb 17, 2008 4:19 pm

Re: use sleeping threads?

Post by kgburcham »

Any non-programmer here that knows what a spinlock is?
here is an example of a spinlock.
Watch the right front impact wrench, happens quick.

http://www.youtube.com/watch?v=NVJ-gXhscwc

Peterson's algorithm,
kgburcham
Modern Times
Posts: 3546
Joined: Thu Jun 07, 2012 11:02 pm

Re: use sleeping threads

Post by Modern Times »

Don wrote: Miguels suggestion here is the best in my opinion because it is explicit. There would be no ambiguity with "Idle Threads" = spin/sleep
Yes, this is perfectly clear.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: use sleeping threads

Post by mcostalba »

shrapnel wrote: Stick to Programming Marco boy. You could use your native language for your Notes...using Google Translator would be less painful than reading your notes in English :lol:
I stick to what I want, I feel free to use my time as I wish, even wasting it to answer to a moron, if this is what I like to do.

Anyhow you have not suggested a better wording, it seems. As usual, the ones that are more critical are also the ones less titled to do so. But this is not a news for me. I experience it everyday.

Because it seems you like to google for transaltion, translate this: "La madre degli imbecilli è sempre incinta"
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: use sleeping threads

Post by mcostalba »

Don wrote: Miguels suggestion here is the best in my opinion because it is explicit. There would be no ambiguity with "Idle Threads" = spin/sleep
Yes, this is a good suggestion, unfortunately the option is of boolean kind, IOW its value can be only true/false
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: use sleeping threads

Post by Don »

mcostalba wrote:
Don wrote: Miguels suggestion here is the best in my opinion because it is explicit. There would be no ambiguity with "Idle Threads" = spin/sleep
Yes, this is a good suggestion, unfortunately the option is of boolean kind, IOW its value can be only true/false
How about then using the same basic wording but making it boolean:

Idle Threads Sleep = true/false

conversely it could also be:

Idle Threads Spin = true/false

Either one would be perfectly clear I would think.

Don
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.