1,105,221 Community Members

Can you donate some tips in round robin scheduling algorithm?

Member Avatar
sheena.sabado.5
Newbie Poster
4 posts since Aug 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello daniweb folks. I am here to ask some guidance, tips, suggestions and advices regarding the round robin scheduling algorithm. We are tasked to solve for the waiting time and turn around time of each process. They all have the same arrival time which is zero.

here is my codes:

    For y = 0 To numPro - 1
    burstT(y) = Val(txtBT(y).Text)
    remains(y) = burstT(y) - quantum
        If burstT(y) = quantum Then
            If txtBT(y).Index = 0 Then
            lblWT(y).Caption = 0
            lblTA(y).Caption = Val(lblWT(y).Caption) + Val(txtBT(y).Text)
            Else
            lblWT(y).Caption = quantum
            lblTA(y).Caption = Val(lblWT(y).Caption) + Val(txtBT(y).Text)
            End If
        End If

    Next

    For z = 0 To numPro - 1
        If remains(z) <> 0 Then

            If remains(z) >= quantum Then
            remains(z) = remains(z) - quantum

            ElseIf remains(z) < quantum Then
            remains(z) = remains(z) - remains(z)
            End If
        End If
    Next

    For x = 0 To numPro - 1 'calculating waiting time
        If burstT(x) <> 0 Then
            For num = x To numPro - 2
            remain = remain + quantum
            Next
        End If
        remained(x) = remain 'calculations stored them in the array
    Next

My problem is that when I calculate for the waiting time, it is sometimes below the true answer or above the true answer.
Please guide me awesome daniweb folks. This ignorant me needs your brilliant minds. Any kind of help is very much appreciated! Thanks for reading this! :)

Member Avatar
sheena.sabado.5
Newbie Poster
4 posts since Aug 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

nevermind.. lols thanks by the way :)

Question Self-Answered as of 1 Year Ago
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article