290 likes | 410 Views
Group members: Huynh Trung Manh Pham Hung Thinh. Contents. ThreadX Unique Features Embedded Applications ThreadX benefits Functional Components of ThreadX. ThreadX Unique Features. Picokernel Architecture ANSI C source code Not a black box A potential stantard.
E N D
Group members: Huynh TrungManh Pham Hung Thinh
Contents • ThreadX Unique Features • Embedded Applications • ThreadX benefits • Functional Components of ThreadX
ThreadX Unique Features • Picokernel Architecture • ANSI C source code • Not a black box • A potential stantard
ThreadX Unique Features • Picokernel Architecture • services are implemented as a C library • only services actually used are brought into the run-time image • services plug directly into its core => fastest possible context switching and service call performance
ThreadX Unique Features • ANSI C source code • written primarily in ANSI C. • A small amount of assembly language is needed to tailor the kernel to the underlying target processor ⇒ possible to port ThreadX to a new processor family in a very short time
ThreadX Unique Features • Not a black box • Most distributions include the complete C source code + the processor-specific assembly language ⇒ see exactly what the kernel is doing
ThreadX Unique Features • A potential standard • Versatility • High-performance picokernel architecture • Portability ⇒ potential to become an industry standard for embedded applications
Embedded Applications • Real-time software • Multitasking • Tasks and Threads
Embedded Applications • Real-time software • interaction with the external world • Multitasking • the allocation of the processor between the various application tasks • the primary purpose of ThreadX
Embedded Applications • Tasks and Threads • Task • sometimes means a separately loadable program • In other instances, it might refer to an internal program segment • Thread • A semi-independent program segment that executes within a process • Share the same process address space. • The overhead associated with thread management is minimal
ThreadX benefits • Improved responsiveness • Software maintenance • Increased throughput • Processor isolation • Dividing the application • Easy to use • Improve time-to-market • Protecting the software investment
ThreadX benefits • Improved responsiveness • preemptive, priority-based scheduling algorithm • Software maintenance • Enables developers to concentrate on specific requirements of their application threads without having to worry about changing the timing of other areas of the application
ThreadX benefits • Increased throughput • multi-threading actually reduces overhead by eliminating all of the redundant polling • Processor isolation • robust processor-independent interface between the application and the underlying processor
ThreadX benefits • Dividing the application • Application is divided into clearly defined threads • Ease of use • ThreadX architecture and service call interface are designed to be easily understood
ThreadX benefits • Improve time-to-market • ThreadX takes care of most processor issues • Protecting the software investment • ThreadX insulates applications from details of the underlying processors ⇒ highly portable
Functional Components of ThreadX • Execution overview • Initialization • Thread Execution • Application timers • Memory usage • Interrupts
Execution overview Initialization Hardware Reset Thread Execution ISR Application timers
Initialization int main() { /* Enter the ThreadX kernel. */ tx_kernel_enter(); } Main() tx_kernel_enter() tx_thread_create tx_application_define(mem_ptr) tx_mutex_create Enter thread Scheduling loop
Thread Execution Tx_thread_create TX_DON’T_START TX_AUTO_START Suspended State Ready State Thread scheduling Executing State Completed State Terminated State
Thread priorities 0 31 Highest Lowest • Threads can have the same priority as others in the Application. • Thread priorities can be changed during run-time.
Thread Scheduling • If multiple threads of the same priority : • FIFO • Time-slicing • A time-slice specifies the maximum number of timer ticks (timer interrupts). • The thread’s time-slice is assigned during creation and can be modified during run-time.
Thread Scheduling • Preemption causing : - starvation - excessive context switching overhead - priority inversion.
Thread Scheduling • Preemption-threshold What is a preemption-threshold? specify a priority ceiling for disabling preemption Example ? > > Lower priorities Higher priorities The ceiling
Application timers • applications with the ability to execute application C functions at specific intervals of timers. • Using timer interrupt (timer ticks) 10ms . • How to generate periodic interrupts ? Underlying hardware peripheral device interrupts.
Memory Usage Adresses Static memory usage Instruction Area ROM 0x00000000 Constant Area ROM setup the initialized data area in RAM. 0x80000000 Initialized Data Area RAM Global and static variables Uninitialized Data Area RAM System Stack Area
Memory Usage Control blocks and memory areas associated with stacks, queues, and memory pools Dynamic memory usage it facilitates easy utilization of different types of physical memory
Thread Stack Area TX_MINIMUM_STACK, Memory pitfalls
Another componnents Interrupt Message Queues Memory Block Pools Semaphores Event Flags Mutexes