BBC BASIC for Windows
« Multi core / Multithreading »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:56pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Multi core / Multithreading  (Read 995 times)
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Multi core / Multithreading
« Thread started on: Aug 14th, 2016, 8:28pm »

Can anyone help?

From the post about 256 ping I can conclude that it is possible. However I have tried to research on the net to no avail ( can find plenty of technical mumbo jumbo, but no code!). I have also tried to deconstruct the code in 256 ping, but I do not know what the system calls do or what or where the parameters mean or come from.

What I want to do is run 2 or 3 sets of asm (these will not be small threads, but 2000 to 5000 instructions long) in parallel (truely in parallel), so that I can do the vector calculations needed and render the image at the same time. Without using the GPU does anyone know if this is possible and if so can you supply a code snippet that will set the multiple threads going.

Thanks for reading
Ric
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: Multi core / Multithreading
« Reply #1 on: Aug 14th, 2016, 9:31pm »

It appears as though you might try making multiple short branches for each calculation, and jump back and forth between calculations for each branch

before a screen write or series of draws is made.
So in a sense it could be multithread in a sense.

But I looked carefully and found this online.

Quote:
When you write assembly code it runs sequentially (or with branches) on one and only one logical (i.e. hardware) thread. If you want some of the code to execute on another logical thread (whether on the same core, on a different core on the same CPU or even on a different CPU), you need to have the OS set up the other thread's instruction pointer (CS:EIP) to point to the code you want to run. This implies using system calls to get the OS to do what you want.

User threads won't give you the threading support that you want, because they all run on the same hardware thread.

Edit: Incorporating Ira Baxter's answer with Parlanse. If you ensure that your program has a thread running in each logical thread to begin with, then you can build your own scheduler without relying on the OS. Either way, you need a scheduler to handle hopping from one thread to another. Between calls to the scheduler, there are no special assembly instructions to handle multi-threading. The scheduler itself can't rely on any special assembly, but rather on conventions between parts of the scheduler in each thread.
« Last Edit: Aug 14th, 2016, 9:35pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: Multi core / Multithreading
« Reply #2 on: Aug 14th, 2016, 11:45pm »

There is the idea of using arrays to hold the locations of all the points of a given object, and also the visible parts that only show when they are facing the camera.

The rotation would happen in the array and only the arrays designated on eye side would be visible.

This approach would only allow one given size for a 3D image, unless another dimension was added.
but then zooming in and shrinking something would require a large 3D memory area.
The values would be exchanged as the image rotates.
Perhaps checking each array location and the spot next to it and having a carrier variable to move and hold old destination info.

OR
Perhaps two complex arrays can exchange back and forth as changes are made.
« Last Edit: Aug 14th, 2016, 11:53pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: Multi core / Multithreading
« Reply #3 on: Aug 15th, 2016, 06:44am »

Michael,

The article you read I have come across along with many more and they all say the same thing need to point the CS:EPI and get new stuff to execute from here. This is what I want to know how to do. I can not find the code to make this happen. I am not sure it can be done from within BB4W but may have to be done in an external compiler cry

In the software I have written all the nodes and faces are in arrays and get rotated accordingly. Then the render is done. Two processes occurring in sequence, I would like them to happen in parallel to speed up the whole process.

It is the render tha takes the time and all the other calculations could be done for the next face/object while this is happening. I would like to be able to create two threads on two cores to make this happen.

Thanks for the reply, happy hunting

Ric
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: Multi core / Multithreading
« Reply #4 on: Aug 15th, 2016, 12:11pm »

Check this pdf out. Perhaps it may help:

https://swebwiki.student.iaik.tugraz.at/_media/bs/procthreadsyncarticle.pdf
User IP Logged

I like making program generators and like reinventing the wheel
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls