EXAM 1 Flashcards
(48 cards)
Hard RTS
- Must meet its deadline with zero flexibility ( or near-zero degree of flexibility)
- Result is useless if computed after the dealine
- If the deadline is missed, it can be catastrophic, costly, may involve human life or entire system damage
Soft RTS
- There is a level of flexibility in meeting the deadline
- Applied when
- > Does not involve catastrophic failures
- > It is still acceptable ( within a frame of tolerance)
- > Can be somehow corrected by approximation, etc.
- Occasional soft or permanent soft RTS
RTS Requirement
Computation must be finished before reaching a given deadline
Differentiation of Hard vs. Soft
- Hard RTS – at deadline you have a deterministic value/action
- Soft RTS – the value can be an estimation
Corrections for Hard and Soft
- Hard systems make every effort in predicting if a pending deadline might be missed
- > Anticipation of a missed deadline
- > Envelope of deadline ‘safety zone’
- > Able to apply corrective actions before a catastrophe
- > Compensate by computing estimations forward instead relying on precise values
- Soft systems may have recovery actions after the deadline is missed – think about resynchronization
Deterministic Character
- In RTS, timing correctness complements functional correctness – they coexist
- You work with functional and timing issues, and moreover, you synchronize functions by means of accepting/issuing timing events
- RTS have substantial knowledge of the controlled environment as well as the controlled system itself
- RTS have deterministic character
- > Because the response time to a dedicated event is bonded
- -> Fixed bonding
- -> Flexible bonding
- > Actions are taken in response to an event as known a-priori
- > They are less adaptable to the changing environment
- -> Dedication to a mission
- -> Because of lack of adaptation they can be less robust
- > Levels of determinism and robustness can be balanced (some form of adaptation may be permitted)
- > This balancing is application specific
Round Robin Scheduling
Tasks all get an equal amount of time, sharing the processing unit equally. Typically, there is a variation of scheduling algorithms used, such as preemptive attributes allow a round robin scheduler to have higher priority task interrupt a task execution.
Preemptive Priority Scheduling
Tasks are executed based of priority. This is often used in conjunction with another algorithm, such as round robin.
Objects
- Special constructs that are the building blocks for application development for RTOS
- > Tasks - concurrent and independent threads of execution that can compete for CPU execution time
- > Semaphores - are token-like objects that can be incremented/decremented by tasks for synchronization or mutual exclusion
- > Message queues - are buffer-like data structures that can be used for synchronization, mutual exclusion, and data exchange by passing messages between tasks.
- Developers can combine these objects (and others) to solve common real-time problems such as concurrency, activity synchronization, and data communication
Services
- Help developers to create applications
- They comprise sets of API calls to kernel objects, or in general to facilitate timer management, interrupt handling, device I/O, and memory management
The five key characteristics of an RTOS
- Reliability
- Predictability
- Performance
- Compactness
- Scalability
Reliability
- One of the most important characteristics
- Must need to operate for long periods of time without human intervention
- Some may allow reset, others will not allow due to consequences
- Reliability is influenced by all components (hardware and software)
Predictability
- Meeting time requirements
- Deterministic - must have predictable behavior
- Measuring:
- > Testing time responses in different situations
- > Computing the variance of the response times for each type of system call
Performance
- How fast deadlines are met
- Measuring:
- > MCU MIPS
- > Throughput - measure overall system performance
- -> The rate at which a system can generate outputs based on inputs coming in
- -> The amount of data transferred divided by the time taken (bps)
- > Call-by-call
- -> Use of timestamps to indicate when a system call started and when finished
Compactness (plus weight and software size)
- Physical size (final product)
- Resources taken (understanding memory requirements is very important
Scalability
- RTOS should scale-up (or scale-down) to meet a wide variety of applications
- Depends on a number of functionalities used
- Ability to add extra modules/services
Tasks
An independent thread of execution, which it can compete with other tasks for execution.
Idle task
- This is a system task of lowest priority executing an endless loop
- Executed when no other task can run
- It can be a user supplied routine
Task execution states
- Ready state
- Blocked state
- Running state
Task states must be maintained by a kernel.
Task in Running state
- Task switching will need to swap register content
- involved in task control execution
- holding local variables/pointers
- No need to swap global variables/pointers
- A running task can move to the blocked state
- By making a call that requests an unavailable resource
- By making a call that requires to wait for an event to occur
- By making a call to delay the task for some duration
- In non-RTOS systems, you will need to have a register/memory model
Task in Blocked state
- Without being blocked by resources - it means, a lower priority task could not run (CPU starvation)
- Blocking conditions include:
- A semaphore token for which a task is waiting
- A message, on which a task is waiting
- A time delay imposed on the task
Task creation and deletion
- In non-RTOS systems, you want tasks to be in memory as static objects
- Static memory allocation for data is preferred
- Dynamic memory allocation will add a lot of complications
- Creating a task is simply initializing it and moving to the Ready state
Task Scheduling
- In non-RTOS systems, there is a lot of freedom in designing a task scheduling algorithm
- rule of thumb: simple approach first, then complicate later
- include objects involved in blocking (semaphores/tokens, message queues)
- preemption lock - used when a task is in a critical section of code, which cannot be preemted by other tasks ( also known as an atomic operation)
- a mechanism is needed to support this feature
- task completion
- run-to-completion tasks vs. endless-loop tasks
- An oversight is needed to detect and escape scheduler misbehavior
- Use FSM approach to model the scheduler
Semaphores and the types
A kernel object that one or more threads of execution can acquire or release for the purpose of synchronizaiton or mutual exclusion (token)
- Allows a task to carry out some operations or access a reasource
types:
- Binary semaphore
- Counting semaphore
-Mutual exclusion semaphore (Mutex)