[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Dual and quad core assembler programming /  O.S.

Posted on 2008-11-15
3
Medium Priority
?
1,461 Views
Last Modified: 2013-12-13
I've been exploring on assembler programming, and read a couple of articles on CPUs, but I can't find a tutorial or reference on quad and dual assembler. My question is:
What's the main difference between a normal processor and a dual or quad, when it comes down to assembler programming?

Thx,
Diego

P.S. I am playing around with this "make your own OS"  tutorials
0
Comment
Question by:d_iego
2 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 1000 total points
ID: 22970306
> What's the main difference between a normal processor and a dual or quad, when it comes down to assembler programming?
Nothing. Assembler has no idea about threads. You are coding single thread.
After all, C/C++ is the same - You are coding single thread - but if You know the code is to be thread safe, You have to code it that way.
Same with asm, if You want to make sure that the code is thread safe, You have to use bus/memory locking or atomic instructions.

Look at this case from CPU side - one core always runs single thread. It's the operating system who creates(on process request) new threads and processes and manages them.

> P.S. I am playing around with this "make your own OS"  tutorials
So basically what You need is to create threads scheduler. Initialize every available cpu/core with some OS thread(probably same entry point), which will then run the scheduler to assign userland threads/processes.
0
 
LVL 18

Assisted Solution

by:DropZone
DropZone earned 1000 total points
ID: 23269776
ravenpl's answer is correct and very informative.  However, I would like to expound on the threading topic.

As ravenpl said, in Assembly, and to the CPU in general, there is no concept of threads or processes; each core executes a single instruction at a time, and it is up to the software (e.g. the operating system) to divide and group the instructions on each tasks and feed them to each individual core or processor.

There are some very specific algorithms and techniques to do this, and all of them are fairly complex.  However, some processor manufacturers provide libraries or compilers that aid in making the various decisions required at the lowest levels of execution.

If you are using an Intel multi-core processor, you may want to look into the Intel TBB (Threading Building  Blocks) library:
    http://en.wikipedia.org/wiki/Threading_Building_Blocks

    -dZ.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Beyond Tools A conversation I recently had with the DevOps manager of a major online retailer really made me think about DevOps monitoring tools (https://www.onpage.com/devops-incident-management-tool/). The manager and I discussed how sever…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Simple Linear Regression
Starting up a Project

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question