View
227
Download
1
Category
Preview:
Citation preview
8/18/2019 8. ThreadX-presentation TN
1/29
Group members:Huynh Trung ManhPham Hung Thinh
03/31/16 1
8/18/2019 8. ThreadX-presentation TN
2/29
Contents• ThreadX Unique Features• Embedded Applications•
ThreadX benefts• Functional Components o ThreadX
03/31/16 !
8/18/2019 8. ThreadX-presentation TN
3/29
ThreadX Unique Features• "ico#ernel Architecture• A$%& C source code•
$ot a blac# bo'• A potential stantard
03/31/16 3
8/18/2019 8. ThreadX-presentation TN
4/29
ThreadX Unique Features• "ico#ernel Architecture
– ser(ices are implemented as a C librar) – onl) ser(ices actuall) used are brou*ht
into the run+time ima*e – ser(ices plu* directl) into its core ,-
astest possible conte't s.itchin* and
ser(ice call per ormance
03/31/16
8/18/2019 8. ThreadX-presentation TN
5/29
ThreadX Unique Features• A$%& C source code
– .ritten primaril) in A$%& C – A small amount o assembl) lan*ua*e is
needed to tailor the #ernel to theunderl)in* tar*et processor
possible to port ThreadX to a ne.processor amil) in a (er) short time
03/31/16 2
8/18/2019 8. ThreadX-presentation TN
6/29
ThreadX Unique Features• $ot a blac# bo'
– ost distributions include the completeC source code 4 the processor+specifcassembl) lan*ua*e
see e'actl) .hat the #ernel is doin*
03/31/16 6
8/18/2019 8. ThreadX-presentation TN
7/29
ThreadX Unique Features• A potential standard
– 5ersatilit) – i*h+per ormance pico#ernel
architecture – "ortabilit)
potential to become an industr)standard or embedded applications
03/31/16 7
8/18/2019 8. ThreadX-presentation TN
8/29
Embedded Applications• 8eal+time so t.are• ultitas#in*•
Tas#s and Threads
03/31/16 9
8/18/2019 8. ThreadX-presentation TN
9/29
Embedded Applications• 8eal+time so t.are
– interaction .ith the e'ternal .orld•
ultitas#in* – the allocation o the processor bet.eenthe (arious application tas#s
– the primar) purpose o ThreadX
03/31/16 :
8/18/2019 8. ThreadX-presentation TN
10/29
Embedded Applications• Tas#s and Threads
– Tas#• sometimes means a separatel) loadable
pro*ram• &n other instances; it mi*ht re er to an internal
pro*ram se*ment – Thread
• A semi+independent pro*ram se*ment thate'ecutes .ithin a process
• %hare the same process address space• The o(erhead associated .ith thread
mana*ement is minimal
03/31/16 10
8/18/2019 8. ThreadX-presentation TN
11/29
8/18/2019 8. ThreadX-presentation TN
12/29
ThreadX benefts• &mpro(ed responsi(eness
– preempti(e; priorit)+based schedulin*al*orithm
• %o t.are maintenance – Enables de(elopers to concentrate on
specifc requirements o their applicationthreads .ithout ha(in* to .orr) aboutchan*in* the timin* o other areas othe application
03/31/16 1!
8/18/2019 8. ThreadX-presentation TN
13/29
ThreadX benefts• &ncreased throu*hput
– multi+threadin* actuall) reduceso(erhead b) eliminatin* all o theredundant pollin*
• "rocessor isolation – robust processor+independent inter ace
bet.een the application and theunderl)in* processor
03/31/16 13
8/18/2019 8. ThreadX-presentation TN
14/29
ThreadX benefts•
8/18/2019 8. ThreadX-presentation TN
15/29
ThreadX benefts• &mpro(e time+to+mar#et
– ThreadX ta#es care o most processorissues
• "rotectin* the so t.are in(estment – ThreadX insulates applications rom
details o the underl)in* processors hi*hl) portable
03/31/16 12
8/18/2019 8. ThreadX-presentation TN
16/29
Functional Components o ThreadX
• E'ecution o(er(ie.• &nitiali=ation•
Thread E'ecution• Application timers• emor) usa*e• &nterrupts
03/31/16 16
8/18/2019 8. ThreadX-presentation TN
17/29
E'ecution o(er(ie.
&nitiali=ation
ThreadE'ecutio
n
&%8 Application timers
ard.are 8eset
03/31/16 17
8/18/2019 8. ThreadX-presentation TN
18/29
&nitiali=ation
ain>?
t'@#ernel@enter>?
t'@application@defne>mem @ptr?
Enter thread %chedulin* loop
int main>? /B Enter the ThreadX #ernelB/ t'@#ernel@enter>? D
03/31/16 19
t'@thread@create
t'@mute'@create
8/18/2019 8. ThreadX-presentation TN
19/29
Thread E'ecution
03/31/16 1:
Terminated %tate
Completed
%tate
E'ecutin* %tate
%uspended %tate
8ead)%tate
T'@thread@create
TX@AUT @%TA8T TX@< $ T@%TA8T
Threadschedulin*
8/18/2019 8. ThreadX-presentation TN
20/29
Thread priorities
0 31
Highest Lowest
• Threads can ha(e the same priorit) as others in theApplication
• Thread priorities can be chan*ed durin* run+time
03/31/16 !0
8/18/2019 8. ThreadX-presentation TN
21/29
Thread %chedulin*
• & multiple threads o the same priorit) G• F&F• Time+slicin*
• A time+slice specifes the ma'imumnumber o timer tic#s >timerinterrupts?
•
The thread s time+slice is assi*neddurin* creation and can be modifeddurin* run+time
03/31/16 !1
8/18/2019 8. ThreadX-presentation TN
22/29
Thread %chedulin*• "reemption causin* G
+ star(ation
+ e'cessi(e conte't s.itchin*o(erhead + priorit) in(ersion
03/31/16 !!
8/18/2019 8. ThreadX-presentation TN
23/29
Thread %chedulin*• "reemption+threshold
Hhat is apreempti
on+threshold
I
speci ) a priorit) ceilin*
or disablin* preemption
i*herpriorities > The ceiling Jo.er priorities>
03/31/16 !3
E'ampleI
8/18/2019 8. ThreadX-presentation TN
24/29
Application timers• applications .ith the abilit) to
e'ecute application C unctions atspecifc inter(als o timers
• Usin* timer interrupt >timer tic#s?10ms
• o. to *enerate periodic interrupts IUnderl)in*hard.are
peripheralde(iceinterrupts
03/31/16 !
8/18/2019 8. ThreadX-presentation TN
25/29
emor) Usa*e
&nstruction Area8
Constant Area8
&nitiali=ed
8/18/2019 8. ThreadX-presentation TN
26/29
emor) Usa*e
8/18/2019 8. ThreadX-presentation TN
27/29
8/18/2019 8. ThreadX-presentation TN
28/29
Another componnents
&nterrupt
emor)Nloc#"ools E(entFla*s ute'es
%emaphores
essa*eOueues
03/31/16 !9
8/18/2019 8. ThreadX-presentation TN
29/29
Q !
03/31/16 !:
Recommended