Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


what are the rules u follow when u r writing critical
section of code?

Answers were Sorted based on User's Feedback



what are the rules u follow when u r writing critical section of code?..

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

what are the rules u follow when u r writing critical section of code?..

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

what are the rules u follow when u r writing critical section of code?..

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

what are the rules u follow when u r writing critical section of code?..

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

what are the rules u follow when u r writing critical section of code?..

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

what are the rules u follow when u r writing critical section of code?..

Answer / ac

Also do not access any slow I/O device.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer



More RTOS AllOther Interview Questions

What is a mission critical system ?

3 Answers  


What do you mean by deadlock?

8 Answers   Bosch,


When would you choose top down methodology?

3 Answers   CTS,


what is the need of creating 4GB of pages in linux?

1 Answers   TCS,


What is the difference b/n any GPOS and RTOS?Give suitable examples or characteristic of RTOS to support your answer. What changes can be done in a GPOS to make it work like a RTOS? What basic features will you support, if you have to design a RTOS?

8 Answers   Bosch, Emulogic, L&T, Qualcomm,






Write a small dc shell script to find number of FF in the design

0 Answers  


What is priority inversion ? and What is the solution ?

6 Answers   Qualcomm, Tandberg, Wipro,


When would you choose bottom up methodology?

5 Answers   Knowx Innovations,


Explain the difference between microkernel and macro kernel.

5 Answers   Infosys, Tech Mahindra,


what is major concerns about any RTOS selection ?

4 Answers   Bosch,


If two processes which shares same system memory and system clock in a distributed system, What is it called?

7 Answers  


What is the important aspect of a real-time system ?

6 Answers  






Categories