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 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?
What is priority inversion ? and What is the solution ?
6 Answers Qualcomm, Tandberg, Wipro,
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,
what are the rules u follow when u r writing critical section of code?
what is difference between IRQ and FRQ ?
What is a Real-Time System ?
When would you choose bottom up methodology?
I have been working on one thread which manage and control a couple of circular buffers. It has api for other thread to access. As the thread grows bigger and bigger, I split it as 3 to 4 threads which need to share common buffers, and also their api could be used by other threads, (not these three threads). Inside api, I also allow other threads to access these three threads' common buffers(more than one buffer). SO I have to use mutex to avoid race condition . But I found mutex will be everwhere in all the threads when they update the common buffer. I am wondering whether I could reduce mutex usage(more mutex will hure my system performance). any ideas for how to reduce mutex usage meanwhile to avoid race condition. Thanks
Describe different job scheduling in operating systems.
What is the difference between Hard and Soft real-time systems ?
11 Answers Google, Hella, Satyam,