Exam Questions Flashcards

1
Q

The Underground Tank Monitoring System is a classic example of an embedded system in that it involves input (sensors/buttons), output (display/printer) and real-time constraints. true/false

A

an underground tank mointoring system would include all of those logically, so yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. Several models of computation for embedded systems are described in [Lee:2002].
    • The ROS software is a prime example of the publish-and-subscribe model. true/false
A

true, that s exactly what ROS is

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. Finite State Machines can be coded in a number of ways in C.
    • In the function-based solution, every state is encoded as a separate function.
A

true, you have a pointer that memories the address of a function and that is how it changes the current state, by changing whatever is in that pointer variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Specifying the type of statefp is difficult in C because forward declarations are not supported for function types.

A
  1. what are forward declarations?
    1. a statement that declares the existence of a variable or struct or function without providing any actual implementation for it
    2. usually when a program needs to refer to a function or struct that has not yet been declared in code, but will be declared later
    3. and, it is supported in C.
      1. thus the statement is FALSE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Valgrind is programming tool that provides controlled execution, as well as post mortem inspection of an executable.

A

this is false because this is actually what GDB does.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To guarantee atomicity task switching must be disabled.

A
  1. Atomicity is when a set of instructins to happen as a single, indivisible unit. An atomic op
    1. guarateed to execute completly and without interruption
    2. no intermediate states visible to other operations
    3. they are either fully executed or not at all
    4. no ops can interffer with them during operations
    5. usually implemented with mutexes and semaphores
    6. Interrupts and atomicity
      1. Because interrupts can interrupt execution, they can be disabled during critical sections to avoid them firing during an atomic op.
      2. or they can use mutexes etc

Task switching

  • it s very important to the CPU and disabling it is usually not an option, or a very bad one
    • to preserve atomicity and not have it be affected by ttask switching (witch usually cant even be disabled) the only practical and used way is to use mutexes and semaphores.
      • so, disabling task switching is a bad idea, cant be done and the answer is false
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. Since disabling interrupts increases interrupt latency, several alternative methods have been developed for dealing with shared data.
    • The Alternating Buffers technique can be used between two “communicating” tasks provided that the “producer” runs at a higher priority than the “consumer”.
A
  • Alternating Buffer
    • it is a technique for dealing with shared data.
      • multiple buffers are used to hold shared data.
      • each thread uses its own buffer where it writes or reads data, or at least there are many buffers that can do this. This is faster then mutexes or semaphores as it has far less overhead and is better for the shared data. However it is difficult to implement and work with, but it can be done in very memory / power /computation critical systems
      • Yes it is based on the consumer and producer design pattern and the producer must have a higher priority for it to make sense.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Priority inversionrequires a minimum of 3 tasks of different priority and 1 semaphoreto occur.

A
  1. this is to be remebered because it s a standard question
    1. So, for a deadly embrace you need at least 2 tasks to hold eachother resources and mutexes.
    2. But for priority inversion you need at least 1 semaphore and at least 3 tasks to invert the priority.
    3. (Think about cups)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

An interrupt vector contains the address of an ISR.

A

The itnerrupt vector is a vector containing the address of ISRs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

An ISR must be reentrant.

A

this is false because it should be reentrat but if u really need to, u can make it non reentrant. A bullshit question but remember it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The software architecture of the Network Simulator NS2 mainly uses the data flow computation model.

A

NS2 (network simulator 2)

  • open soruce discrete network network sim that is used for research.
  • simulates behaviour of packages transfered through TCP, UDP, HTTP and FTP and others
    • The statement is false because NS2 uses the discrete event simulator model.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

With an FQS architecture, a task signaled by an ISR is executed immediately after that ISR completes execution.

A
  1. well it’s a queue so, if it follows the order of the queue the answer is no. However reasoning about the theory from FQS we know that the tasks have priority among themselves and the ISRs do too. Also, it s logical that ISRs have priority above any task.
    1. And with all this, also the fact that traditional task switching is not supported in FQS. I think that this would make a lot of sense to be false. Because of the no task switching part. However it is false it implies that after an ISR finishes the signaled task doesnt activate until the queue reaches it.
      1. function signaled by an ISR means → ISR notifies the scheduler that a certain function is READY to be executed and the ISR schedules the task to be executed as fast as possible (adds it at the killing end of the queue)
        1. makes it execute as fast as possible
          1. HOWEVER, this is not as fast as the ISR finishes, because even if it schedules it at the begining of the queue, THER IS A TASK STILL LEFT RUNNING AND THAT MUST FINISH FIRST, so it is not exactly after the ISR finishes.
            1. IT IS THUS FALSE.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A separate hardware timer is needed for providing extremely accurate timing in RTOSs.

