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

nevermind.. lols thanks by the way :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.