Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

asymmetric processor usage on atom 330

mcatee_von
Beginner
791 Views
Hello,

I'm wondering is it possible to use intel processors( looking at atom but really any multi-core processor ) in an asymmetric fashion. In my case i wish to use a single processor OS for highlevel task while handling real-time IO and timing on the other core(prob using some form of state machine). Imagine it as a built in PLC.

I would need to communicate between the cores for scheduling and notification of events.

I imagine if this is possible, I'd be able to get insane timing resolution and accuracy while retaining all the capabilities of my current OS.

thanks

0 Kudos
6 Replies
Dmitry_Vyukov
Valued Contributor I
791 Views
Quoting - mcatee.von
Hello,

I'm wondering is it possible to use intel processors( looking at atom but really any multi-core processor ) in an asymmetric fashion. In my case i wish to use a single processor OS for highlevel task while handling real-time IO and timing on the other core(prob using some form of state machine). Imagine it as a built in PLC.

I would need to communicate between the cores for scheduling and notification of events.

I imagine if this is possible, I'd be able to get insane timing resolution and accuracy while retaining all the capabilities of my current OS.


I believe this is possible. High-level scheme can be something like: start up your own "OS" on both cores, then run your current OS on single core in virtual mode (on virtual machine).
As for communication, you may use just shared memory (if your current OS allows to fix some region of virtual memory in physical memory), process running on your current OS can use polling, and on second core you can use mwait/monitor instructions. Another variant is to use IPIs for communication - I think you will have to install special driver which will forward IPIs to user space.
I think you may find examples of all of this in the Linux kernel, and in some virtual machine - OpenVZ, for example.
But it's gonna be a hard stuff...



0 Kudos
mcatee_von
Beginner
791 Views
Quoting - Dmitriy Vyukov

I believe this is possible. High-level scheme can be something like: start up your own "OS" on both cores, then run your current OS on single core in virtual mode (on virtual machine).
As for communication, you may use just shared memory (if your current OS allows to fix some region of virtual memory in physical memory), process running on your current OS can use polling, and on second core you can use mwait/monitor instructions. Another variant is to use IPIs for communication - I think you will have to install special driver which will forward IPIs to user space.
I think you may find examples of all of this in the Linux kernel, and in some virtual machine - OpenVZ, for example.
But it's gonna be a hard stuff...




Hmm, using a vm would prob work. I was hoping there would be a way to just initialize the second cpu and start it executing my statemachine code. The second processor wouuld only need access to limited io( gpio, parallel maybe some daq hardware) nothing which requires os services.

can the processors work completely independently of each other ?
0 Kudos
jimdempseyatthecove
Honored Contributor III
791 Views
Quoting - mcatee.von
Quoting - Dmitriy Vyukov

I believe this is possible. High-level scheme can be something like: start up your own "OS" on both cores, then run your current OS on single core in virtual mode (on virtual machine).
As for communication, you may use just shared memory (if your current OS allows to fix some region of virtual memory in physical memory), process running on your current OS can use polling, and on second core you can use mwait/monitor instructions. Another variant is to use IPIs for communication - I think you will have to install special driver which will forward IPIs to user space.
I think you may find examples of all of this in the Linux kernel, and in some virtual machine - OpenVZ, for example.
But it's gonna be a hard stuff...




Hmm, using a vm would prob work. I was hoping there would be a way to just initialize the second cpu and start it executing my statemachine code. The second processor wouuld only need access to limited io( gpio, parallel maybe some daq hardware) nothing which requires os services.

can the processors work completely independently of each other ?

What types of "applications" do you wish to run on each processor?

a) Single core Windows on one and another O/S on the other (e.g. Linux) - this is not likely possible with off the shelf software.

b) Single core Windows on one and a limitedconsole app on the other? This would be hard because the console (other video adapter) gpio, parallel, and DAC would be requesting interrupts and you would have to segregate the interrupts from each device to the appropriate processor.

c) A special - write your own kernel, run to apps on each CPU O/S - probably the easiest to write. (assuming you know how to write a mini-operating system).

There may be something available that does 3)

And there may be a hook/driver that someone wrote for Windows or Linux that effectively says "don't use core n". I seem to recall when I wrote NT 4.0 drivers that you could supply an option switch in BOOT.INI that disabled the SMP boot for debugging (leaving the other core available).

If you cannot find anything useful and you really need this (read have funding for project) then I would be available to help you out. Contact me on the side (off forum).

Jim Dempsey
0 Kudos
Dmitry_Vyukov
Valued Contributor I
791 Views
Quoting - mcatee.von
Hmm, using a vm would prob work. I was hoping there would be a way to just initialize the second cpu and start it executing my statemachine code.

I don't think that any sane OS will give up one core, this is why you have to be "under" the OS, i.e. run it in the VM.
There is the easy way to initialize one core to run your code, create thread in kernel (your driver), set it's affinity to the core, then disable interrupts... I don't think this will work.

0 Kudos
mcatee_von
Beginner
791 Views
Quoting - Dmitriy Vyukov

I don't think that any sane OS will give up one core, this is why you have to be "under" the OS, i.e. run it in the VM.
There is the easy way to initialize one core to run your code, create thread in kernel (your driver), set it's affinity to the core, then disable interrupts... I don't think this will work.


hmm, my atom 330 board should be here soon. gonna try corrupt(hacking) the windows ce startup and scheduler to initialize the second cpu and start my thread running on it. as i only need 2 interrupts which aren't serviced in the main os i'm thinking this may work.
0 Kudos
gaston-hillar
Valued Contributor I
791 Views
Hi mcatee.von,

An Atom 330 has much, muchmore processing power than an average PLC.
Real-time I/O is a kid's game for an Atom330.
You can run two threads in the operating system withoutproblems.
I don't see the need for a real-time I/O out of the OS.
I think you can perform some benchmarks before beginning with a task more difficult than it is necessary for the case (just an advice).

Cheers,

Gastn
0 Kudos
Reply