CS452 - Real-Time Programming - Spring 2009
Lecture 10 - Create
Practical Detail
- More to read on the web site
Context-Switch Tricks
Barriers
Information in one context that you need in another
Memory Use
Frame pointer
Cache
Easy by itself
Memory management is also easy by itself
- just do it as part of the context switch
- one not-so-easy aspect
Cache and memory management together
- write through has few problems
- write back requires cache synchronization
Create
We already talked about what you have to do in the kernel
How do we implement the API for user code?
- This requires a bit of assembly language.
- In assembly language all arguments & return values are words.
- usually pointers
- stored in registers
- What happens when there are too many arguments?
- What happens when
Create is called?
- Two arguments
- stored in
r0 and r1
- which is which?
- Immediately placed on the stack, referred to by
fp
- Create puts them in the special place you choose
swi switches context into the kernel.
- What happens when
Create returns?
- When the kernel is finished manipulating
TDs and
PQs
- it knows the tid to be returned
- it places the tid in the caller's return value in its
TD
- When the caller is next activated,
- as part of activation the return value is put in your special
place, usually
r0
- user code has to get it and put it in the compiler's special
place,
r0 for gcc.
Inter-task Communication
The Send-Receive-Reply model
- Send blocks
- Receive blocks
- Reply does not block
What is synchronized?
- Synchronized means
- two or more things happen during the same kernel action
- End of first phase of
Send & return of
Receive
- Sender changes from
RECEIVE_BLOCKED to
REPLY_BLOCKED.
- Receiver is
READY
- Return of
Send & return of Reply
- Sender, Replier both
READY
- Only one will run
Return to: