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

Inter Task Communication Questions and Answers

51.

A design shares a large structure between two tasks and takes a mutex round every access. The response time of the higher priority task is

Answer: C

It may arrive while the lock is held and must then wait for the holder to finish, so the longest critical section enters its analysis as a blocking term. Splitting the structure, or passing messages instead, is how that term is removed.

Please log in or register to report this question.

52.

An intermittent fault appears only when two tasks are both busy. The first structure to examine is

Answer: D

Correct answer: any data the two tasks share without a lock

A fault appearing only when both tasks are active is the signature of a race, and unprotected shared data is where races live. Stack sizes, tick rate and optimisation level can all cause faults, but none of them would depend on two particular tasks running together.

Please log in or register to report this question.

Answer: A

A slow accumulation points at bursts the consumer occasionally fails to absorb rather than at a sustained imbalance, which would have filled the queue in seconds. Enlarging the queue or raising the consumer's priority are the two remedies.

Please log in or register to report this question.

Answer: B

Correct answer: makes the interface between subsystems explicit

A message defines what passes between two subsystems and when, so the interface can be documented, reviewed and tested, and the two can be developed separately. Shared memory leaves the interface implicit in whatever both parties happen to touch, which is exactly what goes wrong when several people work on one system.

Please log in or register to report this question.

Answer: C

Correct answer: giving a semaphore to wake a task

Only the semaphore give is safe: it never blocks and needs no task context. Waiting on a queue, delaying, and taking a mutex all block, and a handler that blocks cannot be resumed - the system either faults or hangs.

Please log in or register to report this question.

56.

A task must wait for either a message or a 100 ms timeout, whichever comes first. This is done by

Answer: D

Correct answer: a queue receive with a 100 ms timeout

The kernel primitive already does exactly this: it returns when a message arrives or when the timeout expires, whichever is first, and reports which happened. Polling in a loop wastes processor time and adds latency, and a second task or a mutex timeout solves a different problem.

Please log in or register to report this question.

Answer: A

Waiting on two queues at once is not a natural operation, so kernels offer a queue set that reports which member has data. Polling both with zero timeouts works but reintroduces the latency and the wasted cycles that blocking avoids.

Please log in or register to report this question.

Answer: B

Bytes written in any quantity can be read in any other, which suits a serial port or an audio stream where the framing is the application's business. A message buffer keeps the boundaries by prefixing each item with its length, and a queue keeps them by fixing the item size at creation.

Please log in or register to report this question.

Answer: C

Variable-length items need their boundaries preserved, and the message buffer stores a length with each one so a read returns exactly one item. A stream buffer would deliver whatever happened to be available and leave the framing to be reconstructed.

Please log in or register to report this question.

60.

A handler and a task share this flag, on a 32-bit core.

volatile uint32_t flag = 0;
/* handler */  flag = 1;
/* task */     if (flag) { flag = 0; handle(); }

The arrangement is

Answer: D

An interrupt falling between the test and the assignment sets the flag and the task then clears it without handling that second event. A semaphore or a notification counts the events instead of merely recording that at least one occurred, which is why they exist.

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