|
Post by ezmoney on Apr 7, 2013 8:50:35 GMT -5
I wanta do a Round Robin Que... This just indexs a certain number of rows to store data... Once it reaches the allocated end it starts over and assuming the number of rows are not exceeded the system would go on updating of anything.... Round Robin Que is nothing more than a circular que. ;D I could do it as a table, data base, or a random file... Thought I might ask around and see if anyone every did this... No need to reinvent the wheel... Has anyone every done this and if they are willing to share their knowledge and experience it might be eye opening... I am sure there are trade off considerations with any design.. Just want to consider all options and like to keep it simple .. Complex code is a kiss of death... good bye complex code.
|
|
|
Post by meerkat on Apr 10, 2013 10:40:32 GMT -5
I can't speak for anyone else, however I've found in general that round robin files have always been more trouble than they are worth. Some do work very nicely. Not knowing what you will round robin on, I can't give you my opinion.
Lets say you want to round robin every month. So you pick the day number to round robin on. Even here you have problems. You may have a day without activity. So the day numbered data could be for any past month, and not the latest month. So you still need to carry the date to compare on. And I suspect you still need a clean up procedure.
Personally I like to keep things simple. So in my opinion if you do decide on a round robin, I would stick with SQLite or some other DB. Since DB's have all the tools to maintain, index, purge, change schemas, interactive queries, do complex joins and projections, I stick with it. Not too many file schemas you can change and not affect your programs. And as things progress, you will probably change the schema several times.
In your case you will need to look at exactly what problems you will have with a round robin and make a decision on that.
|
|
|
Post by ezmoney on Apr 10, 2013 15:41:50 GMT -5
I was wanting to do a schedualing project, for emails.. Limited to 500/hour by the hosting site I could easily divide any hour into 500 increments of time then allocate as close as I could to the time wanted or what was not taken.
Thus if someone wanted an email at 6am and the time slot was taken I could search near plus or minus and probable find something.
Once an email was sent then the system would schedual based on the user requirements..
These would be repeating so the reschedual would be for what ever time increament was wanted probable a 24 hour would be most likely.
Thus the new send time would be 24 hours forward in time assuming that slot was open.
Thus like a dog chasing its tail the update moves around the circular que.
I think these are common in allocating time for computer users so every one gets a slice of time generally this is done to maximize the number of users through put.
I had one que where I read the cue into storage... . Assigned the first one to the process, then rewrote the file out and added the first one to the end of the file... Thus the system kept reading thru and rewrite.... That seemed like a poor way but worked...
I thought of using a random file with one of the links used to store the pointer to the next input to the program... Mulitple programs could open and read but not write...
I hear data base lock things down when a write occurs.
And any program that tries to get in is held up till the write program completes.
Being this is just one small address in the system then that should not offer much of an issue.
Now when you get a lot of programs reading that one data link then it has to be managed rather closely... I've had as many as 30 programs grabbing for data and seemed work most of the time unless two programs got in simultaniously. Not sure how Windows handels this.
There was about 3500 array points each program would read them into the array and then move the top to the bottom and rewirte back to the file for the next program to do the same thing... then there was an assign at the end of the array and the first file was copyed there Then the write was '234567 open output$ for output as #1 ar$(n+1)=ar$(1) for i=2 to n+1... print #1,ar$(i) next i close #1
Thanks for your insight..
|
|
|
Post by StefanPendl on Apr 10, 2013 16:10:09 GMT -5
I thought of using a random file with one of the links used to store the pointer to the next input to the program... Mulitple programs could open and read but not write... Random access files are open for read and write, there is no sharing of the file possible. Windows allows to open a file for reading by multiple processes, if there is reading shared, but RB doesn't offer this ability. RB always handles file access exclusively.
|
|
|
Post by ezmoney on Apr 11, 2013 1:08:48 GMT -5
Does that include RB DB files?
|
|
|
Post by StefanPendl on Apr 11, 2013 16:41:07 GMT -5
SQLite is entirely handled by the SQLite DLL, so I haven't checked out how the DB is opened.
|
|