flat assembler
Message board for the users of flat assembler.

Index > Main > Multiple CPU cores

Author
Thread Post new topic Reply to topic
drobole



Joined: 03 Nov 2010
Posts: 67
Location: Norway
drobole
I have no idea what I am talking about so I'll make it short and sweet.
Can I utilize multiple cores using fasm?
Post 18 Nov 2010, 19:55
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
Short and sweet answer:
Yes.
Post 18 Nov 2010, 20:47
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
drobole



Joined: 03 Nov 2010
Posts: 67
Location: Norway
drobole
So can I control what instructions gets executed on each core?
Post 18 Nov 2010, 21:35
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
Are you thinking... Windows? Real mode? Somehting else?
Post 18 Nov 2010, 21:38
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
drobole



Joined: 03 Nov 2010
Posts: 67
Location: Norway
drobole
How about Linux/Windows, protected mode, user space?
Post 18 Nov 2010, 21:39
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
In Windows, you make the application multithreaded. I'm not sure, but you might be able to select which thread goes to which core.

Not my area, but I think Protected mode = Real mode when it comes to multiprocessing. Ask the people over at the OS Construction board for those.
Post 18 Nov 2010, 22:04
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
drobole



Joined: 03 Nov 2010
Posts: 67
Location: Norway
drobole
Ok, so I'm basically in the hands of the OS threads then
Post 18 Nov 2010, 22:18
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
If you're not going to run OS-less, yes.
Post 18 Nov 2010, 22:23
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Have you ever made a mt program in another language? I would suggest it. If you have, then you are probably already familiar with a threading API. The APIs are the same as always. The most commonly used are WinAPI for Windows, and pthreads for *nix. With WinAPI, you can set the cpu affinity, but I don't know how strict it is, or if there s a Linux parallel.
Post 18 Nov 2010, 22:36
View user's profile Send private message Reply with quote
drobole



Joined: 03 Nov 2010
Posts: 67
Location: Norway
drobole
Yea I'm familiar with those.
According to http://en.wikipedia.org/wiki/Processor_affinity Linux seems to have something similar. But as you said, it doesn't seem to be very strict, and I get the impression I'm better off leaving it to the OS scheduler to decide.
Post 18 Nov 2010, 23:53
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
So you know how to use pthreads(or your threading lib of choice)? All you have to do from there is call them like you call libc(assuming you know how to import symbols), or anything else.

If you need help with threading using a specific lib, you'll probably want to go to a more relevant sub-forum to the thread lib's native OS. There's also lots of tutorials on threading in C, that are easy to understand in terms of how you could use the concepts presented, in assembly.
Post 19 Nov 2010, 02:59
View user's profile Send private message Reply with quote
Alphonso



Joined: 16 Jan 2007
Posts: 294
Alphonso
drobole wrote:
So can I control what instructions gets executed on each core?
There are times where you have to do this, for instance measuring approximate core temperatures in a multi-core cpu.
Post 19 Nov 2010, 12:49
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 693
Location: Adelaide
sinsi
Windows has SetThreadAffinityMask
Post 19 Nov 2010, 13:03
View user's profile Send private message Reply with quote
drobole



Joined: 03 Nov 2010
Posts: 67
Location: Norway
drobole
@Tyler
I am familiar with using threads in C++. If I have any questions about using it in fasm I'll certainly be posting in the relevant OS forum Smile



The reason I wanned to know is basically that I consider writing a high level language compiler using fasm as the backend, and I was wondering about having builtin threading capabilities and possibly more fine grained control of execution. I guess thread affinity could come in handy as an advanced language feature.



Thanks
Post 19 Nov 2010, 17:09
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.