Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/03/08 14:50
Read: times


 
#151809 - Reposted: Critical section implementation on 8051?


Hi,

I apologize for my mistake of not using real name in my previous post:

http://www.8052.com/forumchat/read.phtml?id=151799


I was not able to change the name in that account so I am using this new account. And have copied the initial thread messages at end of this message for better referencing.

Christoph thanks for ur reply.
But I did not quiet understood ur following comment:
"However, this approach will not really protect the section from interrupts (unless, for some reason, you think that it is ok not to service an interrupt when it cannot get the mutex it needs)."
Can you elaborate on what u meant?

Regards








----------------------------------------------
I was wondering if anyone have done this before and can give me some insight into this?

Well, JBC can be used in mutex mechanisms to test for the availability of a resource and grab it if it is available.

However, this approach will not really protect the section from interrupts (unless, for some reason, you think that it is ok not to service an interrupt when it cannot get the mutex it needs).

Also if anyone have some other idea, of implementinf critical section without disabling interrupt, please share with me.

Stick the critical code in an unused interrupt vector, set this interrupt to high priority, and trigger the interrupt when you want the code to run ?

Sill, disabling the interrupts is the standard and straighforward approach. If for some reason you think this is not possible in your application, then it is most likely that you didn't consider all possibilities yet (for example splitting one critical section that is too long into several, or shortening it).
----------------------------------
Hi all,

I am trying to implement critical section in 8051.

**I do not want to use the "disable global interrupt" approach.**

I am thinking of using the read-modify-write instructions provided by 8051 core. One of those instruction which is "JBC" instruction can be used as test-and-set instruction.

I was wondering if anyone have done this before and can give me some insight into this?

Also if anyone have some other idea, of implementinf critical section without disabling interrupt, please share with me.

Regards

List of 6 messages in thread
TopicAuthorDate
Reposted: Critical section implementation on 8051?            01/01/70 00:00      
   JBC as mutex            01/01/70 00:00      
      why ugly?            01/01/70 00:00      
         atomicity and IE            01/01/70 00:00      
         Because ...            01/01/70 00:00      
            "short interrupts" is just another paradigm...            01/01/70 00:00      

Back to Subject List