Скачать презентацию Engineering Open House Need students to demo Скачать презентацию Engineering Open House Need students to demo

3e3f5159cb9637ca2d9109df1236c7a6.ppt

  • Количество слайдов: 16

Engineering Open House • Need students to demo their players on – Friday 3 Engineering Open House • Need students to demo their players on – Friday 3 -4 – Saturday 10 -2.

Embedded Software Architectures • No Operating System – Round robin: sequential polling for events Embedded Software Architectures • No Operating System – Round robin: sequential polling for events – Round robin w/ interrupts – Function Queue Scheduling • Real Time Operating System

Maestro in RR+INT volatile bit f. End. Of. Slice, f. Serial; void isr(void) interrupt Maestro in RR+INT volatile bit f. End. Of. Slice, f. Serial; void isr(void) interrupt … { process_tones(); if (!--slice. Count) { change. Tones(); slice. Count = Slice. Size f. End. Of. Slice = TRUE; } } void serial(void) interrupt …{ time. Critical(); f. Serial = TRUE; } What are the time critical functions? Flipping channels, change tones at end of timeslice What are the housekeeping functions? TNE count down and stream processing (TNE, Tones) main () { if (f. Serial) {process_serial_data(); f. Serial = FALSE; }Do these have hard time if (f. End. Of. Slice) { constraints too? if (--TNE==0) Yes, one time slice process_next_event(); f. End. Of. Slice = FALSE; (18 ms)…good enough? } Not necessarily…serial is } undefined!

Task Diagram Worst case analysis: character comes one cycle before TF 0 Worst case Task Diagram Worst case analysis: character comes one cycle before TF 0 Worst case latency: Sum of max of all task functions. Advantage over RR: Critical Stuff happens in ISR time slice start time slice end serial_isr serial housekeeping main timer 0 overflow occurs (TF 0) char arrives deadline Can we do better?

Function Queue void isr(void) interrupt … { process_tones(); if (!--slice. Count) { change. Tones(); Function Queue void isr(void) interrupt … { process_tones(); if (!--slice. Count) { change. Tones(); slice. Count = Slice. Size; enq(process_time_slice); } } void serial(void) interrupt …{ time. Critical(); enq(process_serial_data); } void main(void) { while (1) if (f = deq()) { *f()); } You get a scheduling opportunity every time a task completes. What is the advantage of this? Programmer can set priority for task functions. Worst case latency for priority n task function? Sum of max execution time for all task functions of priority > n + max current task With only two tasks, it is the same as RR+INT. And it does not allow any nondeterministic tasks.

Task Diagram Worst case analysis: Its actually different…serial has to get started Worst case Task Diagram Worst case analysis: Its actually different…serial has to get started Worst case latency: Sum of max of all task functions Advantage: Can support priorities, but still at mercy of slowest task. time slice start time slice end serial_isr serial housekeeping main timer 0 overflow occurs (TF 0) char arrives deadline Can we do better?

Comparison Non OS Architectures • See Chapter 5, table 5. 1 Simon Comparison Non OS Architectures • See Chapter 5, table 5. 1 Simon

Real Time Operating Systems • What is the basic thing we want the OS Real Time Operating Systems • What is the basic thing we want the OS to do to help us improve worst case latency? Enable multithreading • How? Define an OS time-slice (tick) at which highest priority ‘runnable’ task is continued. Priority function determines response behavior. • Simplest Scheduling algorithm: each task gets at most 1 tick at a time to run. Round Robin Scheduling. Worst case task latency = #tasks*tick. Worst case run time = ticks/task * #tasks • Some properties of such system: liveness, safety, fairness, latency, overhead. • Other niceties: Device Drivers, Synchronization, Data Sharing (messages, queues, etc. ), Memory Management

Programmers View void tone_isr(void) interrupt … { Advantages: process_tones(); if (!--slice. Count) { • Programmers View void tone_isr(void) interrupt … { Advantages: process_tones(); if (!--slice. Count) { • Deterministic response time change. Tones(); even w/ non deterministic slice. Count = Slice. Size isr_send_signal(MUSIC); tasks lengths. } • Incremental development } void serial_isr(void) interrupt …{ time. Critical(); Resources: os_send_signal(SERIAL); } • Task switching overhead void play(void) _task_ MUSIC { • Memory overhead os_create(SERIAL); while (1) {os_wait(); • Use of system timer process_next_event(); } • Degrades best case response } void serial(void) _task_ SERIAL { time. while (1) {os_wait(); process_serial_data(); } // os_create(MUSIC)? } Tasks are threads

Task Diagram os time slice music time serial_isr music_isr os time slice start serial Task Diagram os time slice music time serial_isr music_isr os time slice start serial music OS Char arrives Music task is never more than one OS time slice away os time slice music time slice end

Another Solution • Multiprocessor: Dedicate one processor to each (or a few) tasks. • Another Solution • Multiprocessor: Dedicate one processor to each (or a few) tasks. • Still need synchronization and communication. • Our Orchestra network could be an example of a multiprocessor system

Design Meeting • What’s next? – Streaming Design Meeting • What’s next? – Streaming

Orchestra Functions • • Time of day Get data from net, send to player Orchestra Functions • • Time of day Get data from net, send to player or to pilot Send music to net Get music from net Play music Task to play music from net Task to create/delete other tasks (master)

Basic Architecture of an RT OS • Task Table – Process state, signal flag, Basic Architecture of an RT OS • Task Table – Process state, signal flag, time_out counter, context • System Interrupt Service Routine (timer) • System Calls (Code, time)

Benefits Benefits

Embedded Software • Software States v. Finite State Machines • Hierarchical State • Thread/Process Embedded Software • Software States v. Finite State Machines • Hierarchical State • Thread/Process Communication – Critical Sections – Synchronization – Messaging and Signaling