Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Thread usage (PC)

Author
Message
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 29th May 2013 22:08
Might apply on other platforms, but I was specifically interested in PC.

I noticed some strange CPU usage lately, where 1 thread is constant and fairly well utilised and a second thread that peaked and dropped severely but didn't appear to be relative to anything I was doing in-game.

I note that physics parts may/may not use separate threads, but I would like to understand how the threading is divided up (in the Windows version at least)

Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 30th May 2013 17:45
All networking is done on a separate thread that wakes up every 15 milliseconds by default (changeable with SetNetworkLatency).

Asynchronous HTTP requests are done on a separate thread.

Box2D physics will set up a number of worker threads equal to the number of cores your processor has, it then tries to break the physics up among these threads (not always possible)

When images are loaded their raw image data is saved in RAM and compressed to save space on another thread to avoid waiting for it to complete. This is to speed up any image manipulation commands used later like CopyImage. If you are not using these commands you can turn this process off with SetImageSavePixels(0) as it has no other benefit.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 30th May 2013 22:05
Odd. No networking in my app, no physics. The image stuff would only be a single hit, so I'm still at a loss why 2 cores are in use...

Login to post a reply

Server time is: 2024-11-24 14:02:07
Your offset time is: 2024-11-24 14:02:07