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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/13/06 09:30
Modified:
  06/13/06 09:31

Read: times


 
#118206 - Simple things first ...
Responding to: ???'s previous message
The first 3 bytes are flags showing the status of the buffer:
1. free-flag - wether the buffer is free or not


Is this only a boolean value for each buffer ? Then you might be able to use a bit field (even if you can't actually use bit-addressed variables and have to work on the field with byte-wise commands) or merge this information into one of the two other status bytes (by defining a special value for one of the field that indicates that the buffer is empty).

1. When a package with size 4bytes arrives and I put it to the 13byte buffer I am loosing memory
Another solution would be to use a chained list and not hard allocate the buffers, but than I will have fragmentation problems.
I.e. When a 4byte package is not more valid and another 9bytes package arrives which I need to put in the middle of the buffer.


Even if you use a linked list, you would still have to make sure that there is enough memory for the worst case (which is probably 5 messages containing 9 bytes), or you would run the risk of running out of memory and handle this situation somehow.

3. If a new package type with size 15bytes will be defined I have to change the default buffer size.

I guess there is no way to avoid this. Apart from maybe starting with a larger buffer in the first place, which would also allow you to "split" one of the large buffers to hold two shorter messages.

List of 21 messages in thread
TopicAuthorDate
Buffer management optimalization            01/01/70 00:00      
   Simple things first ...            01/01/70 00:00      
   You can use circular buffer            01/01/70 00:00      
      Fragmentation problem...            01/01/70 00:00      
         all methods have some problems            01/01/70 00:00      
         Start of package or End of package            01/01/70 00:00      
            Packages explanation            01/01/70 00:00      
               Individual buffers            01/01/70 00:00      
                  Good Idea            01/01/70 00:00      
   New packages            01/01/70 00:00      
      hash table unefective            01/01/70 00:00      
         why keep that many            01/01/70 00:00      
            Reason of 5 or more buffer            01/01/70 00:00      
               Protocol specifics            01/01/70 00:00      
                  One way protocol            01/01/70 00:00      
                     One way protocol            01/01/70 00:00      
                        never            01/01/70 00:00      
                           Definition of need            01/01/70 00:00      
                              Grant, I agree with what you post re thi            01/01/70 00:00      
                        Simply reason why one way transmission            01/01/70 00:00      
                           then why not just do it the easy way            01/01/70 00:00      

Back to Subject List