Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 466 – Fall Introduction - 1

Similar presentations


Presentation on theme: "CSE 466 – Fall Introduction - 1"— Presentation transcript:

1 CSE 466 – Fall 2000 - Introduction - 1
Threads and Stacks Process: entire address space is private Threads: heap is common, but stack is private. What if stack wasn’t private? DATA DATA stack stack task 1 context ? task 1 context sp globals globals sp context swap OS OS regs regs CSE 466 – Fall Introduction - 1

2 How TINY manages the stack
worst case stack size is sum of worst case for each task, plus ISR’s. One stack/thread stack 3 stack 3 stack 3 stack 2 stack 2 stack 1 stack 2 stack 1 stack 1 sp globals sp globals sp globals OS OS OS regs regs regs CSE 466 – Fall Introduction - 2

3 CSE 466 – Fall 2000 - Introduction - 3
Reentrant Stack re-stack 3 I don’t know why the compiler doesn’t use the regular stack for re-entrant function calls! Probably so that user can put re-entrant stack into external data memory this is inefficient, so limit use of re-entrant functions. re-stack 2 re-stack 1 re-sp stack 3 stack 2 stack 1 sp globals OS regs CSE 466 – Fall Introduction - 3

4 Is this safe (this is about parameter passing, not stack stuff)
int function average(int a, int b, int c, int d, int e, int f) { return ((a+b+c+d+e+f)/6); } void task1 _task_ 1 (void) { int a,b,c,d,e,f; disable(); average(a,b,c,d,e,f); enable() CSE 466 – Fall Introduction - 4

5 CSE 466 – Fall 2000 - Introduction - 5
Embedded System Types Data flow dominated Systems our music player a network router queues, messages, packets, routing Control Dominated Systems Software State machines, distributed state management/synchronization, e.g. power plant, autopilot, etc. CSE 466 – Fall Introduction - 5

6 CSE 466 – Fall 2000 - Introduction - 6
Design Meeting Music Packet format: TNE.CHAN,(CHAN==0?OPCODE:TONE),[TONE,[TONE]] even if CHAN == 0, TNE is valid. That’s why we can’t use TNE field for OPCODE. TNE is not always 31 when CHAN==0. From last week: player has “modes”. IDLE, all commands from the pilot are in the form of ASCII characters: ‘S’ and ‘T’? STREAMING all commands come in the form of music opcodes: OPCODE == 0 means stop. This is a good choice because, if we set TNE == 0, then okay if interpreted as TONE, we will start turning off the music anyway. So: x.0,0 means stop. The player should send at least 0’s to stop the player. Is it safe to set TNE == 0? Check your software!! Stop means return to IDLE mode. OPCODE == 1 means CONTINUE, and TNE is valid OPCODE == 2 means PAUSE (was stop). Okay?? if we are paused… how do we resume? What if we want to clear the buffer and start over? do we need more commands? Do we need to define a new mode? -- PAUSED? Do we need any other opcodes? TRANSMITTING How to we enter that mode? what form do commands take? is PAUSE supported? What is the format for a complete song? What does the pilot send to the player to transmit a song? CSE 466 – Fall Introduction - 6

7 Mode (State) Diagram for the Player
IDLE STREAM what is the difference between IDLE and PAUSED? Modes are like states in an FSM…but they are not static. What does that mean? There is an execution sequence associated with each mode. Mode determines response to events and choice of next mode Tx PAUSED CSE 466 – Fall Introduction - 7

8 An Alternative: Is this equivalent?
‘S’/clearb() ‘R’ STREAM IDLE STOP STOP ‘T’/clearb() Tx CSE 466 – Fall Introduction - 8

9 Communication and Synchronization
Semaphores Queues: Messages, Mailboxes, and Pipes Events Rendezvous CSE 466 – Fall Introduction - 9


Download ppt "CSE 466 – Fall Introduction - 1"

Similar presentations


Ads by Google