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)
            lblWT(y).Caption = quantum
            lblTA(y).Caption = Val(lblWT(y).Caption) + Val(txtBT(y).Text)
            End If
        End If


    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

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

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! :)

Edited by sheena.sabado.5

5 Years
Discussion Span
Last Post by sheena.sabado.5
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.