flat assembler
Message board for the users of flat assembler.

Index > Windows > XP scheduler is broken

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
sinsi



Joined: 10 Aug 2007
Posts: 707
Location: Adelaide
sinsi
Here's a bit of a laugh - the output from a quad core. This is from the second time the exe was run (the first time figures were a bit more realistic for 4+ threads)
Code:
Total threads: 1
Thread: 0, 100%

Total threads: 2
Thread: 0, 159%
Thread: 1, 159%

Total threads: 3
Thread: 0, 473%
Thread: 1, 473%
Thread: 2, 472%

Total threads: 4
Thread: 0, 1442%
Thread: 1, 1442%
Thread: 2, 1442%
Thread: 3, 1441%

Total threads: 5
Thread: 0, 1451%
Thread: 1, 2036%
Thread: 2, 1916%
Thread: 3, 2166%
Thread: 4, 1555%

Total threads: 6
Thread: 0, 1300%
Thread: 1, 1340%
Thread: 2, 1791%
Thread: 3, 1976%
Thread: 4, 1346%
Thread: 5, 1321%

Total threads: 7
Thread: 0, 3202%
Thread: 1, 3011%
Thread: 2, 2785%
Thread: 3, 4521%
Thread: 4, 3064%
Thread: 5, 3167%
Thread: 6, 3223%

Total threads: 8
Thread: 0, 1141%
Thread: 1, 1135%
Thread: 2, 1093%
Thread: 3, 1113%
Thread: 4, 1118%
Thread: 5, 1118%
Thread: 6, 1117%
Thread: 7, 1132%
    