A
  1. This is false because the hardware timer is built-in for the RTOS systems.
    1. an RTOS is pretty demanding and thus it has a more powerful chipset installed - >
      1. it has more stuff on the chipset, like a hardware timer.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In the RR architecture, the worst-case response time of a task is the sum of the response times of the higher-priority tasks.

A

false because in RR the tasks have NO PRIORITY.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In an RTOS, tasks can be in state BLOCKED, READY or RUNNING.

A
  • a task starts in the state RUNNING.
    • in my logic, blocked is blocked, running is already running and ready is when it is ready to run, so at the instant of the start, it goes from ready → running. I say ready is the answer, thus it is false.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

An ISR may change a task’s status from RUNNING to READY.

A

an ISR can block a task, but to make it ready (considering that the task is interrupted by it) makes no sense. I think it has to go to blocked and then unblock when the ISR is finished executing. → it is false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

An ISR must not invoke an RTOS function that may block.

A

Interrupting a function and the interrupt itself calling a functionn that may block can cause a clusterfuck as it blocks a running task stopped by an IR. It s a serious clusterfuck of a system event so it must NOT happen as there is no good outcome possible form it. BEst case is the entire system halting or slowing the fuck out of it.
MUST not happen → TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

A function can be made reentrant by temporarily disabling interrupts, but additional bookkeeping is required as simply enabling interrupts on exit may cause errors.

A

This is true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

When upgrading to an RTOS, signaling between ISRs and tasks may still be done through flags residing in global memory.

A
  1. Handling of the ISR in an rtos functions in the following way
    1. there is a “global” counting semaphore on the main shared memory, created with kernel functions. That is used to signal, block, reenter etc of a task / function when a IR is triggered. A flag is a binary thing, however that is not enough, a proper counting semaphore is required for this to work properly
      1. thus i consider it false, because it should be done with a ‘global’ SEMAPHORE not FLAG.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

A program running on an RTOS may create tasks dynamically at runtime. the program ends as soon as the main() function returns.

A

This is false. Think about it like an OS, the os doesnt terminate whenever a function terminate, only when the PC is shutdown. THis is still an OS, but a very low level & specialized one.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

the semaphore “lock” must be initalized to 0 in the following C code:

os_pend(lock)
if (++cnt == 1) // first reader
os_pend(read_or_write)
os_post(lock)
…. // read action
os_pend (lock)
if (–cnt == 0) //last reader
os_post(read_or_write)
os_post(lock);

A

Here, the answer is false.
This is because due to many, many readers, it must be a counting semaphore. A counting semaphore is initalizes with the number of max resources that can simultaniosly aquire a resource, thus if it is 0, a resource can never be aquired and the program will forever halt ->fucked. Must never happen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

reader code : “os_pend(lock)
if (++cnt == 1) // first reader
os_pend(read_or_write)
os_post(lock)
…. // read action
os_pend (lock)
if (–cnt == 0) //last reader
os_post(read_or_write)
os_post(lock);” and writer code : “os_pend(read_or_write)
…// write action
os_post(read_or_write)
QUESTION: Semaphore read_or_write must be initialized to the number of writers.

A
  1. the number of tasks that can aquire the resource at one point is the initalization of the semaphore. Now, let s reason about what should that be.
  2. from what it seems, it is a binary semaphore, and there is only one writer here
    1. This is false. I got it wrong. Let s see why
      • let s anaylize how this code works
        • the purpose of ******read_or_write****** is to protect a shared resource that can be accessed by either a single writer or multiple readers at a time.
          • this is inialized with a value of 1, which means that one thread can hold it a time. → it s binary
        • the purpose of lock is to protect the cnt value.
          • also with value of 1, both being binary
            • **********the question is thus false, as it must be initalized to 1, as it is binary**********
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The writer task can be “locked out” when multiple readers keep doing their actions while cnt never returns to zero.
- Such starvation can be avoided by assigning the writer task a priority higher than any reader.

A

false, because it remains locked nevertheless by the mutex / semaphore, so priority wouldnt mean anything in this context

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

The heartbeat timer is a single hardware timer an RTOS is using to verify that the system is still progressing (i.e. not deadlocked).

A

false. It checks if it is still running and components are still alive. Doesnt check for deadlock as when it is deadlocked, technically it is still running.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

An RTOS usually provides two types of delay functions: polling-based and timer-based.

