Author Topic: Multi-Threading  (Read 11924 times)

0 Members and 1 Guest are viewing this topic.

Offline colecampbell666

  • I See Dead Pictures
  • 212
  • Evolution and ascension.
Are there any plans to make FSO support multiple cores? More and more people are getting dual-cores, and I've seen three support requests today that have symptoms of dual-core-ism.
« Last Edit: May 30, 2008, 07:16:16 pm by colecampbell666 »
Gettin' back to dodgin' lasers.

 

Offline Turambar

  • Determined to inflict his entire social circle on us
  • 210
  • You can't spell Manslaughter without laughter
having 4 cores, this subject interests me.

*strokes goatee*
10:55:48   TurambarBlade: i've been selecting my generals based on how much i like their hats
10:55:55   HerraTohtori: me too!
10:56:01   HerraTohtori: :D

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
As far as I know, Freespace runs as a single process, and so can only ever fully utilize one core. In Task Manager, though, you can change process affinities so that, say, Outlook and Firefox always run on Core 2 and Freespace always runs on Core 1.
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline phreak

  • Gun Phreak
  • 211
  • -1
It would probably require the entire engine to be rewritten from scratch to multi-thread everything.

All I know, is that the joystick is polled using a separate thread.  All of the AI logic, graphics, physics, sound, loading, etc. is done in the same thread.
Offically approved by Ebola Virus Man :wtf:
phreakscp - gtalk
phreak317#7583 - discord

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Never had a problem one either my Pentium D, Core2duo or Core2quad.  I leave it on all cores and not a single problem related to that yet.  Could this be more of a chipset or motherboard thing than a multiple processor problem?  Strange that some people can run it just fine and others can't. 
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
There are two issues here. Having FS2_Open work on machines with multiple cores without bugs and having it actually make use of the other cores.

The former is supposedly fixed in 3.6.10 builds. Were any of the problems reported on/fixed by using recent 3.6.10 builds?

The latter basically requires a complete engine redesign as the game continually makes the assumption that only one process can be modifying data at a time.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
Multi threading will require the total rebuild of the game engine, because at the time of its publishing, dual cores were near non-existent on the consumer side, and making programs use multithreads was an issue previously. To the best of my knowledge, few games support multi threading. Supreme Commander, for example, will split its load between the cores evenly, and without need for configuration.
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline colecampbell666

  • I See Dead Pictures
  • 212
  • Evolution and ascension.
Multi threading will require the total rebuild of the game engine, because at the time of its publishing, dual cores were near non-existent on the consumer side, and making programs use multithreads was an issue previously. To the best of my knowledge, few games support multi threading. Supreme Commander, for example, will split its load between the cores evenly, and without need for configuration.
They were nonexistent period, in 1999, unless you're talking about NASA or Area 51 or some Chinese teenager or something.

And that's what I thought, I wanted a coder's point of view.
Gettin' back to dodgin' lasers.

 

Offline Spicious

  • Master Chief John-158
  • 210
If it were to magically become multithreaded, it would just open up the way to painful concurrency issues when changing anything.

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Wasn't the Pentium Pro multi core or was it just a precursor to the multi core processor?
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
I know that Pentium, I think, is coming up with the Penryn processor, some kind of smart multi core that will moniter usage of the cores and turn off inactive ones.
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
The Pentium Pro had SMP support, but it was not dual core.  It was also their first pure 32bit (and i686, the Pentium/MMX was i586) cpu I believe, designed for the NT operating system.  SMP is much older than dual core, and there were SMP systems in consumer hands around that time, because the Celeron was found to be capable of being run in SMP configurations, with a little motherboard hackery.  The Abit BP6 was famous because of this, it enabled power gamers to buy two Celerons for less than one Pentium 3 and get better performance.  So, while dual core was barely a dream to a few scientists, SMP was definitely around, and being taken into consideration by many programmers.  But it's difficult to take advantage of all those cores, threading an application properly takes a lot of work, and needs to be planned from the start more than likely.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
I can't think of any way you would do it gracefully; I'm skeptical if even scripting is abstracted enough for you to be able to do anything else while something is going.

The fact that nobody knows what it would take seems like the biggest obstacle to me.

It is something that seems like it's going to become something quite a bit more relevant in the coming years, so if anybody knows someone who loves multithreading already-coded applications... :D
-C

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
If I managed to find a decompiler and decompile Forged Alliance's code, we might be able to see something.
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
You giving up and crying after looking at the FS2 code? :p


The problem isn't that the team don't know how to write multithreaded code. It's that we don't want to. We'd have to rewrite the entire engine from scratch.
« Last Edit: June 02, 2008, 12:14:13 pm by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
If I managed to find a decompiler and decompile Forged Alliance's code, we might be able to see something.
Code: [Select]
    mov edx,len
    mov ecx,msg
    mov ebx,1
    mov eax,4
    int 0x80

    mov ebx,0
    mov eax,1
    int 0x80
-C

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
I know you need an understanding of how every piece of the code interacts with every other piece, whether that be an individual or collectively.  Collectively makes it even more difficult, and that's the more likely scenario here since it wasn't designed with a multi-threaded infrastructure in the first place.  Every piece would have to be analyzed and re-fractored into a thread-aware, thread-safe version.  At a minimum.  It could be that it's simply not possible without rewriting from the ground up.  Right now, every frame gets taken care of linearly.  You do some physics, some graphics, some scripting checks, and each of these happens in a pre-defined order.  They all have been coded with this assumption.  You take that assumption away, and all hell will break loose.  When you have graphics and physics and scripting all trying to do their own thing independently, and report back to some master process, it would probably be ugly right now.  And that's just one method of how to break it up.  The very howto of multithreading a game is still up for debate.  What gets its own thread?  With a game like this it's especially difficult.  Is it even worth multi-threading?  Is there enough overhead on all fronts to warrant it, or is it mostly graphics these days?  The other areas, physics, AI, etc, are old, and probably eat up an insignificant amount of a modern cpu.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Collision detection is eating up a massive amount according to Taylor's profiling a while back.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
Actually, what I meant when i said about looking about Forged Alliance's code was how to make multi threading work, but yea, it would be impossible to do it without rewriting the engine.

Collision detection is eating up a massive amount according to Taylor's profiling a while back.
How much exactly ? I know that I lag a bit when I ram into enemy ships.
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Minecraft
    • Steam
    • Twitter
    • ModDB Feature
FYI, I have a dual core (an Intel and an AMD) and I have never had any issues with running FSO with both cores.

I also just built an AMD Quad Core for a friend of mine who's running XP 64bit with 8gb of ram, and that machine is also running FSO just fine. We've even had plenty of lan multi-player games.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys