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

Inter Task Communication Questions and Answers

Answer: A

Averages hide the burst that arrives while the consumer is busy elsewhere, and the item lost is gone. Where losing data is acceptable the queue may be sized for the average and the overflow counted instead, which is a legitimate but deliberate choice.

Please log in or register to report this question.

Answer: B

Correct answer: fill and then block or overflow, whatever its size

A queue absorbs a burst, not a sustained mismatch. At 100 items a second of surplus, any finite queue fills in a finite time, after which the producer blocks or items are lost. The remedy is to make the consumer faster or the producer slower - a larger queue only postpones the moment.

Please log in or register to report this question.

43.

Match the construct with the problem it solves.

1. Mutex   2. Counting semaphore   3. Message queue

P. Passing data between tasks   Q. Mutual exclusion with ownership   R. Counting available instances of a resource

Answer: C

Choosing the wrong one of the three is the commonest structural mistake in a first kernel design: a mutex used for signalling, or a semaphore used where ownership was needed. Each answers a different question and none substitutes for another.

Please log in or register to report this question.

44.

Match the failure with its description.

1. Deadlock   2. Livelock   3. Starvation

P. Running but never progressing   Q. Never scheduled although able to run   R. Each party waiting for the other

Answer: D

Correct answer: 1-R, 2-P, 3-Q

Three distinct failures. Deadlock is each party waiting for what the other holds, so nothing runs. Livelock is running without progressing. And starvation is being able to run but never being scheduled, because something of higher priority is always ready.

Please log in or register to report this question.

45.

Put the steps of a producer-consumer exchange in order.

1. Producer signals the filled-slot semaphore   2. Producer waits on the free-slot semaphore   3. Consumer removes the item   4. Producer writes the item into the buffer

Answer: A

Space is secured first, then the item is written, then its presence is announced, and only then can the consumer take it. Signalling before writing is the classic error and lets the consumer read an item that is not yet there.

Please log in or register to report this question.

46.

Consider the following statements about mutexes and semaphores.

1. A mutex has an owner   2. A semaphore may be given from an interrupt handler   3. A binary semaphore is eligible for priority inheritance

Answer: B

The first two are correct and are the practical distinctions. Inheritance needs an owner to promote, so a semaphore cannot participate in it however it is being used, which is the strongest argument for using a mutex where a lock is meant.

Please log in or register to report this question.

47.

Consider the following statements about queues.

1. A queue copies the message by default   2. A send with a zero timeout may fail   3. A queue removes the need for any synchronisation between the tasks

Answer: C

Copying and the possible failure of a non-blocking send are both correct. A queue is itself the synchronisation, and it removes the need for locks only for the data it carries: anything else the tasks share still needs protecting.

Please log in or register to report this question.

Answer: D

Correct answer: taking a mutex

A mutex has an owner and supports priority inheritance, neither of which means anything in an interrupt handler - there is no task to own it and no priority to inherit. Worse, blocking on it would be fatal, since a handler cannot be suspended. The other three all have non-blocking from-interrupt variants.

Please log in or register to report this question.

Answer: A

Handing an item over and forgetting it removes every opportunity for a race, whereas shared memory leaves the discipline to every future maintainer. That confinement of the shared state is precisely why the queue is the safer structure.

Please log in or register to report this question.

Answer: B

The reason is a correct account of what volatile does, and it has nothing to do with atomicity: a preemption can still fall between the two halves of a 32-bit access on an 8-bit core. Atomicity needs a lock, a critical section or an atomic instruction.

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