A
  • Polling-based delays
    • continiosuly checking (polling) a condition to check when a specific time interval has passed
  • Timer-based delays
    • this type involve hardware timers trigger an interrupt after a specific time has elapsed.
  • There are no ticks specified, thus no.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q
  1. Assume that one system clock tick = 10 ms.
    • Calling the functionOSTimeDly(4) causes a delay of exactly 40 ms.
A

false, it is never perfect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q
  1. To address the shared-data problem, many RTOSs provide communication primitives likequeues, mailboxes, and pipes.
    • the unique property of a mailbox is that it can accept items from different tasks.
A
  • the unique property of a mailbox is that it can accept items from different tasks.
    • false.
      • MAILBOXES
        • sending and receiving messagess between tasks in RTOS.
        • fixed sized buffer that can hold multiple messages.
        • tasks can send messages to a mailbox and receive using the receive operation
        • useful for sending large data structures between tasks
        • each data can have VARIABLE LENGTH
        • can receive data from multiple tasks.
          • the question is false because this isnt what makes it UNIQUE.
      • Queues
        • a mechanism for sending and receiving data between tasks in an RTOS
        • fixed sized buffer that can send data, each has a FIXED LENGTH.
      • Pipes
        • unidirectional mechanism for sending data between tasks in an RTOS
        • a pipe typically has a fixed size buffer that can hold multiple data items, each of witch has a fixed length.

→ (back to the question) the mailbox has the unique attribute of being able to store data of variable length, and that it can acccept data from multiple tasks is true but NOT UNIQUE, all of them can.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

A disadvantage of queues over pipes is that messages/items are handled strictly in FIFO order.

A

This is false. While a Queue is fifo, this is not striclty as u can have multiple oprations on it + a queue is bidrectioonal while a pipe is unidrectional. THere are many ways to approach this question and they all lead to a false answer. Plus they are not stricly FIFO.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Printing from an ISR is to be avoided except when the RTOS provides a reentrant primitive to do so.

A

true.

30
Q

An advantage of using tasks is that it allows for better data encapsulation.

A
  1. data encapsulation
    1. OOP concept that refers to a practical bundeling of data and the methods that oprerate on that data.
      1. it s true but i coinsider it to be a bad question.
31
Q

An ISR may not call OSPost as that may affect response time and may even cause deadlock!

A
  1. os post unlocks a lock / semaphore decreases.
    1. deadlocks can happen when it tires to lock a resource, not unlock it.
      1. false, but still shouldnt happen cause it can fuck up the memory logic.
32
Q
  1. Several models of computation for embedded systems are described in [Lee:2002].
    • Process Networks are primarily used to describe concurrency at the hardware level.
A
  • process networks
    • are ways of designing embedded software where fault resistance is very important.
    • they consist of intervowen processes that communicate with eachother through shared memory, queus or pipes or sockets.
    • they are not hardware level, they are software level.
      • **the question is false**
33
Q

Embedded programming is more difficult than “classical” programming because of the event-based programming model.

A
  1. This is a very bad question.
    1. so, embedded programming is harder then classical programming due to many reasons, the event based programming model being on of them
    2. so it is true
    3. but there are also other programming models
    4. and there are other reasons as to why it is false.
34
Q

Because embedded software engages the physical world, it has to embrace time and other non-functional properties, which requires the use of interrupt handlers to guarantee responsiveness.

A
  1. This is a very bad question.
    1. so, the statement says that interrupt handlers are required for responsiveness.
      1. but there are also other ways to achieve responsiveness.
        1. like polling
          1. false
35
Q
  1. Valgrind is programming tool that aids memory debugging.
    • it does so by executing a program in a safe environment
A

true, and the system calls and memory addresses are replaced with it s own mocks for easier tracking of every memory leak and the such.

36
Q

“typdef void (resolve) (void * old, void * new) “. this eclares resolve as a pointer to a function that takes two void
pointers as arguments and returns a void pointer as result.

A

true

37
Q

When a processor in an embedded system is powered up, interrupts are enabled to meet response-time requirements.

A
  1. they are enabled at startup, but they are not due to response time requirements
  2. even if they improve response time as a general thing
38
Q

The X32 interrupt controller and CPU use a three-way handshake to change the priority of an interrupt source (i.e. hardware device). true/false

A

false
the 3 way handshake is a network protocol

39
Q

Although there are techniques to avoid disabling interrupts, such as alternating buffers or using queues, they are fragile and should only be used if absolutely necessary.

A
  1. this statement is comepletly true.
    1. true
40
Q

