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

Device Drivers Questions and Answers

Answer: C

Data arrives when the device chooses and is read when the application gets round to it, so something must hold it in between. How much is needed follows from the arrival rate and the longest the consumer may be delayed.

Please log in or register to report this question.

32.

A UART driver receiving at 115 200 baud, 8N1, must accept a byte every

Answer: D

Correct answer: about 87 \( \mu \)s

8N1 sends ten bits per byte - a start bit, eight data bits and a stop bit - so the byte rate is \[ \frac{115200}{10} = 11{,}520\ \mathrm{bytes\ per\ second}, \] one every 86.8 microseconds. Dividing the baud rate by eight instead of ten gives a figure that is ten per cent too optimistic, which matters when sizing the interrupt budget.

Please log in or register to report this question.

33.

For that same 115 200 baud link, a receive buffer emptied every 10 ms must hold at least

Answer: A

At 11 520 characters a second, ten milliseconds brings 115.2 of them, so 128 would be the size chosen. Sizing it for the average rather than for the longest gap between reads is what produces an overrun that appears only under load.

Please log in or register to report this question.

Answer: B

The hardware holding register was overwritten by the next character, so a byte is lost irrecoverably. Enlarging the driver's buffer does not help; the handler must be entered sooner, or DMA must take over the reception.

Please log in or register to report this question.

Answer: C

Correct answer: stop the sender when its buffer is nearly full

Hardware flow control gives the receiver a line it can deassert to say stop, and the sender pauses until it is reasserted. That prevents overrun on a link where the receiver cannot always keep up. It does nothing about corruption or disconnection, which need a checksum and a separate signal.

Please log in or register to report this question.

36.

Match the driver style with when it suits.

1. Polled   2. Interrupt-driven   3. DMA-driven

P. High continuous data rate   Q. Short wait during initialisation   R. Occasional events at unpredictable times

Answer: D

The three styles form a progression in both capability and complexity, and the right choice follows from the rate and the predictability of the arrivals. Using the wrong one wastes either processor time or engineering effort.

Please log in or register to report this question.

37.

Match the Linux mechanism with its context.

1. Top half   2. Tasklet   3. Workqueue

P. Interrupt context, deferred   Q. Interrupt context, immediate   R. Process context, may sleep

Answer: A

What each may do follows entirely from its context, and the commonest kernel bug in this area is sleeping somewhere that cannot. A tasklet is deferred but still in interrupt context, which is the distinction people miss.

Please log in or register to report this question.

38.

Consider the following statements about drivers.

1. The driver should hide the register layout   2. A callback may run in interrupt context   3. A driver called from two tasks needs no protection

Answer: B

Correct answer: 1 and 2 only are correct

Statements 1 and 2 are correct: hiding the register layout is the driver’s purpose, and a callback registered with a driver may well be invoked from its interrupt handler. Statement 3 is the assumption that produces intermittent faults - shared state reached from two tasks needs protection whether or not the fault has yet appeared.

Please log in or register to report this question.

39.

Consider the following statements about the Linux driver model.

1. The major number selects the driver   2. ioremap maps a physical register block   3. A tasklet may call a sleeping function

Answer: C

Correct answer: 1 and 2 only are correct

Statements 1 and 2 are correct: the major number selects the driver and the minor identifies the device within it, and ioremap maps a physical register block into kernel virtual address space. Statement 3 is exactly what a tasklet may not do - it runs in interrupt context, and sleeping there is forbidden.

Please log in or register to report this question.

Answer: D

Register addresses belong in the implementation, where nothing above can reach them; publishing them invites the application to bypass the driver. The other three constitute the interface and must be visible to callers.

Please log in or register to report this question.

Loading…
Tags: Device Drivers Questions and Answers || Device Drivers MCQ Questions and Answers || Device Drivers GK Questions and Answers || Device Drivers GK MCQ Questions || Device Drivers Multiple Choice Questions and Answers || Device Drivers GK || GK on Device Drivers || Embedded Systems Questions and Answers || Embedded Systems MCQ Questions and Answers || Embedded Systems GK Questions and Answers || GK on Embedded Systems