| ??? 08/28/03 19:35 Read: times |
#53594 - RE: circular queue module Responding to: ???'s previous message |
Thanks to those that have replied. Maybe a little more description of what I'm implementing will help.
Basically what I'm implementing is an error logging system for our embedded system. The system needs to be able to store and display the last "n" logged errors. Various modules within our system would like to post an error to a non-volatile memory when an error is discovered. We are also considering the possiblity that one of these modules might want to just update an occurence count in a given log entry if a previous error occurs again. We also need to be able to display the log entries, including allowing a user to scroll up/down the list once the list grows to more than what can be displayed on one screen. I've been a part of a large firmware team which used a logging system like this but this is the first time I've been slated to write the module myself (from scratch or otherwise). Currently we're planning to use some (most?) of a 32KB EEPROM as the non-volatile storage. I may have something wrong in my terminology here but we have been calling our list of entries a "circular queue" in that we are planning to implement it by treating the EEPROM as an array of log entries with the valid log entries existing between some "head" and some "tail", allowing for wraparound of the physical memory (EEPROM). We would then store our head/tail information separately in a "header" in the EEPROM. The idea is that the number of valid entries in the log would grow until the log is full ("n" entries), and then subsequent errors would overwrite existing entries, beginning with the earliest (& thus moving the head). My understanding of the terminology is that this type of algorithm/data structure is called a "circular queue" - can someone correct me if I'm wrong? My assumption is that what I've described above has been implemented thousands of times and that it would behoove me to see if someone in this group could point me toward one of those implementations so that at a minimum I could learn from it to find things in my own implementation that I've overlooked. So, replying to those who've replied (except the replies that the moderator seems to have deleted since I read them last night): Jez: A straight forward linked list is an idea I hadn't given sufficient thought. I had initially thought that rewriting log entry "previous" and "next" pointers stored in the EEPROM would be unwieldy, but I guess its truly comparable to rewriting the "head" and "tail" pointers that I'm doing now. As far as a google search, looking at the first 10-30 hits for several searches didn't seem to turn up anything (they either didn't include source code or the source was Perl, Java, or C++). I was really hoping for a "been there/done that" reply from someone in the group. Erik: I'm looking for help clearing up my misconceptions you mentioned. There were quite a number of things I had mentioned that you indicated did not apply to "circular" or "circular buffer". My understanding is that the terms "circular buffer" and "circular queue" are interchangeable - can you (or anyone else) tell me if this is true? I know that adding in the capability to modify an entry (e.g. to update an occurence count) and the capability to work on a limited portion of the entries (e.g. displaying only a screenful of entries somewhere in the middle of the list) are not a typical circular queue activities, so does this mean that my system is not really a circular queue and is instead something else entirely? abhishek: No, I believe a linear list is sufficient in this case as I only need to maintain the list ordered strictly by time of entry. |
| Topic | Author | Date |
| circular queue module | 01/01/70 00:00 | |
| RE: circular queue module | 01/01/70 00:00 | |
| RE: circular queue module | 01/01/70 00:00 | |
| RE: circular queue module | 01/01/70 00:00 | |
| RE: circular queue module | 01/01/70 00:00 | |
| RE: circular queue (logging module) | 01/01/70 00:00 | |
| RE: circular queue (logging module) | 01/01/70 00:00 | |
| RE: clarification | 01/01/70 00:00 | |
| RE: circular queue (logging module) | 01/01/70 00:00 | |
| RE: circular queue (logging module) | 01/01/70 00:00 | |
RE: circular queue (logging module) | 01/01/70 00:00 | |
| RE: circular queue module | 01/01/70 00:00 | |
| RE: circular queue module | 01/01/70 00:00 |