an intept service routing should restore the context upon entrancce

A

false. That is handled by the rest of the system, not the ISR.

41
Q

When detecting a car crash an airbag should not be inflated instantly. Does RR support delayed actions?

A
  • the architecture itself doesnt. When u answer these questions u must only focus on the the question. But these are really bad questions anyway.
42
Q

The software architecture of the Network Simulator NS2 mainly uses the discrete events computation model.

A

the discrete events computation model is commonly used to simulate networks. Thus i think this is true.

43
Q
  1. Time-slicing should be avoided in an RTOS because it makes the response time of tasks less predictable.
    1. eacch task has a special time attributed to it, so i dont see how it would make response time less predictable, on the contraty, it makes it more predictable.
A
  1. true
    1. it adds additional overhead and if a task runs out of time to run, it can be preempted or blocked. Increasing unpredictability
44
Q

A guiding principle of embedded system design is to only create dynamic tasks when needed, even when the memory footprint is not an issue.

A

false, there is no such principle

45
Q

A guiding principle of embedded system design is to only create dynamic tasks when needed, even when the memory footprint is not an issue.

A

false, there is no such principle

46
Q

The ROS master provides naming and registration services to ROS nodes, and tracks publishers and subscribers to topics and services.

A

true

47
Q

With instruction set simulators, the whole platform can be simulated. true/false

A
  1. it is a software simulaotr of the CPU, in low level.
  2. but platform refers to the entire device, with senzors etc included
    1. which cant be simulated
    2. just the cpu can
    3. false
48
Q

the size of an int is architecture dependant

A

C is structured around the int, and the int is dpendentant on the architecture

49
Q

An interrupt service routine does not need to be allocated its own call stack.
- its activation record(s) can simply be allocated on the stack of the task that is being
interrupted

A

it s true

49
Q

An interrupt service routine does not need to be allocated its own call stack.
- its activation record(s) can simply be allocated on the stack of the task that is being
interrupted

A

it s true

50
Q

at startup, the interrupts are disabled

A

true

51
Q

at startup, the interrupts are disabled

A

true

52
Q

in RR, shared data probem doenst exist

A

true, each task has a fixed time to run, leading to no shared data

53
Q

Code coverage tools help in thorough testing.
- a good testset includes more cases than needed to achieve 100% coverage

A

true

54
Q

assert can only be used on host

A

false

55
Q

When debugging code for a distributed sensor network, collecting the (debug) output of
the nodes can be arranged in different ways.
- A wireless testbed requires physical instrumentation (i.e. wiring) of the sensor node.

A

true

55
Q

When debugging code for a distributed sensor network, collecting the (debug) output of
the nodes can be arranged in different ways.
- A wireless testbed requires physical instrumentation (i.e. wiring) of the sensor node.

A

true

56
Q

an ISR should save state upon entering

A

true

57
Q

The Alternating Buffers technique can be used between two “communicating” tasks of
equal priority.

A

This statement is false because the Alternating Buffers technique can be used between two communicating tasks of different or equal priority. The priority of the tasks is not relevant to the use of Alternating Buffers technique.

58
Q

While interrupts are disabled atomicity is guaranteed even when calling a non-reentrant
function.

A

true. remember what atomicity means from IDM

59
Q

In an RTOS, tasks can be in state BLOCKED, READY or RUNNING.
- a task starts in the state READY.

A

true

60
Q

A reentrant function may use hardware only in an atomic way

A

true

61
Q

a task can signal an ISR by operating a semaphore

A

false

62
Q

A reentrant function may use hardware only in an atomic way

A

true

63
Q

With the simple OS Pend()/OS Post() interface the RTOS cannot know in advance
which semaphore(s) will be used by a task.

A

true

64
Q

With the simple OS Pend()/OS Post() interface the RTOS cannot know in advance
which semaphore(s) will be used by a task.

A

true

65
Q

es requires a large volume of scale

A

false

66
Q

fsm can be made such that user acton triggers state changes

A

false

67
Q

int in C has at least 16 but the exact # of bits is archtiecture depndant

A
68
Q

queue inbetween a producer and consumer task can be controlled by a counting
semaphore that records the number of items in the queue.

A

true

69
Q

A program running on an RTOS may create tasks dynamically at runtime.
- the program ends once main() and all spawned tasks have finished.

A

true

70
Q

In the implementation of the OS Pend() primitive, the RTOS first switches the state of
the current task to BLOCKED, and then looks for a task in the READY queue.
- if the READY queue is empty the processor may be put into sleep mode to save energy
when idling.

A

true