Author Topic: Technical question regarding processor affinities  (Read 1376 times)

0 Members and 1 Guest are viewing this topic.

Technical question regarding processor affinities
Ok, so I have a game that runs decently on my processor... when it decides to use both cores. I've discovered through some trial and error that the specific CPU core that starts executing the program determines whether or not the ****ed thing uses both and improves performance: if CPU 0 starts, it will not allow CPU 1 to help. If CPU 1 starts, then CPU 0 picks up the slack. Massive difference in performance.

So, I decide to alter the shortcut to the game so that it auto-sets the processor affinity to CPU 1. This works... except that what the shortcut actually does at the moment is open a command prompt window in the game directory; to play the game, I have to then type the game's executable into the command prompt to actually run it. This is the command that's sitting in the shortcut's target path:

C:\Windows\System32\cmd.exe /C start /affinity 2 "<game executable path>"

According to the research I've done, this should execute the program on its own, briefly opening a command prompt window first to set the affinity. So what's up? Why do I then have to manually start the game after the affinity is set?
"You need to believe in things that aren't true. How else can they become?" -DEATH, Discworld

"You can fight like a krogan, run like a leopard, but you'll never be better than Commander Shepard!"

 

Offline Topgun

  • 210
Re: Technical question regarding processor affinities
just for reference, what game is it, and xp, vista, or 7?

also, with the way dual-cores work, that doesn't make any sense.
the game is either running on core 0 or core 1, or some threads of the game are on core 0 or core 1. the cpu might switch them, but they can't do the same thing at the same time.

unless, MAYBE if you are using server 2008, which has a different way of handling cpus, but I don't know anything about it.
« Last Edit: March 01, 2010, 10:23:12 pm by Topgun »

 
Re: Technical question regarding processor affinities
OS is Vista, game is eXceed 3rd: Black Package.

As for the CPU usage, I'm going off of what my CPU usage graph keeps telling me. When the game uses core 1 first (affinity set to CPU 1), the core is about 30-50% utilized, but when the game has a crap-ton of stuff to keep track of, core 1 maxes out and core 0's usage sees a sudden spike. This does not happen if core 0 is the first utilized (affinity set to CPU 0), where it will max out but core 1 will stay idle, and the game's framerate suffers horribly.

If I do not set processor affinity, which core is utilized first appears to be random. Same results as above, either way.
« Last Edit: March 02, 2010, 01:39:30 am by Dark Hunter »
"You need to believe in things that aren't true. How else can they become?" -DEATH, Discworld

"You can fight like a krogan, run like a leopard, but you'll never be better than Commander Shepard!"

 

Offline S-99

  • MC Hammer
  • 210
  • A one hit wonder, you still want to touch this.
Re: Technical question regarding processor affinities
Something tells me that you made a rather honest mistake when changing the windows shortcut to do your bidding. And also that you got what you wanted but the deal is only half complete.

A windows shortcut is just a script for running a program with a pretty gui to help you out, and also running a program with command line arguments. Lets say you get onto someones computer and you change the internet explorer shortcut to instead of opening up internet explorer, but instead pull the command for shutting down the computer.

What i'm getting as is what happened on your end with is half complete. It's really sounding like you got rid of the target executable path in the shortcut and just replaced it with the processor affinity commands instead. This would easily get a shortcut to not run your desired program.

A better way is that we'll say -xxx is a command modifier for ascii art boob graphics (just imagine it's like setting the processor affinity commands) all over in your game. So you want boob ascii art in your game. Alright, easy enough. C:\example.exe -xxx there, it's done.

What it sounds like you've done is you unknowingly got rid of C:\example.exe and just left the -xxx part in the shortcut. This would explain why the shortcut is just dumping you at windows command line instead of running the game with the processor affinity in an easy double click solution.

So in by learning that windows shortcuts are just scripts, you now know they can do more than just loading programs, you can just have them run really any kind of command you want. You can change a shortcut just to run dir or cd if you wanted albeit that would really be pointless, but this is where i barely keep myself from ****ing with people's shortcuts. What i do is more genius than making My Computer open calc instead. But, by embedding nasty little commands like hibernate, sleep, restart, or shutdown to a couple of icons on the desktop, you've really convinced somebody they got a virus causing instability :D
Or you could be really nasty and change a shortcut to delete the contents of my documents and the directories within. I haven't been cruel like this before, haven't met anyone i hated enough to want to do it.

bla bla bla, i hope i helped.
Every pilot's goal is to rise up in the ranks and go beyond their purpose to a place of command on a very big ship. Like the colossus; to baseball bat everyone.

SMBFD

I won't use google for you.

An0n sucks my Jesus ring.

 
Re: Technical question regarding processor affinities
I figured it out.

My problem was that I left the full path in after the affinity commands, rather than simply the name of the executable. Since the shortcut already starts in the proper directory, it didn't need to know the complete file path.

C:\Windows\System32\cmd.exe /C start /affinity 2 eXceed3rd-BP.exe

runs just fine and does what I want.

Thanks for the replies! :)

"You need to believe in things that aren't true. How else can they become?" -DEATH, Discworld

"You can fight like a krogan, run like a leopard, but you'll never be better than Commander Shepard!"

 

Offline S-99

  • MC Hammer
  • 210
  • A one hit wonder, you still want to touch this.
Re: Technical question regarding processor affinities
C:\Windows\System32\cmd.exe /C start /affinity 2 eXceed3rd-BP.exe
Cool, you solved it. That looks proper, and it works.
Every pilot's goal is to rise up in the ranks and go beyond their purpose to a place of command on a very big ship. Like the colossus; to baseball bat everyone.

SMBFD

I won't use google for you.

An0n sucks my Jesus ring.

 

Offline Mika

  • 28
Re: Technical question regarding processor affinities
Does your computer use hyperthreading?
Relaxed movement is always more effective than forced movement.

  

Offline S-99

  • MC Hammer
  • 210
  • A one hit wonder, you still want to touch this.
Re: Technical question regarding processor affinities
My desktop is athlon 2, so i'd have to say no. My eeepc is atom, so yes.
Every pilot's goal is to rise up in the ranks and go beyond their purpose to a place of command on a very big ship. Like the colossus; to baseball bat everyone.

SMBFD

I won't use google for you.

An0n sucks my Jesus ring.