1.  I think load lock instructions handle that now 
4. M9S12 doesn't. I disable interrupts. Don't allow DMA to mutex variables

Sent from John's iPhone 4S

On 2019-07-27, at 11:21 AM, Chris Albertson <albertson.ch...@gmail.com> wrote:

> There is a LOT more to this.
> 
> 1. Dual or multi-core CPUs add some complexity because all the CPUs share a
> common memory.   What if all four CPUs try to run the "test and set" at the
> same time?  Also, you can no longer assume an interrupt handler has
> exclusive use of memory.
> 2. what if the process uses two queues?  Process A might hold access to
> Queue X and process B holds Y and then each waits for the other process to
> release the other queue and the system deadlocks.
> 3. what if there are more than two processes?  How to ensure that access to
> the queue is fairly sharded between four or six users?
> 4.  What if the CPU you are using lacks a test and set instruction?
> 
> There are good solutions but today NO ONE has to solve these problems
> solutions were worked out 50 years ago.
> 
> On Sat, Jul 27, 2019 at 10:22 AM John Dammeyer <jo...@autoartisans.com>
> wrote:
> 
>> So true.  Most RTOSs have both Semaphore and Mutex features.
>> 
>> Even a simple Test and Set instruction where if the location is set the
>> resource isn't available are easy to use.  For the non-comp sci people the
>> Test and Set looks at the location and sets or clears the Zero flag before
>> setting the location to 1.  If the location was already 1 then the zero
>> flag is set to FALSE.   If the location  was 0 it will be set to 1 with the
>> zero flag set TRUE.  The next step of the program then tests the zero flag
>> to determine if it now has exclusive use of the resource or if some other
>> task/thread was already using it.
>> The test and set cannot be interrupted and the location cannot be modified
>> by DMA (direct memory access) from another hardware device.
>> I don't know if the ATMEL device used in the original Arduino has that
>> capability.  But the bigger processors all pretty well do.
>> 
>> John
>> 
>> 
>>> -----Original Message-----
>>> From: Chris Albertson [mailto:albertson.ch...@gmail.com]
>>> Sent: July-27-19 8:58 AM


_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to