Post 23 Feb 2008, 00:57
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17660
Location: In your JS exploiting you and your system
revolution
I think the counter overflowed. Your PC is too fast sinsi. Either buy a slower PC, or change the timer from 10000ms to something smaller like 2500ms.
Post 23 Feb 2008, 04:41
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 707
Location: Adelaide
sinsi
Quote:
Your PC is too fast sinsi.
At last (although that's like saying my penis is too long - never too fast or too long Laughing )
Quote:
change the timer from 10000ms to something smaller like 2500ms.

I assume you mean the Sleep call?

Code:
Total threads: 1
Thread: 0, 100%

Total threads: 2
Thread: 0,  49%
Thread: 1,  50%

Total threads: 3
Thread: 0,  33%
Thread: 1,  33%
Thread: 2,  33%

Total threads: 4
Thread: 0,  24%
Thread: 1,  25%
Thread: 2,  25%
Thread: 3,  25%

Total threads: 5
Thread: 0,  11%
Thread: 1,  24%
Thread: 2,  22%
Thread: 3,  24%
Thread: 4,  16%

Total threads: 6
Thread: 0,  11%
Thread: 1,  13%
Thread: 2,  22%
Thread: 3,  23%
Thread: 4,  14%
Thread: 5,  14%

Total threads: 7
Thread: 0,  12%
Thread: 1,  13%
Thread: 2,  12%
Thread: 3,  23%
Thread: 4,  13%
Thread: 5,  12%
Thread: 6,  12%

Total threads: 8
Thread: 0,  12%
Thread: 1,  13%
Thread: 2,  11%
Thread: 3,  12%
Thread: 4,  12%
Thread: 5,  12%
Thread: 6,  10%
Thread: 7,  14%
    


I would rather have my other reading - oh well Smile
Post 23 Feb 2008, 05:21
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17660
Location: In your JS exploiting you and your system
revolution
sinsi wrote:
although that's like saying my penis is too long
LOL, It's not the size that attracts the flies, it's ... {censored}.
Post 23 Feb 2008, 07:58
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 707
Location: Adelaide
sinsi
I've snorted (back-and-forth) milk through my nose involuntarily, but beer brings tears to the eyes - hah hah hah.
Post 23 Feb 2008, 08:06
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
revolution wrote:
The cache thing is a red-herring anyway, and is independent of the scheduling algo. I just mentioned because Plue was concerned about it. But it shows the worst case scenario is no worse than the current scenario as far as cache performance.
Remember that some multicore CPUs have per-core cache, and others have shared cache. With per-core caches, if a thread gets re-scheduled to another core, isn't that equivalent to a complete cache flush?

The NT scheduling algo isn't super for everything... it seems to try to load balance across all cores, which in my mind is pretty silly when you have a single cpu-intensive thread; you get sub-optimal cache use on AMD multi-core systems, and the additional cores are kept (slightly) busy instead of going to a lower power-consumption state.

Btw., have you tried setting Processor Scheduling to "Background Services" instead of "Programs"? Dunno if it does anything for your case, only adjusts the quantum lengths iirc... but worth a shot.
Post 23 Feb 2008, 20:37
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17660
Location: In your JS exploiting you and your system
revolution
f0dder wrote:
revolution wrote:
The cache thing is a red-herring anyway, and is independent of the scheduling algo. I just mentioned because Plue was concerned about it. But it shows the worst case scenario is no worse than the current scenario as far as cache performance.
Remember that some multicore CPUs have per-core cache, and others have shared cache. With per-core caches, if a thread gets re-scheduled to another core, isn't that equivalent to a complete cache flush?
Yes, if the threads use more data/code than the cache size then you get cache misses, not flushes. But it makes no difference how the tasks are pushed to the cores, you will have to endure cache misses no matter what algo you use because there are more threads than cores.
f0dder wrote:
The NT scheduling algo isn't super for everything... it seems to try to load balance across all cores, which in my mind is pretty silly when you have a single cpu-intensive thread; you get sub-optimal cache use on AMD multi-core systems, and the additional cores are kept (slightly) busy instead of going to a lower power-consumption state.
Indeed, it appears to be very sub-optimal, but that is not really a fault of the scheduler, it can't know what the requirements of your threads are. That is a situation where you need to make good use of the affinities to force certain threads onto certain cores.
f0dder wrote:
Btw., have you tried setting Processor Scheduling to "Background Services" instead of "Programs"? Dunno if it does anything for your case, only adjusts the quantum lengths iirc... but worth a shot.
I can't do that, because it would not be appropriate for me to dictate how the users will set their machine parameters. I have to live with what the user has set.
Post 24 Feb 2008, 02:31
View user's profile Send private message Visit poster's website Reply with quote
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP
Yeah, I think that having over 880 threads running at one time (that's mine right now) is just a little too much... I guess having tons of junk on one's computer today is the standard, I mean I just bought this computer, haven't even installed anything (all files just sitting in desktop), and yet this thing is (sorry) fricken' slow!! I've got dozens of junk software installed that I didn't even ask for, the CPU is flying most of the time when I have no apps running, and stuff is being downloaded and updated every two seconds for programs that I can't even pronounce!
Post 24 Feb 2008, 04:07
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin
Quote:
I guess having tons of junk on one's computer today is the standard, I mean I just bought this computer, haven't even installed anything (all files just sitting in desktop), and yet this thing is (sorry) fricken' slow!!


Thats why its better to build one... either hand pick or buy a PC kit...
I would never buy a computer from a store or online..
"dell..hp...etc...." all the 30 day trials... and junk software they put on them..

You may save a little money with them - but if you go the other route you will have less headaches! Very Happy
Post 24 Feb 2008, 04:46
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 707
Location: Adelaide
sinsi
Quote:
880 threads

Wow, I thought mine was bad with 322.

First thing to do with a new computer preinstalled with windows is...reinstall
Post 24 Feb 2008, 06:55
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
revolution wrote:
Yes, if the threads use more data/code than the cache size then you get cache misses, not flushes. But it makes no difference how the tasks are pushed to the cores, you will have to endure cache misses no matter what algo you use because there are more threads than cores.
Ah yes, a miss not a flush... but still, means (re!)loading cache from memory, and having data duplicated and thus wasting cache. So it makes sense to try and keep threads affinity-locked to cores, imho.

AlexP: sounds like you have malware installed on your system? Smile

I have a lot of stuff running, but only hit 32 processes and 391 threads. Most of those threads are in a blocking state, so that count isn't really a problem... I'd much rather have 50 threads in a blocking wait state than 1 thread in a polling loop.
Post 24 Feb 2008, 12:47
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 707
Location: Adelaide
sinsi
f0dder wrote:
Most of those threads are in a blocking state

How can you tell?
Post 29 Feb 2008, 05:18
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17660
Location: In your JS exploiting you and your system
revolution
sinsi wrote:
f0dder wrote:
Most of those threads are in a blocking state

How can you tell?
Just look at the run time of each process, if there is no increase then all the threads are blocked.
Post 29 Feb 2008, 06:07
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
You can also use Process Explorer and look around the various processes, check the 'threads' tab and look at the "State" - most of them will be in Wait:something (typically UserRequest) state.

I dunno how Process Explorer gets the current thread state, doesn't seem to be present in the CONTEXT structure and I couldn't find any GetThread* function that seems to return the info...
Post 29 Feb 2008, 12:44
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Quad core (Phenom II) on Windows 7 64-bit:
Code:
Total threads: 1
Thread: 0, 100%

Total threads: 2
Thread: 0,  50%
Thread: 1,  49%

Total threads: 3
Thread: 0,  33%
Thread: 1,  33%
Thread: 2,  33%

Total threads: 4
Thread: 0,  24%
Thread: 1,  25%
Thread: 2,  25%
Thread: 3,  25%

Total threads: 5
Thread: 0,  21%
Thread: 1,  25%
Thread: 2,  15%
Thread: 3,  25%
Thread: 4,  12%

Total threads: 6
Thread: 0,  12%
Thread: 1,  24%
Thread: 2,  12%
Thread: 3,  24%
Thread: 4,  12%
Thread: 5,  13%

Total threads: 7
Thread: 0,  12%
Thread: 1,   8%
Thread: 2,   8%
Thread: 3,  25%
Thread: 4,  12%
Thread: 5,  24%
Thread: 6,   8%

Total threads: 8
Thread: 0,  12%
Thread: 1,   8%
Thread: 2,   8%
Thread: 3,  12%
Thread: 4,  12%
Thread: 5,  24%
Thread: 6,   8%
Thread: 7,  12%
========================
SECOND RUN
========================
Total threads: 1
Thread: 0, 100%

Total threads: 2
Thread: 0,  50%
Thread: 1,  49%

Total threads: 3
Thread: 0,  33%
Thread: 1,  33%
Thread: 2,  33%

Total threads: 4
Thread: 0,  24%
Thread: 1,  25%
Thread: 2,  25%
Thread: 3,  25%

Total threads: 5
Thread: 0,  11%
Thread: 1,  25%
Thread: 2,  25%
Thread: 3,  25%
Thread: 4,  11%

Total threads: 6
Thread: 0,  11%
Thread: 1,  12%
Thread: 2,  25%
Thread: 3,  25%
Thread: 4,  11%
Thread: 5,  12%

Total threads: 7
Thread: 0,  12%
Thread: 1,  12%
Thread: 2,  12%
Thread: 3,  25%
Thread: 4,  12%
Thread: 5,  12%
Thread: 6,  12%

Total threads: 8
Thread: 0,  12%
Thread: 1,  12%
Thread: 2,  12%
Thread: 3,  12%
Thread: 4,  12%
Thread: 5,  12%
Thread: 6,  12%
Thread: 7,  12%
    

Not sure what conclusion should I get from this, it was easier with your scenario. Razz

[edit]f0dder, maybe Get{System|Process|Thread}Times function?[/edit]
Post 18 Jul 2010, 19:35
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Loco: those give info on the time information for threads, not the state Smile
Post 18 Jul 2010, 20:54
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Oh I see, I thought your goal was to find the CPU times (also reported in the same place by ProcessExplorer).

I've spent some time debugging but neither ProcessExplorer nor Windows' Task Manager seems to use any of those three functions Confused (I have the "CPU time" column enabled). I think I'll have to wait for the masked magician to see the trick finally revealed. Wink
Post 18 Jul 2010, 21:16
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17660
Location: In your JS exploiting you and your system
revolution
f0dder: CreateToolhelp32Snapshot
Post 19 Jul 2010, 00:21
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
revolution wrote:
f0dder: CreateToolhelp32Snapshot
I don't see a member of THREADENTRY32 indicating state?

_________________
Image - carpe noctem
Post 19 Jul 2010, 07:56
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17660
Location: In your JS exploiting you and your system
revolution
f0dder wrote:
I don't see a member of THREADENTRY32 indicating state?
Oh.

It must be using undocumented methods then.
Post 19 Jul 2010, 11:06
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.