Sie sind auf Seite 1von 4

Final Exam: CSE 438/598 (Fall 2013)

Date: Dec. 11
Name:________________________

ASU ID:_________________________

You have 110 minutes to answer all questions. Your answers must be concise and you may lose points if
your answers include incorrect or irrelevant statements. Before you answer the questions, please sign
the honor code pledge:
On my honor, I have neither given nor received unauthorized aid in doing this examination.
Signed by : _________________________
1. (24 points) (True or False) In FreeRTOS applications, we may use the existing software timer to create
and start a timer instance. Then, after the specified number of ticks has elapsed, a timeout callback
function will run.
(a) ________ The callback function can acquire a resource by locking a semaphore
(b) ________ The callback function can call xTimerStop() to stop the timer instance.
(c) ________ The callback function runs in the context of the task that creates the timer instance.
(d) ________ The callback function will be invoked even if the task creates the timer instance is
suspended.
(e) ________ An interrupt service routine can also start a created timer instance by calling
xTimerStart().

In FreeRTOS, you may find several API functions have two different varieties. One can be called by
user tasks and the other from ISRs. Examples include (xSemaphoreGive, xSemaphoreGiveFromISR)
and (xTimerStart, xTimerStartFromISR). Check the correct reasons to justify the need of different
varieties?
(f) ________ The API functions to be called from ISR should not be blocked while the ones called by
user tasks may be blocked.
(g) ________ The varieties of the API functions must work on different objects, such as semaphores
and timers.
(h) ________ They need a different ways to invoke scheduler and possible context switch.

2. (25 points) Assume we have a set of priority tasks {T1, T2, T3, T4} and their task periods and WCETs are
{(6,1), (15, 5), (24, 6), (25, 4)}. If the deadlines of the tasks are equal to their periods, respectively, and
the priorities are assigned in the order of T4, T1, T2, and T3, where T4 has the highest priority. Is every
task schedulable (meeting their deadline respectively)? Note that tasks are preemptable and there is
no resource sharing or context switch overhead.

3. (10 points) (True or false) In Linux, an executing signal handler


__________ may be preempted by other process or thread
__________ may be interrupted by a hardware interrupt
__________ may be interrupted by a newly arrived signal
__________ may run concurrently with the thread that catches the signal
__________ will return back to kernel before transferring the control to the thread that catches the
signal
(8 points) In Linux, we can use mutex-exclusive semaphores to ensure atomic updates on variables
shared by multiple tasks (threads). However, if a variable is modified by a thread and its signal
handler, can we use the same approach (i.e. mutex mechanism) to enforce the atomicity of the
update operations? If your answer is yes, explain how it works. Otherwise, give the right approach.

4. (8 points) Starting from Linux 2.6, the Linux kernel is preemptive. This means that a running kernel
program can be preempted by another program not running in interrupt context. What are the
possible sources that cause the preemption? (Please fill your answer in the following blanks. You may
not need all of them.)
i.

________________________________

ii.

________________________________

iii.

________________________________

iv.

________________________________

v.

________________________________

vi.

________________________________

vii.

________________________________

(25 points) For the following multiple choice questions, please choose the correct or the most likely
correct answer.
5. An application is made of 4 periodic tasks and is running in cycle scheduling. Assume the period and
execution time of the tasks are (12, 2), (20, 3), (24, 7), and (30, 5). Which of the following pair can be
a valid choice of major and minor cycles:
(a)
(b)
(c)
(d)
(e)

(150, 12)
(100, 10)
(120, 12)
(120, 8)
None of the above.

6. In assignment 3, you were asked to use a work queue to perform I2C bus read and write operations.
Which of the following statement is correct:
(a)
(b)
(c)
(d)
(e)

The read and write operations will take a less amount of time to complete.
The user program invoking the I2C bus operations can carry out other actions concurrently.
The read and write operations would not be preempted by other process or thread.
Multiple I2C bus operations can be carried out concurrently.
None of the above

Consider the driver modules for a PS2 mouse device in Linux input systems. When a mouse button is
pressed, the interrupt handler, i8042_interrupt, of the adapter is invoked. Then, in normal situation, a
sequence of calls, from serio_interrup, psmouse_interrupt, input_event, to the event callback function of
an event handler, will take place. At last, a mouse event can be passed to user space via a read() IO call.
7. Which of the following function(s) are running in interrupt context
(a)
(b)
(c)
(d)
(e)

serio_interrupt,
psmouse_interrupt,
input_event,
the event callback of an input event handler
all of the above

8. When we use the Linux generic input driver evdev to receive a mouse button press event, the event
contains a timestamp. This timestamp indicates the instant
(a)
(b)
(c)
(d)
(e)

when the button is pressed


when CPU is interrupted by the mouse device
when psmouse_interrupt begins to process the interrupt event
when the mouse data is processed by input_event function
when the event call back function of evdev is invoked.

9. Which of the following module should contain a function to process PS2 data stream and report
relevant events from a standard PS2 mouse, a trackpoint PS2 device, or a laptop touchpad?
(a)
(b)
(c)
(d)
(e)

i8042.c
serio.c
psmouse.c
input.c
an event handler, such as evdev.c

Das könnte Ihnen auch gefallen