Re: The idea of disabling interrupts



On Nov 29, 3:42 am, karthikbalaguru <karthikbalagur...@xxxxxxxxx>
wrote:
On Nov 29, 12:21 pm, Arlet Ottens <usene...@xxxxxxxxxxxxxxxxx> wrote:

karthikbalaguru wrote:
Is it a good idea to disable interrupts while sharing data (Critical
Sections) ?

If you're sharing your data with an ISR, it is often the only thing you
can do (unless your CPU has the right atomic instructions for the job).

Thx for highlighting this :):)

If you're sharing between two tasks, it depends. Generally, if you
disable interrupts for a short period, and you don't call any OS/library
functions, it can be a useful method. Exactly how long you can disable
interrupts depends on your environment and real-time requirements.

Thx for the info. Interesting :):)

Thinking over this, i have a query -
Is it possible to do sharing of data(Critcal Section) wihtout diabling
of interrupts and also
without the use of these RTOS features like semaphore/Mutex/
MessageQueues/Pipes/Mailboxes ?

Thx in advans,
Karthik Balaguru

If you have an OS that supports MessageQueues/Pipes/Mailboxes, why do
you want to avoid them?
And if you have an OS that supports semaphore/Mutex, why would you
want to avoid using them?

Semaphores were created for dealing with critical section issues.why
not use the right tool for the job?
Ed.
.



Relevant Pages

  • Re: The idea of disabling interrupts
    ... If you're sharing your data with an ISR, it is often the only thing you ... disable interrupts for a short period, and you don't call any OS/library ... Thx for the info. Interesting:):) ...
    (comp.arch.embedded)
  • Re: The idea of disabling interrupts
    ... disable interrupts for a short period, and you don't call any OS/library ... And if you have an OS that supports semaphore/Mutex, ... want to avoid using them? ... the disabling of interrupts by our own programming ...
    (comp.arch.embedded)
  • Re: The idea of disabling interrupts
    ... Thx for highlighting this:):) ... disable interrupts for a short period, and you don't call any OS/library ... Thx for the info. Interesting:):) ...
    (comp.arch.embedded)
  • Re: [PATCH 2/2] sched: Improve fairness of cpu allocation for task groups
    ... Ok ..thx. ... I was begining to make changes to avoid even the above minor ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Use of uninitialized value Error
    ... Use of uninitialized value in int ... How do I avoid this error? ... Thx, ... Prev by Date: ...
    (perl.beginners)