---
# System prepended metadata

title: Klausur 2020
tags: [SEII]

---

---
tags: SEII
---

# Klausur 2020

Textinput box where you type in your answers.  
You don't have to use tools, no coding (maybe pseudo code), no drawing.

### 01_IntroductionWCET

- There could be an example system
    - state if it's a soft or hard real time system
    - meeting deadlines?
- Define real time systems
    - differentiate
    - response times
- Obstacle Avoidance
    - not relevant to know all about the forces and calculations
    - accelerometer not important
    - skip all until `page 47` (Terms and Definitions)
- Terms and definitions
    - Code fragment given, Posix pthread main, question would be explain what is a job and what is a task in this implementation
    - Explain Job vs Task and Thread vs Process
    - example is on `page 48`
    - how would you estimate/determine the WCET in a practical example?
        - maybe with some code
        - also some information about the hardware
        - Qualify approaches and compare them, justify answer
    - What influences wcet | hardware, software
    - How could you determine WCET in example on `page 49`
    - variability important for calculation WCET -> execution time varies depending on the variables
    - timing by measurements | profiling
    - characterize a given system (soft | hard, fast | slow)

### 02_Scheduling
- why do we need scheduling? -> parallism
    - from the scheduling respective it does not matter how i implement a task (Thread or processes)
    - memory protection for process, slower more overhead
    - threads faster but no protection
    - periodic time Ti, Capacity Ci
    - for Ci we usally use the WCET, it cant be longer than that
    - relation between Scheduling and WCET is depicted on slide 8
    - wcet is primary input for schedulability analysis in cheddar
    - schedulability analysis is used to determine if all tasks meet the deadline
- Processors
    - not always cpu, bus system can be a processor
    - messages on the bus are the units of calculation, they take a certain amount of time depending on the bitrate 1 Mbit/s = 1 ms
        - 135bits -> 135µs
    - the same theory of U can be used for system without tasks
        - U is the some of all Ci and Ti U < 0.69
    - practical examples
- Jitter
    - if the area between is not the same for every interval, there will be a measurement error for calculating the area under the curve (e.g. we have a threshold of 84, than we can deploy the airbag for example if the area is 85)
    - keep jitter low
- Classification of scheduling policies
    - almost no one uses Fair scheduling policies
    - when to use what
    - round robin and time division round robin -> tasks of the same priority
    - priority base scheduling is important
    - RMS important
    - Cyclic executive : split your code in functions
        - endless for loop, tasks are just functions, wait inbetween
        - inside tasks no endless loop
        - sum up all times, needs to be less than hyperperiod
    - in exam there might be a taskset, like on `slide 27`
    - question is: find a schedule for cyclic executive
        - create sudo code
    - also pseudo code, do analysis if schedule is feasable
- Priority based scheduling
    - static vs fixed vs dynamic
    - dynamic -> deadline when task has to be finished
- RM
    - we look at periodic time (T1, T2, T3)
    - the fastest task gets highest priority
    - execution time not relevant for determining the priority
    - exam: Taskset, T1, C1 given, assign priorities, show that there is a feasable schedule or not, do all of the tasks meet the deadlines
    - with rm you calculate the overall utilization, `Page 34`
    - we have to calculate response time analysis in an iteration (output is also used as input)
    - exam: taskset (T1, T2), assign priorities, Liu/Layland/hyperbolic, then to be 100% sure run response time analysis -> example on `page 38`
    - Theoretical question: compare Liu / layland with response time analysis -> what would be best in which context?
    - or equation given, compare explain variables (Ci, Ti, n, Ri, Tk, hp(i))
- Handling Aperiodic Jobs
    - we dont process something aperiodic immediately, could lead to deadline miss
- Practical questions from assignment 2


### 03_Resources

- posix
    - post, init(0|1 unlocked or locked), wait, destroy
- Semaphores
- Deadlock
    - 4 conditions, if you can get rid of one there is no deadlock anymore
    - exam: piece of code with tasks, information about runtime of tasks, ressources and where its taken and released -> is there a possible deadlock in this piece of code | or there is a deadlock -> how can you get rid of the deadlock
- priority inversion
    - exam. code sample, can inversion occur?
    - how can you fix this code?
    - will be based on posix api
    - is there a deadlock in it
- response time analysis with blocking times
    - determine the worst case response time for certain task
    - wcet != responsetime
    - exam: something like on `slide 46`
- operating system overheads
    - exam: explain the meaning of all the symbols and indices in this equation `slide 50`

### 04_RTOS

- Posix
    - How can you implement periodic processing with code `slide 45`
- Time handling
    - exam: theoretical, task 1/2, periodic times, then implement that `slide 57`

### 05_UMLRealtime

- Exam : again a taskset, Ti, Ci and Deadlines and priorities given, find out other columns `slide 58`
    - describe in text how those SPT tags would look like
- Describe what it would like in a diagram `slide 52-54` and `slide 59`
### 06_Memory

- exam: describe what could be a possible cause of fragmentation, solutions, consequences
    - dont have to know the specifics of c++
- case study given, event queue, events, pool: describe the situation, what kind of memory allocation would you propose in this situation
    - pool, fixed case, smart pointer -> you don't have to know how it's actually implemented
- example with reference counting, little bit of code and the question could be: what type of memory pattern would you propose and what would be the consequences?
- reference counting cant handle circles -> code: how you break up the cicles that reference counting works, weak pointers and ? pointers
- assignment -> use a memory pool


### 07_FaultTolerance
- not too many theoretical questions about that
- 10 rules for developing Safety criticial code
    - Code fragments: how could you improve this samples? whats the problem, how could you do it better?
    - what rules are violated
- an example system, availabilities of each component, apply Triple Modular Redundancy Pattern, calculate overall availability
    - bug detection
    - what rules are violated
    - how could you improve availability
    - what patterns would you use in this situation, why (safety reliability patterns) `slide 2`
- `slide 55`: describes a certain situation, decide which pattern could be helpful and why?
