Write a program to show the functionality of Power-save super loop.
To check the loop time of the program the power-save super loop is used. If the
average loop time of the program is 1ms, and it requires only few instructions
to be checked every second the program will save the state and build a delay
that will be caused to read the input on every loop and it saves lot of energy
or the power that needs to be used. The function that is required to be
performed to show the functionality is:
Main_Function()
Function
{
Initialization();
Do_Forever
{
Check_Status();
Do_Calculations();
Output_Response();
Delay_For_Next_Loop();
}
}
Why does pre-emptive multi-threading used to solve the central controller
problem?
Multi-threading provide lot of functionality to the system to allow more than
one task can be run at a time. It allows a process to execute faster with less
difficulty. But, if there any problem comes in any program or the process than
the entire system comes to a halt and slows down the whole system. To control
the behavior of this the preemptive multi-threading is used. The control in
this case is being shifted from one process to another at any time according to
the requirement provided. It allows the program to give the control to another
program that is having the higher priority. It includes of many problems like
giving of a control by a process half way through in execution and the
preemption of the process takes place then the data will be entered as
corrupted in the memory location, multi-threading keeps the synchronization
that is to be performed between different components of the system and the
program and try to avoid the problem mentioned above.
What are the rules followed by Mutexes?
• Mutex is also called as Mutual Exclusion is a mechanism that is used to show
the preemptive environment and allow providing security methods like preventing
an unauthorized access to the resources that are getting used in the system.
There are several rules that has to be followed to ensure the security
policies:
• Mutex are directly managed by the system kernel that provides a secure
environment to allow only the applications that passes the security rules and
regulations. The mutex consists of objects that are allowed to be called by the
kernel.
• Mutex can have only one process at a time in its area that is owned by the
process using it. This allows less conflict between the different applications
or processes that wait for their turn to execute it in the kernel area.
• Mutex can be allocated to another mutex that is running some task at a
particular time and allow the kernel to have synchronization in between them.
• If Mutex is allocated to some other process then the area will consist of the
process till the area is having the process in it.
What is the purpose of using critical sections?
Critical section allows the process to run in an area that is defined by that
process only. It is a sequence of instructions that can be corrupted if any
other process tries to interrupt it. This process allow the operating system to
give the synchronization objects that are used to monitor the processes that
are up and running so that no other process will get executed till the critical
region consists of a process that is already running. The example includes
removal of the data from a queue running in a critical section and if not
protected then it can be interrupted and the data have chances of getting
corrupted. The processes exit from the critical section as soon as they finish
the execution so that the chances can be given to other processes that are
waiting for their chance to come.
What is the function of Watchdog timer in embedded system?
The embedded system should have a function that can allow the fixing the system
if anything goes wrong with it. Watchdog timer is a tool that is used in
embedded system and having a long-fuse that runs several seconds. Watchdog
timer includes the automated timing control that count down the number from max
to 0 and when the counter reaches the zero, this WDT reset the micro-controller
that gets turned off when the timer was in initial phases. Watchdog require the
user to put some value before it runs out of time and reset the whole process
as this can harm the data and the system. Resetting by WDT can be done when the
process is half complete. Watchdog timer have the counter that is used to watch
the processes that are running and if there is any issue occurs then WDT itself
times out. The resetting of the system will be done to always give it the best
possible way to execute the process.
|