• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

the coldfire mutually exclusive

I want to know that ideally there is a need for mutually exclusive access to the console and how this could be achived using the BSET instruction as the basis of a binary semaphore.
0
tantoush
Asked:
tantoush
  • 3
  • 2
1 Solution
 
grg99Commented:
First you need a good algorithm.   I hope your textbook has one, as it is trickierr than it sounds!   Much trickier.  The simplest solutions have race problems.

Please show us that you have an algorithm, then we can help in writing it in asm.  If your book doesnt have an algorithm, please try using google or ask around.

0
 
tantoushAuthor Commented:
I am sorry but realy I dont know what you min by good algorithm.
0
 
grg99Commented:
Whenever you have two or more processes trying to get the use of a resource, you need some reliable method for interlocking their access.  Some method involving flags, counters, or semaphores perhaps.

0
 
tantoushAuthor Commented:
I whant to know more a bout BSET instruction as the basis of a binary semaphore.
if you know any web bage have some information.
0
 
grg99Commented:
If you mean the  BSET instruction in the Motorola/Freescale DSP 56xxx series:

BSET is actually a "test and set" instruction.   It indivisibly tests a bit, then sets it.
It returns the value of the bit in the carry bit.

So with BSET you can test to see if a flag is set, and then set it, without any chance another processor or another process or thread can be doing the same thing at the same instant.  In other words, no two processes can see the bit it clear and both set it.

 Example interlock code:

Again:     BSET   #ConsoleLockBit,DeviceInterlockWord     ;; try to get the interlock
              JCS      Again                                                  ;; bit already set, wait for clear

That's it!   Whenyou're done with the resource you just clear the lock bit

     BCLR    #ConsoleLockBit,DeviceInterlockWord

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now