Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Engineering Open House Need students to demo their players on –Friday 3-4 –Saturday 10-2."— Presentation transcript:

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

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

3 Maestro in RR+INT volatile bit fEndOfSlice, fSerial; void isr(void) interrupt … { process_tones(); if (!--sliceCount) { changeTones(); sliceCount = SliceSize fEndOfSlice = TRUE; } void serial(void) interrupt …{ timeCritical(); fSerial = TRUE; } main () { if (fSerial) {process_serial_data(); fSerial = FALSE;} if (fEndOfSlice) { if (--TNE==0) process_next_event(); fEndOfSlice = FALSE; } 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) Do these have hard time constraints too? Yes, one time slice (18ms)…good enough? Not necessarily…serial is undefined!

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

5 Function Queue void isr(void) interrupt … { process_tones(); if (!--sliceCount) { changeTones(); sliceCount = SliceSize; enq(process_time_slice); } void serial(void) interrupt …{ timeCritical(); enq(process_serial_data); } void main(void) { while (1) if (f = deq()) { *f()); } 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 non- deterministic tasks. You get a scheduling opportunity every time a task completes.

6 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. main housekeeping serial char arrives timer0 overflow occurs (TF0) Can we do better? isr time slice starttime slice end deadline serial_isr

7 Comparison Non OS Architectures See Chapter 5, table 5.1 Simon

8 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

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

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

11 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

12 Design Meeting What’s next? –Streaming

13 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)

14 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)

15 Benefits

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


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

Similar presentations


Ads by Google