CS 452/652 Winter 2020 - Lecture 8
January 22, 2020
prev next
RedBoot
- power cycle: all memory reset, devices reset
- soft reset (red button, reset command, watchdog: low (RedBoot) memory reset, devices reset
- program/kernel memory state from previous crash still available
- return from program/kernel: nothing reset
Task Creation
- allocate task descriptor
- determine unique task id (also used for task container)
- set parent id → current task
- set priority
- set state (probably 'Ready')
- set up execution state (stack and/or task descriptor)
- SVC registers: spsr, lr
- user registers: as necessary
- prepare stack: address in user sp (remember stack is top-down)
- effectively simulate return from system call at the beginning of task's start routine
- task configuration: use single-argument short-cut (see kernel spec) or message passing
Communication: send-receive-reply (SRR)
- sender state: Ready, SendWait, ReplyWait
- receiver state: Ready, ReceiveWait
- sender first
- receiver tid: look up receiver - not in ReceiveWait
- sender blocks (Ready -> SendWait)
- where to store information about senders? per receiver
- receiver arrives to waiting sender
- finds sender - sanity check for SendWait
- sender still blocked (SendWait → ReplyWait)
- kernel copies data
- receiver first
- no sender found
- receiver blocks (Ready → ReceiveWait)
- store receive-blocked tasks in kernel container? only for cleanup/housekeeping
- sender arrives to waiting receiver
- receiver tid: look up receiver - in ReceiveWait
- unblock receiver (ReceiveWait → Ready)
- block sender (Ready → ReplyWait)
- kernel copies data
- reply
- non-blocking: sender must be waiting
- sender tid: look up sender - sanity check for ReplyWait
- unblock sender (ReplyWait → Ready)
- kernel copies data
- receive and reply can be decoupled
- in time: sender parked until later reply (reordering)
- in space: different task replies than original receiver (delegation)
- kernel provides SRR functionality
- provide mechanisms for blocking senders and/or receivers
- message copying for safe asynchronous operation of sender & receiver
- direct copy from sender to receiver and vice versa
- no message buffering in kernel
- kernel must also set return codes appropriately
- messages: structured data
- no conversion marshalling) needed as in heterogeneous distributed systems
- copied as byte (char) array
- type-checking: verify type of message for type of task?
⇒ need at least a global type field per message
Synchronization
- no shared memory; no memory synchronization
- no lock, semaphore, condition variable
- task synchronization via SRR
- resource synchronization via task patterns
- example: track server mediates access to track
- device synchronization via AwaitEvent() system call
Server
- execution pattern:
- receive request
- process request
- (delayed) reply
- server always ready or working, never blocked!
- server never in SRR-"send" role