Friday, May 21, 2010

Can you help me about write fifo or srt policy in c++ by array or other?

please help me!


my english is very bad , parden me !

Can you help me about write fifo or srt policy in c++ by array or other?
Basically, you need to make your array circular. You do this by checking if your input or output index have reached the end of the array, if they have, then set them back to 0. When you read in data, put it in at input_index and increment input_index. When you read output read from output_index and increment output_index. Check for the conditions where the array is full and where the array is empty. Not that full does not mean the index is necessarily at array.length and empty does not necessarily mean the index is at 0 since you have made the array circular. That should work for fifo. Maybe I am having an off day, but can you write out what srt policy is?


No comments:

Post a Comment