Why is it better to use multi-threading polling then single threading model?
Multi-threading allows a simple thread to be stored and polled. There is no
Input/output function that is applied when it is having the poll. When there is
no poll available to spawn it makes the system to sleep for an amount of time
till the request for another poll reaches. If there is one process that is
running then it divides that process into multiple threads and processes it
accordingly. It allows the main thread to process all the request and produce
the output by combining all other. Multi-threading allows the main thread not
to put off the result or the output that will be generated. It also allow the
priority of the thread to be changed by allowing to set the priority of the
input/output process. It also has some problems with the polling interval that
can make a thread starve for some time if the request isn’t handled properly.
How does the interrupt architecture works?
Interrupt architecture allows the use of interrupt by the processor whenever an
Input/output is ready for the processing. The processor in this case calls a
special function to handle the request that comes and leave all the work that
is getting performed at that time. The special function that is known as
interrupt handler or the interrupt service routine consists of all the input,
and output queries, or the interrupts handled by it. It is an efficient and
simple way to handle the interrupts. It uses only one function to deal with the
interrupts. There are properties of starvation that can creep in when handling
the input/output requests. The data can be lost if the interrupt doesn’t get
handled before the time runs out. This is a technique that is use to deal with
the short processes that involve input and output.
How does the interrupts handle by using the threads?
The interrupts that comes in between the input/output operations gets detected
when the input/output devices are ready. The interrupt never gets handled
directly rather, it sends the interrupt signal to the thread to the
input/output device that is ready to allow the thread to take necessary
actions. The thread uses the signaling concept that allows the initialization
to be done using the semaphore that keeps the states updated and handle the
interrupt in an easy way. The input/output device getting the request and it
also passes the semaphore to handle. The input/output device takes the
semaphore that is ready. The thread is having the minimum latency that uses the
first level interrupt handler to handle the interrupts completely. It allows
the priority of the thread to be set and it doesn’t allow the context to be
change as well.
What is the function of DMA controlled in embedded system?
DMA stands for Direct Memory Access controller that handles the allocation of
the memory dynamically to the components and allows the data to be transferred
between the devices. It is used for the communication between different
input/output devices. It automatically detects the devices that are present for
the transfer of data between the input/output devices. The interrupt can be
used to complete the data transfer between the devices. It is used to give the
high quality performance as, the input/output device can perform the operations
that are in parallel with the code that are in execution phase. It can’t be
used in all the systems. It consists of 8-bit microcontrollers that are used to
control the overall system in execution.
What are the different types of customizations that is used with the “volatile”
keyword?
Volatile keyword is used to show that the value can be changed anytime in the
program. It is used for the compiler purpose and for the customization that
works with the normal variables that are stored in the memory. There are three
types of optimizations associated with the “volatile” keyword:
- "Read" optimizations -- allow the variable to be read once and put it in
the register. If it is done then there is no re-reading of the variable during
each and every time the program is compiled. The value can be used from the
cache that is present in the register.
- "Write" optimizations -- allow the variable to be written such that the last
write of the variable will be considered and it will be processed on. This
takes the normal values that are stored in the memory.
- Instruction reordering -- allow to reorder the instructions that are used by
the compiler and if any modification are required after being written once. The
registers are used to perform the task and keep everything together.
|