Академический Документы
Профессиональный Документы
Культура Документы
A high priority Interrupt has occurred while executing the third instruction. Th
e processor jumps to the vector table location 0x0010 and from there jumps to th
e ISR and executes it. After completing the ISR, to which address the control wo
uld return to?
1000 MOV A, 20
1004 MOV B, 30
1008 MULT A, B, C
100C MOV C, L1
a)0x0010
b)0x0012
c)0x100C
d)0x1008
Sorry, the correct answer is c. When the interrupt occurs while executing an ins
truction, it will complete the current instruction. So, after completing the ISR
, the control would return to fourth instruction.
2)
Which of the following task is not performed as part of the Kernel Startup?
a)400 Mbytes
b)200 Mbytes
c)100 Mbytes
d)50 Mbytes
Sorry, the correct answer is b. The amount of data transferred in 1 sec is 4 * 1
00 * 10^6 and hence in 0.5 secs it is 200 Mbytes of data
6)
What is False about DMA controller?
a)Is used to transfer data from one memory to another memory or from an I/O devi
ce to memory
b)It shares the system memory and bus with the CPU and has both bus master and s
lave capability.
c)The DMA controller releases the system bus for the duration of the transfer, t
he process is referred as cycle stealing
d)When CPU uses internal cache memory, the DMA controller can use the system mem
ory parallely.
Sorry, the correct answer is c. The CPU actually releases the system bus for the
duration of transfer, and hence it is referred as cycle stealing. All other sta
tements are true about DMA.
7)
What is not true about the block device drivers?
a)FPGA
b)ASIC
c)GAL
d)All of the above
Sorry, the correct answer is a. The manufactures normally prefer Field programma
ble Gate array during the early stage of the development because it can be repro
grammed to reflect any changes
9)
A 9600 bps serial communication link with asynchronous mode of transmission uses
one start bit, seven data bits, one parity bit and one stop bit. How many chara
cters can be transmitted per second ?
a)800
b)960
c)1200
d)1000
Sorry, the correct answer is b. Each character requires 10 bits (1 start bit + 7
data bit + 1 parity bit + 1 stop bit) to be transmitted for each character. So
, 960 characters can be transmitted over 9600 bps link.
10)
A system has 8 MB of physical memory and 2048 physical pages. What will be the
size of the physical page and the virtual page?
a)In the periodic timer, count value becomes zero, it generates an interrupt to
the processor ONLY once
b)It is not possible to configure the timer as periodic
c)Periodic timer can be used by the RTOS to carry out scheduling or software tim
er services.
d)None of the above.
Sorry, the correct answer is c. In the periodic timer, when it because zero, the
value is reloaded again and it is possible to configure the timer as oneshot or
periodic using the control registers
12)
An Embedded system receives 4 signals through the 4 pins of an input port. Whic
h of the following will be most suitable to analyze the input signals?
a)ICE
b)Breakpoint
c)Logic Analyser
d)Voltmeter
Sorry, the correct answer is c. Logic analyzer is used to track/analyze differen
t signals simultaneously. Hence it can used to analyze 4 signals simultaneously
13)
You are developing a cost effective embedded system where the LCD display is not
available to display the error messages. Which approach you will take up to ide
ntify the errors so that you can debug it easily?
a)Write error code in shared memory location and use those error codes for debug
ging.
b)If file system is available, log the errors in a error_log.txt file
c)Check the possibility of writing the errors in Non volatile memory
d)All of the above.
Sorry, the correct answer is d. You can write error codes in some shared memory
location and interpret these codes to carry out debugging. If file system is ava
ilable in the embedded system, you can write the error codes to a text file and
use that for debugging. You can also write it in the Non-volatile memory, so tha
t after the system is switched OFF and powered ON you can read the error codes a
nd perform debugging. The option can vary depending upon which is suitable/feasi
ble for that system.
14)
Identify the problem in the below code snippet. Task 1, Task2 and Task3 are of e
qual priority and the system has the time slice of 5msec. Identify the problems
see with respect to Task1,2 and 3? Assume that task 1 starts running 1st.
int write_count = 0;
Task_func1 ()
{
Acquire write_Lock1
Write to the file1
Release write_lock1
Write_count++
}
Task_func2 ()
{
Acquire write_lock2
Write to file 2
Release write_lock2
Write_count++
}
Task_func3(inputbuffer, size)
{
Acquire Read_lock
if(size is 0)
return INVALID
Memorycopy(tempbuffer, inputbuffer, size)
Release read_lock
return SUCCESS
}
a)Deterministic behaviour
b)Support for latest chipsets/processors
c)Support for modern protocols
d)None of the above
Sorry, the correct answer is a. Deterministic or predictable behaviour is the mo
st the important aspect of the real time system. Only then, it is possible to ca
lculate the worst case response for time critical events.
16)
Which of the following is CORRECT about the initialisation of a RTOS based embed
ded system?
a)Kernel initialization step initializes only the internal modules of the RTOS.
b)Kernel initialization creates the various RTOS resources needed by the applica
tion.
c)Application Initialization is done as part of the kernel initialization.
d)Application Initialization will never do any hardware initializations.
Sorry, the correct answer is a. Kernel initialization step initializes all the i
nternal modules of the RTOS so that the RTOS is ready to service all the API cal
ls made by the application. It does not create any resources needed by the appli
cation. Application initialisation is done after kernel initialisation. It creat
es all the RTOS resources needed by the application by calling the appropriate c
reate APIs. Hardware initializations are done by the boot loader. Yet, the appli
cation initialisation can also reinitialize some of the hardware according to th
e requirements of the application. It can initialize some of the application spe
cific hardware which was not initialized during the boot load operations.
17)
Which of the following is NOT CORRECT?
a)A task is a RTOS object/resource created inside the RTOS by calling the approp
riate APIs provided by the RTOS.
b)A function becomes a task when it is made as an entry function of a task by pa
ssing it as an argument to the task create API provided by the RTOS.
c)A function should have an infinite loop like a while(1) loop for it to be made
as a task.
d)None of the above
Sorry, the correct answer is c. A task or any other RTOS resource is an object i
nside the RTOS. It is created by calling the appropriate APIs provided by the RT
OS. To create a task, we have to write a function. This function should be passe
d as an entry function to the RTOS API. It is not necessary that the function mu
st be implemented using a while(1) loop. If the function is implemented using an
infinite loop like a while(1) loop, then it becomes a continuous running task a
nd it never finishes it exits explicitly or killed. If it does not have a while(
1) loop then the task ends after the first execution. Typically, in an embedded
application, all tasks are created using infinite loops. During initialisation p
hase, a single execution task may be created and used.
18)
Which of the following is CORRECT when a task t2 preempts a task t1?
a)The current register contents of the CPU are saved into the stack of the outgo
ing task t1 and updated by the values already saved in the stack of task t2.
b)The program counter of the processor is updated with the address of the next i
nstruction of task t2
c)There is only one stack pointer available in the CPU and hence there cannot be
different stacks available for task t1 and t2.
d)When preemption happens, the CPU changes its mode. Each mode has its own stack
from which the registers have to be updated.
Sorry, the correct answer is a. Task t1 is being preempted. Hence the current re
gister contents of CPU will be saved in the stack of t1. t2 is the new task whic
h is getting scheduled. Hence the registers will be updated with the values alre
ady saved in t2 stack. Each task will have a task control block(TCB) in the RTOS
. One of the elements of this structure is a stack pointer (a software pointer).
This will be pointing to the stack allocated to that task. The hardware stack p
ointer register will be updated with this value. Thus each task will have a sepa
rate stack to store its context. There is no hardware mode change happens when a
task is preempted by another task.
19)
Device A and Device B can be treated as equal priority, while Device C has a hig
her priority.
Which two devices can be connected to the same interrupt pin?
a)Whichever address is present in the PC, it fetches the instruction from that a
ddress, and stores the instruction in the Instruction Register
b)Whichever address is present in the instruction register, it fetches from that
address, and stores the instruction in the PC.
c)After fetching the instruction, address contained in the Instruction register
is incremented
d)PC holds the address of the current instruction, while the Instruction registe
r holds the address of the next instruction.
Sorry, the correct answer is a. " PC always holds the address of the instruction
to be fetched. And when the data from the address held in the PC is fetched, th
at data, which is nothing but the instruction opcode, is stored in the Instructi
on Register. After fetching the instruction, PC is incremented to hold the addre
ss of the next instruction to be fetched"
23)
What is TRUE about a zero address machine?
a)A zero address machine has instructions which are stored in the CPU itself and
hence no operand memory address is applicable to these instructions
b)A zero address machine fetches instructions only from stack memory
c)A zero address machine fetches operands only from stack
d)A zero address machine will have zero memory
Sorry, the correct answer is c. " A zero address machine have instructions like
add , move etc which do not specify any operand address. By default the operands
are pushed and popped from/to address stored in stack pointer register, i.e fro
m/to stack."
24)
In memory mapped I/O
a)It is possible for CPU to write data into a device register by writing into sp
ecific memory locations
b)It is possible for CPU to write data into a device register by directly access
ing I/O port
c)It is possible for CPU to write data into a device register only through speci
al instructions
d)It is not possible for CPU to write into device registers
Sorry, the correct answer is a. " In memory mapped I/O, the I/O registers are ma
pped to specific memory locations. By writing into these memory locations, using
the normal memory load and store operations, the data is transmitted from CPU t
o device. "
25)
When a DMA transfer is happening, which of the following statements is TRUE?
a)Because its instruction set is complex, the same C code produces more assembly
code lines than in a RISC machine.
b)Results in lower memory footprint.
c)Pipeline is more efficient
d)Instruction lengths are equal
Sorry, the correct answer is b. "CISC machines reduces number of instructions in
a program. Hence it results in lesser code and lesser memory footprint "
27)
Which mechanism can be used to transfer data from a CPU register to I/O port?
a)DMA
b)I/O mapped I/O
c)Memory mapped I/O
d)Both b. and c.
Sorry, the correct answer is d. " Both I/O mapped I/O and Memory mapped I/O can
be used to transfer data from CPU register to I/O port. In the case of I/O mappe
d I/O, this can be done by a special instruction, which transfers the data from
the register to the I/O port and in the case of memory mapped I/O, the I/O ports
are mapped to specific memory locations. By writing into these memory locations
, the data gets transferred from register to I/O port. However in DMA, the data
is always transferred to/from devices and memory, but it doesn t reach the CPU "
28)
What is the advantage of Von Neumann over Harvard?
a)Instruction set will only contain equal length instructions and hence efficien
t pipeline
b)CPU and memory hardware will be more simpler and cheaper
c)Self modifying code is possible only in Von Neumann
d)Both b. and c.
Sorry, the correct answer is b. "Since Von Neumann has a common bus for both ins
truction and data memory transfers, the hardware to send and receive data to/fro
m memory is common. However in Harvard, these buses are separate and the hardwar
e is more complex and costlier"
29)
Which of the following is triggered due to software instruction errors like Divi
de by zero?
31)
A device is providing 10000 bytes/sec of data to a real-time computer. This data
comes in 4 equal bursts of burst duration 10 msecs each within the one sec peri
od. The system is capable of processing the data at 10000 bytes/second. If the s
ystem uses a double-buffer, what should be optimal size of each buffer without l
osing any data?
a)0 bytes
b)10000 bytes
c)2500 bytes
d)1000 bytes
Sorry, the correct answer is c. "Since the data is coming in bursts of 10 ms, an
d in10ms, 10000 * 10 m = 100 bytes can be processed by the consumer. There are f
our bursts in one second and 10000 bytes being produced. Hence, there are 10000
/4 = 2500 bytes being produced in a burst. Hence the processing speed is not suf
ficient. Hence even though the data production and consumption rate is equal in
this case, we need to provide a buffer. The buffer should be capable of holding
at least one burst size, i.e 2500 bytes. For 2500 bytes the processing time will
be 2500/10000 = 250ms. Assuming that the 10ms bursts are equally(periodically)
spaced, it is sufficient to hold one burst size in one buffer. By the time the t
hird burst arrives ( at a time of 500ms, it can overwrite the first buffer, sinc
e it is already processed at the end of the first 260ms ) Note that a single buf
fer will not be sufficient in this case, because by the time the second burst ar
rives, the first burst is not yet consumed. "
32)
In an RTOS based application, which of the following is FALSE?
a)Pipes are typically used for streaming audio and video data between tasks. The
messages posted to pipes cannot be prioritised.
b)Message queues are typically used for exchanging command and control informati
on between tasks. The messages in message queues can be prioritised.
c)Usually, an Event occupies only one bit in an eventgroup. Hence a 32 bit eveng
roup supports 32 events that can be used for communication between various tasks
.
d)None of the above.
Sorry, the correct answer is d. Pipes are used for large chunks of data to be pa
ssed across tasks while message queues are used for exchanging commands and cont
rol information. Messages in pipes cannot be prioritised where as those in messa
ge queues can be prioritised. For using an RTOS event, an eventgroup has to be c
reated and in that eventgroup, each bit represents individual events.
33)
Which of the following is TRUE?
a)A Mutex is a type of binary semaphore used for protecting critical resources f
rom simultaneous access by multiple threads of execution.
b)When a task which has obtained a mutex, tries to acquire the same mutex again,
it will acquire it successfully without getting blocked.
c)If a task has obtained a mutex and a different task tries to acquire that mute
x, it will block on that mutex.
d)All the above.
Sorry, the correct answer is d. A Mutex is a type of binary semaphore used for p
rotecting critical resources from simultaneous access by multiple threads of exe
cution. The mutex remembers the task which has already acquired it and if the s
ame task tries to acquire it again, it keeps a count of the number of such reque
sts and allows successful acquisition. When the mutex is being released, that ta
sk has to release it that many times so that the mutex will be available for acq
uisition by any other task. If a different task tries to acquire an already acqu
ired mutex, it will immediately block
35)
Which of the following is TRUE about the characteristics of an RTOS and a
monolithic OS like Linux?
a)A A B A B C B C C C
b)A B C A B C A B C A
c)A A B B C C C A B B
d)A A B B C A B C C A
39)
If a function uses global variables, which of the following is true regarding th
e reentrancy of the function?
a)Protect the access to each of those global variables using one or more mutex i
nside that function.
b)Make those global variables as part of a private control block which will be u
sed only by one task.
c)If the function will be called by only a single thread of execution, then it i
s safe to use the global variable without any mutex protection.
d)All the above.
Sorry, the correct answer is d. If a task uses a global variable and if that var
iable is shared with any other task, then it has to be protected by a mutex. If
it is not a multi tasking environment and if there are no interrupts which are
sharing that variable, then there is no need for protecting the variable using m
utex. Similarly, if the global variable is stored in a private data structure us
ed only by that task, then also it need not be protected by the mutex.
40)
Which of the following is TRUE?
a)Task A and Task B are in race condition if their behaviour and hence the syste
m behavior changes based on the order in which they are scheduled.
b)Race condition can be avoided by sequencing the tasks by using semaphores or m
essages or events.
c)Deadlock condition can be avoided by enforcing an order in which the semaphore
s can be obtained.
d)All the above.
Sorry, the correct answer is d. Two tasks can race against each other and result
in an unexpected behavior based on the order of execution. This can be avoided
by sequencing their execution by using semaphores. When using multiple semaphore
s, we can enforce an order in which the semaphores have to be used. This will av
oid the deadlock conditions.
41)
In a priority based preemptive system, which of the following is TRUE?
a)A task which runs without blocking has to be given the highest priority.
b)A task which runs without blocking has to be given the lowest priority.
c)Whether it blocks or not, does not impact the decision of its priority.
d)None of the above.
Sorry, the correct answer is b. A task which continuously runs without blocking
has to be given the lowest priority. Otherwise it will not allow any other task
lower than its priority to be scheduled.
42)
Which of the following is TRUE?
43)
Consider the following set of tasks, with the time values given in msecs.
TaskName Burst Time Arrival Time Priority
A 2 2 P1
B 4 0 P2
C 3 4 P2
D 1 3 P3
Each task prints the numbers starting from 1, 2, 3,...,incrementing the number b
y 1 for every 1 millisecond it is executed. The printed number is prefixed with
corresponding task id. The system uses priority based preemption scheduler with
1ms time-slice. What would be the output for this
scenario?
Note: CPU Burst time is the time a task requires to complete execution when it e
xecutes alone and has all resources required. Arrival time is the first occurren
ce of task execution. Also note that priority P1 is the highest priority.
a)B1 B2 A1 A2 B3 C1 B4 C2 C3 D1
b)B1 B2 A1 A2 C1 B3 C2 B4 C3 D1
c)A1 A2 B1 B2 B3 C1 B4 C2 C3 D1
d)B1 B2 A1 A2 B3 B4 C1 C2 C3 D1
Sorry, the correct answer is a. Task B arrives at time 0 and runs for 2 ms till
Task A arrives at 2nd msec. Task A runs for 2ms and completes. Then task B runs.
But task C has already arrived at 4rd msec. But it is not scheduled and only ta
sk B is scheduled because task B got preempted by task A and got into the ready
queue at the 2nd msec itself. Task B and C have the same priority. So, as per ro
und robin Task B gets scheduled again and runs for 1msec. Then task C runs for 1
msec. Once task B and C complete, the lowest priority task D gets scheduled and
runs for 1msec.
44)
Consider an embedded system running 3 tasks shown below. The context switching t
ime is negligible.
What is the approximate CPU utilization of each of these tasks if they are sched
uled in a round-robin fashion, if the scheduler time-quantum is 2 ms?
send_task()
{
while(1)
{
do_something();//takes 2 msec
send_io_data();//waits for 2msec for send to be completed by the i/o devic
e
}
}
receive_task()
{
while(1)
{
do_something();//takes 2 msec
recv_io_data();//waits for 2msec for i/o device to fill recv buffer
}
}
process_data_task()
{
while(1)
{
process_data();//Takes 4msec every time called
}
}