• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1472
  • Last Modified:

Dual and quad core assembler programming / O.S.

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
d_iego
Asked:
d_iego
2 Solutions
 
ravenplCommented:
> 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
 
DropZoneCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now