Você está na página 1de 29

Group members:

Huynh Trung Manh


Pham Hung Thinh
03/31/16

Contents

ThreadX Unique Features


Embedded Applications
ThreadX benefits
Functional Components of ThreadX

03/31/16

ThreadX Unique Features

Picokernel Architecture
ANSI C source code
Not a black box
A potential stantard

03/31/16

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

03/31/16

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

03/31/16

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

03/31/16

ThreadX Unique Features


A potential standard
Versatility
High-performance picokernel
architecture
Portability

potential to become an industry


standard for embedded applications

03/31/16

Embedded Applications
Real-time software
Multitasking
Tasks and Threads

03/31/16

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

03/31/16

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
03/31/16

10

ThreadX benefits

Improved responsiveness
Software maintenance
Increased throughput
Processor isolation
Dividing the application
Easy to use
Improve time-to-market
Protecting the software investment

03/31/16

11

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
03/31/16

12

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

03/31/16

13

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

03/31/16

14

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

03/31/16

15

Functional Components of
ThreadX

Execution overview
Initialization
Thread Execution
Application timers
Memory usage
Interrupts

03/31/16

16

Execution overview
Hardware Reset

Initializati
on

Thread
Executio
n
ISR

03/31/16

Applicatio
n timers
17

Initialization
int main() {
/* Enter the ThreadX kernel.
*/
tx_kernel_enter();
}

Main()

tx_kernel_enter()
tx_application_define(mem
_ptr)
Enter thread Scheduling loop

03/31/16

tx_thread_crea
te

tx_mutex_crea
te

18

Thread Execution
Tx_thread_create
TX_DONT_START

TX_AUTO_START

Ready
State

Thread
scheduling

Suspend
ed State

Executin
g State

Comple
ted
State
03/31/16

Terminate
d State
19

Thread priorities
0
Highest

31
Lowest

Threads can have the same priority as others in the


Application.

Thread priorities can be changed during run-time.

03/31/16

20

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 threads time-slice is assigned
during creation and can be modified
during run-time.
03/31/16

21

Thread Scheduling
Preemption causing :
- starvation
- excessive context switching
overhead
- priority inversion.

03/31/16

22

Thread Scheduling
Preemption-threshold
What is a
preempti
onthreshold

specify a priority ceiling


for disabling preemption

?
Example
?

Higher
priorities
03/31/16

>

>

The ceiling

Lower
priorities
23

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 ?
peripheral
Underlying
hardware

03/31/16

device
interrupts.
24

Memory Usage
Adresses
0x00000000

Instruction Area
ROM
Constant Area
ROM

0x80000000

Initialized Data
Area
RAM
Uninitialized Data
Area
RAM

Static
memory
usage

setup the initialized


data
area in RAM.
Global and
static
variables

System Stack
Area
03/31/16

25

Memory Usage

Dynamic
memory
usage

03/31/16

Control blocks
and memory areas
associated with stacks,
queues,
and memory pools
it facilitates easy
utilization of different
types
of physical memory

26

Thread Stack Area


TX_MINIMUM_STAC
K,

Memory pitfalls

03/31/16

27

Another componnents
Interrupt
Memory
Block
Pools
Event
Flags
03/31/16

Message
Queues
Semaphor
es
Mutexes
28

Q&A
03/31/16

29

Você também pode gostar