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

Device Drivers Questions and Answers

Answer: C

It suits an event-driven design and avoids a task blocked on every device, but the callback runs in whatever context the driver was in, often an interrupt handler. Documenting that context is essential, since what the callback may do depends on it.

Please log in or register to report this question.

Answer: D

Correct answer: block on a kernel object or take a long time

A callback from interrupt context runs with interrupts disabled or at high priority, and there is no task to suspend, so blocking either faults or hangs the system. It must do the minimum - copy a value, set a flag, signal a semaphore - and leave the work to a task.

Please log in or register to report this question.

Answer: A

That requires its state to be in the caller's storage or in a per-instance structure rather than in file statics. A driver called from two tasks, or from a task and a handler, must be reentrant or must serialise its callers.

Please log in or register to report this question.

Answer: B

Correct answer: serialising the callers with a mutex inside the driver

Shared state needs mutual exclusion, and a mutex inside the driver provides it without every caller having to remember. volatile addresses visibility rather than exclusion, equal priorities do not prevent preemption, and inlining changes nothing at all.

Please log in or register to report this question.

Answer: C

Correct answer: protect its state with a critical section rather than a mutex

A mutex cannot be taken from an interrupt handler - there is no task to own it and blocking would be fatal - so a driver reachable from both must use a short critical section instead. That means disabling interrupts briefly, which is why the protected region has to be kept very short.

Please log in or register to report this question.

Answer: D

A serial port, a sensor and a sound device are all character devices; a disk or a flash partition is a block device with a buffer cache and a scheduler above it. The distinction decides which set of kernel interfaces the driver implements.

Please log in or register to report this question.

Answer: A

The kernel uses it to route an open on the special file to the right driver, and the minor number then tells the driver which of its devices is meant. Both appear in the listing of a device node in place of the file size.

Please log in or register to report this question.

Answer: B

Correct answer: pointers to the functions implementing open, read, write and the rest

The structure is a table of function pointers, and registering it is how a driver tells the kernel which of its routines to call for each system call on the device. Major and minor numbers, interrupts and register addresses are handled by other parts of the registration.

Please log in or register to report this question.

19.

A loadable kernel module is inserted into a running Linux kernel with

Answer: C

Correct answer: insmod or modprobe

insmod inserts a single module file, and modprobe does the same while resolving and loading whatever the module depends on. mknod creates a device node, udevadm manages device events, and mount attaches a filesystem - three different jobs.

Please log in or register to report this question.

Answer: D

It replaces the board files that once hard-coded the same information, so one kernel image serves many boards. A driver matches against a compatible string in it and receives the addresses and interrupts from the node rather than from its own source.

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