what are the rules u follow when u r writing critical
section of code?
Answers were Sorted based on User's Feedback
Answer / teja
1.The operation must be atomic
2.The atomicity is ensured by disabling the interrupts and
immediately after crictical section enabling the
interrupts..here slight precausion has to be taken i.e do
not forget the enabling of interrupts ....
Is This Answer Correct ? | 14 Yes | 2 No |
Answer / bb
Always keep your execution code as minimal as possible in
the critical section.
Never use blocking calls in the critical section.
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / vinod
a) Use Atomic Instructions
b) Remember to enable interrupts
c) Make the critical section code as small as possible.
(Prefer not more than 20 instructions)
d) Prefer not to call other functions from the critical
section. if u r calling, see that there is no critical
section in the other function too. Critical section is
bounded by Disable Interrupt and Enable Interrupt.
Check the example below.
fnA()
{
/* Critical Section Start */
Disable_Interrupt();
Some Instructions A ....
Call FnB();
/* do Something B */
Some Instructions B ....
/* Critical Section End */
}
fnB()
{
/* Critical Section Start */
Disable_Interrupt();
Some Instructions ..
Enable_Interrupts();
/* Critical Section End */
}
Now the Enable_Interrupts in fnB() will enable the
interrupts and hence "Some Instructions B .." in fnA()
which should have been in critical section will no more be
in critical section because the interrupts are already
enabled!!
Please check if this condition is handled by the Enable and
Disable functions. If you want suggestions on how to solve
this problem, do revert back
Is This Answer Correct ? | 10 Yes | 1 No |
Answer / vineesh mca@tkm
1. Operation Must be Atomic
2. The process which are not currently executing its
rtemainder section are only allowed to make request to
execute its critical section
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / rk
1.The operation must be atomic
2.The atomicity is ensured by disabling the interrupts and
immediately after crictical section enabling the
interrupts..here slight precausion has to be taken i.e do
not forget the enabling of interrupts ....
Is This Answer Correct ? | 1 Yes | 0 No |
When would you choose top down methodology?
What is the important aspect of a real-time system ?
what is major concerns about any RTOS selection ?
What is the state of the processor, when a process is waiting for some event to occur?
What is a Real-Time System ?
Explain the difference between microkernel and macro kernel.
5 Answers Infosys, Tech Mahindra,
What do you mean by deadlock?
Describe different job scheduling in operating systems.
what is the need of creating 4GB of pages in linux?
If two processes which shares same system memory and system clock in a distributed system, What is it called?
Give an example of microkernel.
13 Answers Global Edge, Samsung,
When would you choose bottom up methodology?