COTS Moves to Multicore: COTS Moves to Multicore: Software Considerations to Ease the Transition To Multi-coreChris Ault, Senior Product Manager – Wind River
Evolution to Multi-core
| © 2010 Wind River. All Rights Reserved.2
Migrating from Single-Core to Multi-core
� Performance:– There may be increases
– There may be decreases• Data dependencies
• Race conditions
� Programming Model– Revisit your synchronization assumptions
– There is shared hardware in there!
� Algorithms: need to be multi-core-aware
| © 2010 Wind River. All Rights Reserved.3
Migrating from Single-Core to Multi-core
� Shared hardware on the board
� OS privilege levels: multiple instances of the kernel, one per core
| © 2010 Wind River. All Rights Reserved.4
Multi-core: Shared Hardware Resources
� All cores share access to– I/O devices
– Memory
– Timers/clocks
– Interrupt controller
| © 2010 Wind River. All Rights Reserved.5
Core Core Core Core
IDE Ethernet MemoryTimer Serial
Interrupt Controller
Privilege Modes: Single-Core
Operating systems work in privilege modes:� The OS kernel itself can do anything with the hardware
� Device drivers are more restricted
� User applications/components are least privileged
| © 2010 Wind River. All Rights Reserved.6
Intel privilege rings source: Wikipedia
Ring 3
Ring 2
Ring 1
Ring 0
Kernel
Device Drivers
Device Drivers
Applications
Least Privileged
Most Privileged
Example based on Intel privilege rings, other processors have similar concepts
AM
P
Privilege Modes and Multi-core
� Cores in privilege mode can control the entire hardware and mask interrupts
� More control may be required in a multi-core setting
� Can seriously impacts robustness
| © 2010 Wind River. All Rights Reserved.7
Ring 3Ring 2Ring 1
Ring 0
Kernel
Device Drivers
Device Drivers
Applications
Ring 3Ring 2Ring 1
Ring 0
Kernel
Device Drivers
Device Drivers
Applications
Ring 3Ring 2Ring 1
Ring 0
Kernel
Device Drivers
Device Drivers
Applications
Ring 3Ring 2Ring 1
Ring 0
Kernel
Device Drivers
Device Drivers
Applications
Core Core Core Core
SM
P
SMP Operating System
� Multiple instances of tasks running at the same priority
� Lower priority tasks running concurrently with higher priority tasks
� Lower priority tasks may mask interrupts and starve higher priority tasks
Review Your Assumptions
higher priority tasks
| © 2010 Wind River. All Rights Reserved.8
Algorithms, Data Parallelism
� Traditional Single-core systems:– Single instance of processing task operates on complete data
set
– Does not utilize all cpu cores
| © 2010 Wind River. All Rights Reserved.9
Core
Core
Core
Core
DataProcessing
Data Set
Idle
cor
es
Data Parallelism
� Multiple instances of data processing, operating on smaller subsets of data
� Multi-core-aware algorithms are necessary to realize increases in processing speed
– Re-architect & re-write code
| © 2010 Wind River. All Rights Reserved.10
Core
Core
Core
Core
Data Processing
Data Subsets
Data Processing
Data Processing
Data Processing
Complex Challenges When Migrating To Multi-core
� Shared hardware on the board– I/O devices, memory, interrupt controller
� Non-parallel code needs to be re-written, re-testedtested
� OS privilege levels: multiple instances of the kernel, one per core
| © 2010 Wind River. All Rights Reserved.11
It’s Not All That Gloomy ….
With Embedded Virtualization …..
� Virtualize accesses to shared hardware
– Shared access is controlled outside of your app
– Interrupt controller, memory regions, devices
� Retain execution behavior of existing apps
– Minimize retesting/rewriting
� Add new functionality on remaining cores
| © 2010 Wind River. All Rights Reserved.12
Apps
OS
Core 1
Apps
Core 2
OS
Hypervisor
Apps Apps