?
Solved

the coldfire mutually exclusive

Posted on 2005-03-22
5
Medium Priority
?
260 Views
Last Modified: 2012-06-27
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
Comment
Question by:tantoush
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:grg99
ID: 13600300
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
 

Author Comment

by:tantoush
ID: 13601499
I am sorry but realy I dont know what you min by good algorithm.
0
 
LVL 22

Expert Comment

by:grg99
ID: 13604104
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
 

Author Comment

by:tantoush
ID: 13604920
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
 
LVL 22

Accepted Solution

by:
grg99 earned 1500 total points
ID: 13605510
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn how to use the free Acronis True Image app to easily transfer data between iPhones and Android phones.
Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question