| osmium 2006-02-25, 9:55 pm |
|
"jack" <virtualspy3@gmail.com> wrote in message
news:1140897187.998933.288240@i39g2000cwa.googlegroups.com...
> Osmium,
>
> Thanks for your answer. The link which you provide partly
> explained/addressed my problem . But ,I still dont get a picture of
> what I should do. As I mentioned above:
>
> I am alloting the 'due time' for each event in the following manner
>
> due_time = global_time + (time one_data_transfer (That's the event
> here) requires ) ------ 1
>
> Now, I place the node in the linked list sorted on the order of
> increasing due_time. And once I start to execute the event, If I happen
> to finish the event before the designated due_time for that event, I
> sleep for the remaining time. But THE MAIN PROBLEM is the time taken
> for one event is exceeding the due_time sometimes(which it
> shouldn't??)
When the event is scheduled to be finished it damn well *has* to be
finished. There is no looking back, you can only look forward. For
example, if a read might result in error handling, the first estimate is the
scheduled time with no error, if an error occurs this is a new job, so to
speak. If necessary, change the initial estimate to the minimum time, when
it expires see what the situation is and reschedule another event if needed.
..
|