1What is software architecture (SEI definition)?
The set of structures (elements, relationships, properties) needed to judge whether a system can meet key requirements
2Does all software have an architecture?
Yes, whether designed or "just grown"
3Why does architecture matter if the software works functionally?
Structure determines qualities beyond functionality, like ease of change and bug rate
4What is one measure of overall software quality?
The effort required to meet the client's needs over the long term
5What makes a software architecture "good"?
Its structures achieve the qualities considered important, possibly at the expense of less important ones
6What is understandability as a quality attribute?
How easily developers can understand the software while working on it
7What is modifiability as a quality attribute?
How easily the software can be added to or changed
8Which two quality attributes are usually implicit goals of any software design?
Understandability and modifiability
9Which quality often conflicts with understandability and modifiability?
Performance
10What is testability?
Ease of applying test inputs and observing outputs to verify the software
11What is portability?
Ease of transferring software to a different hardware or software platform
12What is maintainability?
Ease of understanding, modifying and testing code
13What three properties does software security preserve?
Confidentiality, integrity and availability
14What is availability?
The software being usable when needed
15What is scalability?
Ease of extending the software to handle larger loads
16What is robustness?
Ability to respond well to abnormal conditions or edge cases
17What is safety as a quality attribute?
Ability to avoid incorrect outputs or actions
18What is the "conceptual model" architecture decision?
Which abstractions or data structures the system uses
19What is the "allocation of responsibilities" architecture decision?
How functionality is split into subsystems and modules
20What is the "allocation of behaviour" architecture decision?
How activities map to tasks or threads, and how those map to modules
21What is the "coordination" architecture decision?
Whether and how parts of the system communicate
22What is the "resource management" architecture decision?
How memory, peripherals and computing time are managed
23What is the "binding time" architecture decision?
When in the lifecycle (build, run time, later) other decisions take effect
24What three questions guide architecture design?
Which qualities matter, what structures achieve them, and how to communicate the decisions
25How do you identify important qualities for an architecture?
From the requirements
26What quality do requirements to do many things at once or respond quickly suggest?
Timing performance
27What quality do memory or power constraints suggest?
Resource performance
28What qualities do requirements to handle errors suggest?
Safety, robustness, testability or availability
29Why must you identify likely modifications, not just "modifiability"?
No design can support every possible change equally
30What is the Information Hiding principle?
Components share as little information as possible; changeable decisions are hidden behind stable interfaces
31What is the Minimal Communications principle?
Components communicate with as few others as possible through the smallest interfaces
32What is the Direct Mapping principle?
Components map clearly to problem-domain concepts
33What is the Single Responsibility principle (architecture level)?
Each component is responsible to one stakeholder, so has one source of reasons to change
34What is the Open-Closed principle?
Components are open for extension but closed for modification
35What is the Dependency Inversion principle?
Components should depend on stable abstractions rather than concrete details
36Which two principles together increase "orthogonality"?
Information Hiding and Minimal Communications
37What are the SOLID principles mentioned in architecture?
Single Responsibility, Open-Closed and Dependency Inversion (among others)
38What is an architectural pattern?
A recurring structural template that is a good starting point for a design
39Can multiple architectural patterns be combined?
Yes, they can be used together or nested
40What is the Layered architecture pattern?
Software split into layers, each serving the layer above through a defined interface and only talking to adjacent layers
41What is a common embedded example of a layered architecture?
A Hardware Abstraction Layer (HAL)
42Which qualities does a layered architecture support?
Portability and modifiability
43Is "software architecture" the same as "creating some layers"?
No, layering is just one pattern
44What is the Ports and Adapters (Hexagonal) pattern?
Core logic talks to the outside only through abstract ports; adapters convert each external device to a port interface
45What is the main emphasis of Ports and Adapters?
Separating external interactions from internal logic
46Which qualities does Ports and Adapters support?
Portability, testability and modifiability
47What is the Microkernel pattern?
A core of common services with problem-specific components plugged in
48What is a common embedded example of a microkernel architecture?
An RTOS with tasks running on it
49Which principle does the Microkernel pattern commonly implement?
Open-Closed
50What is the Pipes and Filters pattern?
Data-transforming components (filters) connected by possibly buffered pipes
51Where is Pipes and Filters common?
Signal processing systems
52Which qualities does Pipes and Filters support?
Modifiability (loose coupling) and performance (parallelism)
53What is an Architecture Haiku?
A terse one-page document of purpose, key structure, driving requirements, trade-offs and rationale
54What is an Architecture Decision Record (ADR)?
An incremental record of a decision: the concern, options considered and reasons
55What are the sections of an ADR?
Context, Decision, Consequences
56What statuses can an ADR have?
Proposed, Accepted, Rejected, Superseded
57What is the C4 model?
A lightweight approach to diagramming software architecture
58What is a limitation of C4 diagrams?
They show structure but need extra documentation to explain why
59How can you evaluate whether an architecture achieves its goals?
By assessing it against scenarios that capture quality requirements
60What is a very lightweight scenario evaluation?
Check whether the architecture handles the scenario without changes
61What is a lightweight scenario evaluation?
Assess the number and scope of changes needed
62What is a more involved scenario evaluation?
Quantitative estimates of magnitude, complexity or cost of the changes
63What good source of scenarios does agile offer?
User stories
64What are architectural tactics?
Individual design decisions that influence quality attributes; patterns combine them
65What is coupling?
Strength of relationships between elements in different modules
66What is cohesion?
Strength of relationships between elements within the same module
67To improve modifiability, what should happen to cohesion and coupling?
Increase cohesion, decrease coupling
68Which of these are tactics to increase cohesion?
- Split large modules
- Group elements affected by the same change
- Factor out common responsibilities
- Add intermediaries
69Which of these are tactics to decrease coupling?
- Encapsulate behind stable interfaces
- Use an intermediary like an adapter
- Parameterise behaviour
- Merge modules
70What modifiability tactic involves timing?
Defer binding or configuration until later in the lifecycle
71What are the two groups of timing performance tactics?
Control demand and manage resources
72Which of these are tactics to control timing demand?
- Reduce sampling rate
- Limit event arrival rates
- Prioritise events
- Add more indirection
73What timing tactic trades accuracy for speed?
Bounding execution time
74What timing tactic conflicts with modifiability?
Eliminating intermediaries to reduce overhead
75Which of these are tactics to manage resources for timing?
- Increase resources
- Introduce concurrency
- Cache or precompute
- Schedule limited resources
76Which of these are testability tactics?
- Executable assertions
- Abstract data sources
- Specialised test interfaces
- Remove indirection
77What other testability tactics exist besides assertions and test interfaces?
Keep state in one place, sandbox the system, replay recorded interactions
78Why does modifiability often trade off with time performance?
It needs indirection, which adds overhead
79Why does testability often trade off with time performance?
It needs indirection, which adds overhead
80What is the classic trade-off between execution speed and resources?
Speed versus memory
81Why can responsiveness trade off against power?
Responding fast may mean avoiding sleep wake-up latency
82Why can determinism trade off against responsiveness?
Deterministic timing may require polling instead of reacting immediately to events
83What is an example of abstraction costing performance?
Arduino digitalWrite() is about 20× slower than direct port writes
84What are the steps of re-architecting?
Assess existing structures, list quality requirements, evaluate existing architecture, apply patterns/tactics and re-evaluate
85What is a software "structure"?
A collection of elements and relationships between them
86What are the three categories of software structure?
Static, dynamic and allocation
87What are static structures?
Conceptual abstractions a developer works with (decomposition, dependency, class)
88What are dynamic structures?
Relationships in executing software (collaboration, data-flow, task)
89What are allocation structures?
Mapping of software to external things (memory map, implementation, deployment)
90In a decomposition structure, what is the relationship?
"Submodule of"
91In a dependency structure, what is the relationship?
"Depends on"
92In a class structure, what are the relationships?
Inheritance and association
93In a data-flow structure, what are the elements?
Processes and stores, connected by flows of data
94In a task structure, what are the elements?
Tasks and objects, connected by interactions
95In a memory map structure, what are the elements?
Data and addresses
96In a deployment structure, what are the elements?
Software and hardware
97Which views help reason about modifiability and testability?
Decomposition or class views
98Which views help reason about portability?
Dependency/layer and memory map views
99Which views help reason about security and safety?
Data-flow and collaboration views
100Which view helps reason about task performance and availability?
Task view
101Which view is often used for security threat modelling?
Data-flow diagrams
102What three properties should a concurrent program maintain?
Safety, liveness and responsiveness
103What is safety in concurrency?
Nothing bad ever happens; no incorrect state is reached
104What is liveness?
Something useful eventually happens; the program makes progress
105What is responsiveness (bounded liveness)?
The program makes progress within a deadline
106Why is concurrency introduced into embedded systems?
To improve maintainability and responsiveness of independent activities
107What property does concurrency typically compromise?
Safety
108When do safety failures from concurrency occur?
When tasks make uncoordinated changes to a shared resource
109What is an interleaving?
A possible mixed sequence of actions from concurrent tasks, each keeping its own order
110What is a race condition?
An unpredictable outcome that depends on the interleaving of actions
111What is a critical section?
Code sensitive to race conditions that must execute atomically
112What is an atomic action?
An action that executes as one uninterruptible unit
113In preemptive execution, what is usually the atomic unit without concurrency control?
A single machine instruction
114Is a single C statement like counter = counter + 1 atomic?
No, it compiles to several load/add/store instructions
115Why is counter = counter + 1 unsafe across tasks?
A context switch mid-update can overwrite another task's change
116What should you assume about interleavings when analysing concurrent code?
Any interleaving could happen
117What advantage does cooperative scheduling have for concurrency?
Each task controls when others run, so it defines its own atomic sections
118What are the four strategies to prevent race conditions?
Immutability, atomic data, synchronization, containment
119What is the immutability strategy?
Never change shared values once created
120What is a memory-friendly alternative to immutability?
Allow only one owner of a memory chunk at a time
121What is the atomic data strategy?
Share only data that can be updated atomically
122What is the synchronization strategy?
Force tasks to align at points so changes appear atomic
123What is the containment strategy?
One task owns the resource; others interact only via messages
124Which two race-prevention strategies are the most flexible?
Synchronization and containment
125Which strategy does disabling interrupts around a critical section use?
Synchronization
126Which strategy does a FreeRTOS message queue implement?
Containment (plus immutability, atomic data and internal synchronization)
127What is a mutex?
A lock that only one task can hold at a time; others block until it is released
128What does "mutex" stand for?
Mutual exclusion
129Which FreeRTOS function creates a mutex?
xSemaphoreCreateMutex
130Which FreeRTOS function locks a mutex?
xSemaphoreTake
131Which FreeRTOS function unlocks a mutex?
xSemaphoreGive
132What type is a FreeRTOS mutex handle?
SemaphoreHandle_t
133Which header is needed for FreeRTOS mutexes and semaphores?
semphr.h
134What concurrency property can blocking compromise?
Liveness
135What is deadlock?
Tasks waiting on each other so none make progress
136What condition causes deadlock?
A circular wait (cycle of ungranted requests)
137Can a single task deadlock itself?
Yes, e.g. by taking a mutex it already holds
138What kind of mutex avoids a task deadlocking on its own lock?
A recursive mutex
139What is livelock?
Tasks aren't blocked but keep cycling without progress
140What can cause livelock?
Using timeouts to escape deadlock
141Two tasks each take one of two mutexes then try for the other. What happens?
Deadlock
142What is the basic rule to avoid mutex deadlock?
Always acquire mutexes in the same order
143Can deadlock occur in purely message-based systems?
Yes, if tasks block waiting for responses in a cycle
144What is the bug in a task that takes a mutex in one branch but always gives it at the end?
Mutex takeive are unbalanced, and the mutex is held during the delay
145What are two tactics to avoid circular waits?
Restrict connection directionality and minimise circular dependencies
146What is a pipeline task structure?
Data flows one way through a chain of tasks, each transforming it
147Why can't a pipeline deadlock?
It contains no cycle of tasks
148Can a pipeline branch?
Yes
149What is a client-server task structure?
A client initiates requests; a server passively waits and responds
150Why can't client-server deadlock?
The server only waits for requests and the client only waits for responses
151How many servers can a client interact with at once?
Only one at a time
152Can a server act as a client to other servers?
Yes, forming a tree with no cycles
153Should a server task initiate interactions with its clients?
No
154What is a Synchronized ADT?
A passive module that encapsulates a resource behind functions with internal synchronization
155What is another name for a Synchronized ADT variant?
Monitor object
156When is a Synchronized ADT a good choice?
When a synchronous response is needed and blocking won't delay other tasks
157What are the benefits of a Synchronized ADT?
Mutexes aren't scattered, clients can't touch them, and lock order is enforced in one module
158Should Synchronized ADTs call other Synchronized ADTs?
No, it risks deadlock
159What is a server task in concurrency design?
A task that contains a resource and serves requests through a message interface
160What is another name for the server task pattern?
Active object
161When is a server task a good choice?
When background work is needed, or long critical sections shouldn't block callers, and async responses are acceptable
162What task pattern should a server task use?
Event-driven
163What is priority inversion?
A high-priority task is blocked by a low-priority task holding a mutex, which is itself preempted by a medium task
164What is the consequence of priority inversion?
The high-priority task may miss its deadline
165What is priority inheritance?
A low-priority task blocking a higher one temporarily inherits the higher priority
166Does FreeRTOS support priority inheritance?
Yes, for mutexes
167What is better than priority inheritance?
Avoiding priority inversion altogether
168What is starvation?
Some tasks can't progress because they can't get resources or CPU time
169When is starvation most likely among non-critical tasks?
When several share the same priority
170How does time slicing help prevent starvation?
Equal-priority tasks share CPU time round-robin
171What is a fair mutex?
One that ensures every waiting task eventually acquires it, e.g. by queuing
172Are FreeRTOS mutexes known to be fair?
No
173What is a semaphore?
A synchronization tool with an atomic count; decrementing below zero blocks the task
174What is a binary semaphore?
A semaphore whose count is only 0 or 1
175How does a mutex differ from a binary semaphore?
A mutex starts released and should only be released by its holder; a semaphore can be given by any task
176When should you use a mutex vs a semaphore?
Mutex to protect shared resources; semaphore to signal between tasks
177Which FreeRTOS function creates a binary semaphore?
xSemaphoreCreateBinary
178How does a task wait for a semaphore signal?
xSemaphoreTake
179How does a task send a semaphore signal?
xSemaphoreGive
180Besides mutexes and semaphores, what other FreeRTOS signalling tool exists?
Task notifications
181What is legacy code (Michael Feathers)?
Code without tests
182Why is hacking new features into messy code a bad option?
It adds to the mess and easily introduces bugs
183Why is rewriting from scratch often a bad option?
It's time-consuming, means maintaining two versions, and brings new bugs
184Why is refactoring without tests risky?
There's no guarantee functionality is preserved
185What is the entry point to making legacy code changeable?
Adding tests
186What are the three ways to prioritise tests for legacy code?
Targeted, characterisation and strategic tests
187What are targeted tests?
Tests added where code needs to change
188What is the targeted test policy?
Test where change is needed, test-drive changes and new code, then refactor
189What is the Boy Scout rule?
Leave the code cleaner than you found it
190What are the benefits of targeted tests?
Iterative, as-needed, and still allows feature delivery
191What are characterisation tests?
Tests written to capture and verify understanding of existing behaviour
192Do characterisation tests aim to fix bugs?
No, only to document actual behaviour
193When does actual behaviour become the specification?
When the documentation is outdated
194What are strategic tests?
Tests added proactively to protect key functionality
195Give an example of where strategic tests are valuable
A flight controller's control algorithm or a medical device's safety checks
196What are the four steps to put legacy code under test?
Identify the area, find test points, break dependencies, write tests
197What is a test point?
A place in code where you can control the code under test and observe its effects
198Which test point is most effective?
Function calls
199What should be done with existing global variables used as test points?
Encapsulate them as soon as possible
200Why do stable interfaces make the best test points?
They don't change during refactoring, so tests aren't fragile
201What is a fragile test?
One that must change whenever the code is refactored
202What does "breaking dependencies" mean?
Isolating the code under test from the rest of the application
203What can you do when dependencies seem unbreakable?
Make the smallest refactoring to create test points, possibly a temporary global
204How should risky pre-test changes be made safer?
Rigorous manual testing and a colleague's review
205How can main() be excluded from unit tests via the preprocessor?
Rename it with a macro under a UNIT_TEST define
206What is the cost of preprocessor "hacks" for testing?
They introduce technical debt
207How can an infinite task loop be tested?
Use a macro so the loop runs once under UNIT_TEST
208What is the alternative to preprocessor hacks for testability?
Extract code into a separate module or function and cover the change with manual tests
209How do testing and clean code relate?
Testability and clean design reinforce each other, together making code changeable