Real-Time Embedded Multithreading contains the fundamentals of developing real-time operating systems and multithreading with all the new functionality of ThreadX Version 5. This MIPS edition covers all the new ThreadX 5 features including Real-Time Event-Chaining, Run-Time Performance Metrics, and Run-Time Statck Analysis as specified for MIPS. ThreadX has been deployed in approximately 500 million devices worldwide including cell phones, digital cameras, and laser printers. General concepts and terminology are detailed along with problem solving of common pitfalls. The features and services of ThreadX are reviewed. The book is technology agnostic and applicable to all types of microprocessors. *A great introduction to real-time systems including general concepts and terminology*An insider shares his knowledge on ThreadX 5, a real-time operating system*A limited version of the ThreadX 5 software is packaged on a CD-ROM with the bookto run all sample projects and the case study
Author(s): Edward L. Lamie
Edition: Pap/Cdr
Publisher: Newnes
Year: 2008
Language: English
Pages: 488
Cover Page
......Page 1
Copyright......Page 2
Dedication......Page 3
Preface......Page 4
1.2 What is an Embedded System?......Page 6
1.4 Real-time Systems......Page 7
1.5 Real-time Operating Systems and Real-time Kernels......Page 8
1.6 Processes, Tasks, and Threads......Page 9
1.7 Architecture of Real-time Systems......Page 10
1.8 Embedded Systems Development......Page 12
1.9 Key Terms and Phrases......Page 13
2.3 Sample System with Two Threads......Page 14
2.4 Creating the ThreadX Objects......Page 17
2.7 Listing of 02_sample_system.c......Page 19
2.8 Key Terms and Phrases......Page 24
2.9 Problems......Page 25
3.2 Priorities......Page 26
3.3 Ready Threads and Suspended Threads......Page 27
3.4 Preemptive, Priority-Based Scheduling......Page 28
3.5 Round-Robin Scheduling......Page 29
3.6 Determinism......Page 30
3.10 Time-Slice......Page 31
3.13 Priority Inversion......Page 32
3.14 Priority Inheritance......Page 33
3.15 Preemption-Threshold......Page 34
3.17 Problems......Page 35
4.2 Defining Public Resources......Page 36
4.4 Thread......Page 37
4.5 Memory Pools......Page 39
4.6 Application Timer......Page 41
4.7 Mutex......Page 42
4.8 Counting Semaphore......Page 43
4.9 Event Flags Group......Page 44
4.10 Message Queue......Page 45
4.11 Summary of Thread Synchronization and Communication Components......Page 46
4.12 Key Terms and Phrases......Page 47
4.13 Problems......Page 48
5.2 History......Page 49
5.3 Technical Features......Page 50
5.4 MIPS Power Saving Support......Page 57
5.5 Key Terms and Phrases......Page 58
6.1 Introduction......Page 59
6.2 ThreadX Implementation of MIPS Exception Handling......Page 60
6.3 Key Terms and Phrases......Page 73
7.2 Thread Control Block......Page 74
7.3 Summary of Thread Services......Page 76
7.4 Thread Creation......Page 77
7.5 Thread Deletion......Page 83
7.7 Get Thread Information......Page 84
7.8 Preemption-Threshold Change......Page 85
7.9 Priority Change......Page 86
7.11 Resume Thread Execution......Page 87
7.14 Terminate Application Thread......Page 88
7.15 Time-Slice Change......Page 89
7.18 Execution Overview......Page 90
7.19 Thread States......Page 92
7.20 Thread Design......Page 93
7.21 Thread Internals......Page 96
7.23 Key Terms and Phrases......Page 98
7.24 Problems......Page 99
8.2 Protecting a Critical Section......Page 101
8.3 Providing Exclusive Access to Shared Resources......Page 102
8.5 Summary of Mutex Services......Page 103
8.6 Creating a Mutex......Page 104
8.7 Deleting a Mutex......Page 105
8.8 Obtaining Ownership of a Mutex......Page 106
8.10 Prioritizing the Mutex Suspension List......Page 107
8.12 Avoiding the Deadly Embrace......Page 109
8.13 Sample System Using a Mutex to Protect Critical Sections......Page 111
8.14 Output Produced by Sample System......Page 115
8.15 Listing for 08_sample_system.c......Page 118
8.16 Mutex Internals......Page 124
8.17 Overview......Page 125
8.19 Problems......Page 126
9.1 Introduction......Page 128
9.2 Summary of Memory Byte Pools......Page 129
9.4 Pitfalls of Memory Byte Pools......Page 130
9.5 Summary of Memory Byte Pool Services......Page 131
9.7 Allocating from a Memory Byte Pool......Page 132
9.9 Retrieving Memory Byte Pool Information......Page 134
9.10 Prioritizing a Memory Byte Pool Suspension List......Page 135
9.11 Releasing Memory to a Byte Pool......Page 136
9.12 Memory Byte Pool Example—Allocating Thread Stacks......Page 137
9.13 Memory Byte Pool Internals......Page 138
9.14 Summary of Memory Block Pools......Page 139
9.15 Memory Block Pool Control Block......Page 141
9.16 Summary of Memory Block Pool Services......Page 142
9.17 Creating a Memory Block Pool......Page 143
9.18 Allocating a Memory Block Pool......Page 144
9.19 Deleting a Memory Block Pool......Page 145
9.21 Prioritizing a Memory Block Pool Suspension List......Page 146
9.22 Releasing a Memory Block......Page 147
9.23 Memory Block Pool Example—Allocating Thread Stacks......Page 148
9.24 Memory Block Pool Internals......Page 149
9.25 Overview and Comparison......Page 150
9.27 Problems......Page 151
10.1 Introduction......Page 153
10.2 Internal System Clock Services......Page 154
10.4 Summary of Application Timer Services......Page 156
10.5 Creating an Application Timer......Page 157
10.7 Changing an Application Timer......Page 159
10.8 Deactivating an Application Timer......Page 160
10.10 Retrieving Application Timer Information......Page 161
10.11 Sample System Using Timers to Measure Thread Performance......Page 162
10.12 Listing for 10_sample_system.c......Page 166
10.13 Application Timer Internals......Page 172
10.14 Overview......Page 173
10.16 Problems......Page 174
11.1 Introduction......Page 176
11.2 Counting Semaphore Control Block......Page 178
11.6 Creating a Counting Semaphore......Page 179
11.7 Deleting a Counting Semaphore......Page 180
11.8 Getting an Instance of a Counting Semaphore......Page 181
11.9 Retrieving Information about Counting Semaphores......Page 182
11.11 Placing an Instance in a Counting Semaphore......Page 183
11.12 Placing an Instance in a Semaphore Using a Ceiling......Page 184
11.14 Comparing a Counting Semaphore with a Mutex......Page 185
11.15 Sample System Using a Binary Semaphore in Place of a Mutex......Page 186
11.16 Listing for 11a_sample_system.c......Page 189
11.17 Sample System Using a Counting Semaphore in a Producer-Consumer Application......Page 195
11.18 Listing for 11b_sample_system.c......Page 198
11.19 Counting Semaphore Internals......Page 204
11.21 Key Terms and Phrases......Page 205
11.22 Problems......Page 206
12.1 Introduction......Page 207
12.2 Event Flags Group Control Block......Page 208
12.4 Creating an Event Flags Group......Page 209
12.6 Getting Event Flags from an Event Flags Group......Page 211
12.7 Retrieving Information about an Event Flags Group......Page 215
12.8 Setting Event Flags in an Event Flags Group......Page 216
12.10 Sample System Using an Event Flags Group to Synchronize Two Threads......Page 218
12.11 Listing for 12_sample_system.c......Page 222
12.12 Event Flags Group Internals......Page 228
12.13 Overview......Page 229
12.15 Problems......Page 230
13.1 Introduction......Page 232
13.2 Message Queue Control Block......Page 234
13.4 Creating a Message Queue......Page 235
13.5 Sending a Message to a Message Queue......Page 236
13.6 Receiving a Message from a Message Queue......Page 237
13.7 Deleting a Message Queue......Page 238
13.9 Sending a Message to the Front of a Message Queue......Page 239
13.10 Retrieving Message Queue Information......Page 240
13.11 Prioritizing a Message Queue Suspension List......Page 241
13.13 Sample System Using a Message Queue for Interthread Communication......Page 242
13.14 Listing for 13_sample_system.c......Page 245
13.16 Overview......Page 252
13.17 Key Terms and Phrases......Page 253
13.18 Problems......Page 254
14.1 Introduction......Page 255
14.2 Statement of Problem......Page 257
14.3 Analysis of the Problem......Page 260
14.4 Design of the System......Page 262
14.5 Implementation......Page 267
14.6 Listing of VAM System......Page 283
14.7 Overview......Page 294
Appendices......Page 296
Appendix A: Memory Block Pool Services......Page 298
Appendix B: Memory Byte Pool Services......Page 312
Appendix C: Event Flags Group Services......Page 327
Appendix D: Interrupt Control Service......Page 342
Appendix E: Mutex Services......Page 344
Appendix F: Message Queue Services......Page 359
Appendix G: Counting Semaphore Services......Page 379
Appendix H: Thread Services......Page 395
Appendix I: Internal System Clock Services......Page 427
Appendix J: Application Timer Services......Page 430
Appendix K: ThreadX API......Page 444
C......Page 454
I......Page 455
M......Page 456
T......Page 457
W......Page 458