[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] kernel 1.15.10b fragmentation



Hi all,

> messages). This can be solved with shared memory.

I just wanted to point out that shared memory is mostly pointless in a
preemptive system if you don't have decent synchronization primitives.
True there are few cases where you want a strictly broadcast datasharing
pattern but those are rare in real life.

Using shared memory with high latency synchronization primitives is only
viable if you have a lot of data to exchange. From what I can see most
data is exchanged between the AES and the application in very small
datastructures so synchronization is crucial and will be the limiting
factor no matter what you do. This is often refered to as the
computation to communication ratio.

Having said that I must also point out that it is also essential to
eliminate as much synchronization as possible and shared memory can
actually do so. The inner mouse and keyboard event handling routine in
the user part of the AES could be performed using the following code:
Note: this code will only work on a non-smp system unless you can lock
the bus.

loop:
 read mouse and keyboard information 
 from a shared memory buffer using a 
 single movem instruction. Movem is
 uninteruptable on a non-SMP system.

 Compare the information read with
 previously read information. Has it
 changed?

 If so do something sensible and go
 back to loop.

 Otherwise wait on a mutex and when 
 woken go to loop.
	
This scheme helps in the case when the application needs mouse dragged
event. The application would only sleep when there are no new events to
process. You will of course need contextswitches to get information to
the AES but that can not be avoided.

Best regards
 Sven