Real World Multicore Embedded Systems A Practical Approach Expert Guide Bryon Moyer AMSTERDAM • BOSTON • HEIDELBERG • LONDON I J^# J NEW YORK • OXFORD • PARIS • SAN DIEGO S V J SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO ^V«i^ Newnes is an imprint of Elsevier NCWTIGS
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Real World Multicore Embedded Systems
A Practical Approach
Expert Guide
Bryon Moyer
AMSTERDAM • BOSTON • HEIDELBERG • LONDON I J ^ # J NEW YORK • OXFORD • PARIS • SAN DIEGO S V J
SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO ^ V « i ^ Newnes is an imprint of Elsevier NCWTIGS
Contents
About the Editor xvii About the Authors xix
Chapter 1: Introduction and Roadmap 1 Multicore is here 1 Scope 3 Who should read this book? 3 Organization and roadmap 4
Chapter 5: Design Considerations for Multicore SoC Interconnections 117
Introduction 119 Importance of interconnections in an SoC 120 Terminology 121 Organization of the chapter 121
Communication activity in multicore SoCs 124 Transaction-Based communication 124 Storage-Oriented transactions 124 Concurrency of communication and segregation of traffic 126 Recent trends in SoCs 127
Functional requirements and topologies of SoC traffic 129 Memory organization 131 Implications of inter-device communication paradigms 134
Interconnection networks: representation and terminology 150 Representation of interconnection networks 150 Direct versus indirect networks 153 Circuit-Switched versus packet-switched communication and blocking versus non-blocking networks 155 Base-Form vs. encoded signaling 156 Transaction routing 157 Bus as an SoC interconnection 158 Limitations of the bus architecture 160
Fabric-oriented interconnects for larger SoCs 161
viii Contents
Transaction formats 163 Transaction routing 166
Building blocks of scalable interconnections 167 Links 168 Clocking considerations 169 Switches 169
Evaluating and comparing interconnection topologies for future SoCs 185
Metrics for comparing topologies 186 A Survey of interconnection networks suitable for future SoCs 188
A Pipelined bus 188 Multiple buses 189 A ring 189 A crossbar 190 Mesh topology 191
Some practical considerations in designing interconnections 192 Hierarchies of interconnections 192 Scalability in implementations 192
Summary 193 References 196 Further reading 197
Chapter 6: Operating Systems in Multicore Platforms 799 Introduction 199 Symmetric multiprocessing systems and scheduling 202 Assymetric multiprocessor systems 207
Controlling the assignment of threads in an SMP system 214 Controlling where interrupt handlers run 215 Partitions, containers, and zones 216 Priority 217 Kernel modifications, drivers, and thread safety 218 System start-up 220
Debugging a multicore system 221 The information gathered 222
Contents ix
Uploading the information 223 Painting the picture 224
Summary 225 Reference 226
Chapter 7: System Virtualization in Multicore Systems 227 What is virtualization? 228 A brief retrospective 230 Applications of system virtualization 231
Environment sandboxing 231 Virtual appliances 232 Workload consolidation 232 Operating system portability 233 Mixed-criticality systems 233 Maximizing multicore processing resources 233 Improved user experience 233
I/O virtualization within microkernels 255 Case study: power architecture virtualization and the freescale P4080 257
Power architecture hardware hypervisor features 257 Power architecture virtualized memory management 260 Freescale P4080 IOMMU 261 Hardware support for I/O sharing in the P4080 262 Virtual machine configuration in power architecture 263
Example use cases for system virtualization 263 Telecom blade consolidation 264 Electronic flight bag 264 Intelligent Munitions System 264 Automotive infotainment 265 Medical imaging system 266
Conclusion 266 References 267
Chapter 8: Communication and Synchronization Libraries 269 Introduction 269 Library overview and basics 270
Thread APIs 270 Message-passing APIs 270
Explicit threading libraries 270 Windows Threads 271 POSIX Threads 272 Cl l and C ++ 11 Threads 275
Chapter 9: Programming Languages 289 Programming languages for multicore embedded systems 289 C 290
Multi-threading support in C 295 Assembly language 295
Multi-threading and assembly 296
Contents xi
C++ 297 Features of C + + that work well for embedded systems 297 Features of C + + that do not work well for embedded systems 300 Multi-threading support in C + + 303
Data integrity 388 Atomicity 390 Sequence of processing 393 Access to limited resources 395 Critical timing for real-time 395
Problems with not synchronizing (or synchronizing badly) 395 Slower throughput 396 Errors in synchronization logic 397 Consumes more power 397
Testing for proper synchronization 397 How is synchronization achieved? 398
Exclusion 399
Contents xiii
Test and set; compare and swap (CAS) 405 Barrier 406 Architectural design 407
Specific conditions requiring synchronization 412 Data races 413 Deadlocks 416 Livelocks 416 Non-atomic operations 417 Data caching 418 Conversion for endianness 419 How to implement synchronization 419
Language support for implementation 424 Intro 424 Language features and extensions 425 Libraries 426
Hardware and OS effects on synchronization 437 Number of cores 438 Memory, caches, etc 438 Thread scheduling 439 Garbage collection (and other system-level globally synchronized operations) 439
Problems when trying to implement synchronization 440 Inconsistent synchronization: not synchronizing all access methods 440 Data escapes 441 Using a mutable shared object with two different access steps (i.e., init() and parse()) 441
xiv Contents
Cached "Scratch-Pad" data 441 Multiple lock objects created 442 Trying to lock on a null-pointer 442 Double-check locking errors 442 Simple statements not atomic (i.e., increments, 64-bit assignments) 443 Check/act logic not synchronized 443 Synchronization object used for many unrelated things 444 Summary — synchronization problems 444