You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
I'm building a web app using mysql, and I want to integrate some fairly complicated indexing, and I was thinking that maybe it was possible to use the math co-processor to run along side, reading data and sorting/compressing it while the main processor does it's usual thing.
A coprocessor may not be a general-purpose processor in its own right. Some coprocessors cannot fetch instructions from memory, execute program flow control instructions, do input/output operations, manage memory, and so on. These processors require the host main processor to fetch the coprocessor instructions and handle all other operations aside from the coprocessor functions. In some architectures the coprocessor is a more general-purpose computer, but carries out only a limited range of functions under the close control of a supervisory processor. Note the difference to the term multiprocessor, which refers to a computer with more than one general-purpose CPU.
I'm building a web app using mysql, and I want to integrate some fairly complicated indexing, and I was thinking that maybe it was possible to use the math co-processor to run along side, reading data and sorting/compressing it while the main processor does it's usual thing.
possible?, any ideas?
If matrix or vector operations, one possibility is to use the graphics GPU to perform the calculations.
to run along side, reading data and sorting/compressing it while the main processor does it's usual thing.....
....yeah a little research sends me the same place, threads
This is exactly why multi-threading capability exists... to allow your program to "do something" in the background whilst the main body of your program "does its usual thing." Exactly. Spot-on. Bingo.
With all the 'force fit' attempts we see here - trying to 'game the system' or use a hacksaw when the right tool is a hammer - I would have thought "let's use one or more additional threads of execution" for this application would have reached out and whopped you upside the head....especially since your own description of the challenge (above) may as well have been written by the person in charge of creating the 'mission statement' for support for additional threads of execution.
That said, it's not all that easy to manage your data in a multi-threaded environment, and when you DO reach the point where these operations have to be synchronized, you'll have to reach for those scary-looking "WaitForxxxxx" functions.
But A) all that stuff 'works as advertised' and B) there's lots of 'starter code' in the Source Code Forum.
If it is a single core CPU then threading might not help you much, if the main app is also CPU intensive then it might even slow the whole process down with the added overhead of thread switching. To be clear a modern single core CPU only runs one thread at a time, it cannot run a seperate thread in the floating point processor (modern CPU's haven't used coprocessors for many years except GPU's). The main speed advantage of threads is if the main app is not full utilising the CPU ie waiting for user input etc.
If speed is a real issue then you should be using a dual or quad core processor which can then really make use of the threads.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment