Machine-translated by Google. Questions are authored in English.
Top

Inter Task Communication Questions and Answers

31.

Deadlock requires that four conditions hold together. They are mutual exclusion, hold and wait, no preemption and

Answer: C

Correct answer: circular wait

Coffman’s four conditions must hold together: mutual exclusion, hold and wait, no preemption, and a circular chain of tasks each waiting for a resource the next holds. Breaking any one prevents deadlock, and imposing a global lock ordering is the usual way of breaking the fourth.

Please log in or register to report this question.

32.

Two tasks each hold one lock and wait for the other's. This is

Answer: D

Neither will release, neither can proceed, and nothing in the system will change: the classic deadly embrace. Livelock differs in that the tasks keep running and keep failing, and starvation in that progress is possible but never granted.

Please log in or register to report this question.

Answer: A

A global order makes a circular wait impossible, and it costs nothing at run time - only discipline at design time. Timeouts and retries detect and recover from deadlock rather than preventing it, and can degenerate into livelock.

Please log in or register to report this question.

Answer: B

Correct answer: continue to execute but make no progress

Livelocked tasks are running, responding to one another and consuming processor time, but the system as a whole advances not at all - two tasks each backing off and retrying in step, for example. Deadlocked tasks are blocked and consume nothing, which is why livelock is harder to spot in a profile.

Please log in or register to report this question.

Answer: C

Correct answer: higher priority work is always ready to run

A strict priority scheduler runs the highest priority ready task, so a low priority task starves whenever something above it is always ready. It is a scheduling outcome rather than a locking fault, and the remedies are ageing the priority, reserving a share of processor time, or reconsidering the priority assignment.

Please log in or register to report this question.

Answer: D

Correct answer: giving each lock a longer timeout

A longer timeout makes a deadlock last longer before it is detected; it does nothing to prevent one. The other three each break a Coffman condition: lock ordering breaks circular wait, message passing removes the shared resource, and holding fewer locks reduces hold and wait.

Please log in or register to report this question.

Answer: A

Correct answer: a queue written from the handler with a zero timeout

A queue carries the data as well as the signal, and the from-interrupt variant with zero timeout never blocks - which is essential, since a handler that blocks cannot be resumed. A mutex must not be taken in a handler at all, and polling a global variable adds latency and race conditions.

Please log in or register to report this question.

Answer: B

Blocking in a handler is impossible, so the only options are to drop the item or to overwrite one, and either way the loss should be counted so it can be seen. A persistent overflow count is the signal that the queue or the consumer needs attention.

Please log in or register to report this question.

39.

A sensor produces a 4-byte sample every 2 ms and the consuming task runs every 50 ms. The queue must hold at least

Answer: C

Correct answer: 25 samples

\[ \frac{50\ \mathrm{ms}}{2\ \mathrm{ms}} = 25\ \mathrm{samples}. \] That is the minimum, and a real design would add margin for jitter in the consumer’s scheduling. Sizing to the exact figure leaves nothing for the case where the task runs a little late.

Please log in or register to report this question.

40.

For that same arrangement, the memory the queue occupies is at least

Answer: D

Twenty-five slots of four bytes is a hundred bytes, plus the queue's own control structure of perhaps eighty more. On a part with two kilobytes of RAM that is a fifth of the budget for one sensor, which is why queue sizing is done deliberately rather than generously.

Please log in or register to report this question.

Loading…
Tags: Inter Task Communication Questions and Answers || Inter Task Communication MCQ Questions and Answers || Inter Task Communication GK Questions and Answers || Inter Task Communication GK MCQ Questions || Inter Task Communication Multiple Choice Questions and Answers || Inter Task Communication GK || GK on Inter Task Communication || Embedded Systems Questions and Answers || Embedded Systems MCQ Questions and Answers || Embedded Systems GK Questions and Answers || GK on Embedded Systems