🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Multithread, qe?

Started by
2 comments, last by SikCiv 24 years, 8 months ago
I think it overlaps

(oh yeah, I'm not from Sydney, I'm from Chch NZ)

------------------
-------------------
LoungePig
OpenGUI

Advertisement
Multithreading means that one thread started with CreateThread(?), is executed once. This registered function is running 'parllel' to all other threads. This means you have to start many threads to get multiple instances of the function.
Each function is executed in another stack frame. With only one processor, this means that the first thread is started sometime, when Windows decides to switch to another thread, Windows saves the stack of the first thread, and copies the saved stack from the second thread onto the stack. This is called Context switching.
The above explains that a function exists this way multiple times in memory.

Hope you're not too confused.
A source to get information on this topic is the Documentation of the WinSDK (e.g. VC++).

Look there for information on CreateThread, Events, etc.

Im only new in the Windows development environment, so I dont know about multithreading etc..
Whats the deal, how do you control the multithreading?
And do the multithreaded functions repeat over themselves if the function is too slow to quit before the next instance of the same function excecutes, or does it wait until the function is finished or skip that instance?

For example, say you had an UpdateSurface() function that is called every 100ms by a mmtimer, but the function takes longer than the 100ms to exit. Does the next instance (100ms later) skip, overlap, or wait?
Im guessing the overlapped code uses seperate memory allocations to avoid miscalculations...right?

PS. Anyone else from Sydney AUS?

-:->= SikCiv =<-;-

  Downloads:  ZeroOne Realm

you should use a critical section to prevent the same thing happening at the same time, else if the function is executing and doesn't finish by the next timer call, two concurrent copies of the function will be executing with both of them accessing the backbuffer, which can be nasty

------------------
http://members.xoom.com/mutex0


This topic is closed to new replies.

Advertisement