hi there

how do i determine the average Number of Queue Items that leave the queue (example: processes leaving the ready queue in order to be Running in the CPU) per second?

i need this value to calculate for the average waiting time.
the formula is:
w = n/X
where n is the average queue size and
X is the average number of queue items leaving the queue per second.

Recommended Answers

All 2 Replies

Huh? You are misunderstanding about the equation for CPU scheduling...

The average waiting time is the total waiting time of all processes divide by the total number of all processes. It is not your 'queue' size at all. Using queue time will be very dangerous and can be easily inaccurate.

/*
For example
process   required process time   arrival time unit
p1                10                    0
p2                12                    7
p3                 7                    9

Ignoring the CPU burst, now the process will be put into scheduling as...
0         10        20        30
|---------|---------|---------|-----
|         |           |      |
p1        p2          p3     end

Now compute the waiting time...
p1 -> arrives and starts => 0
p2 -> arrives at 7 but waits until 10 to start => 3 (10-7)
p3 -> arrives at 9 but waits until 22 to start => 13 (22-9)

w = (0 + 3 + 13) / 3   <-- total waiting time / total number of process
*/

aye, W=N/X is called "Little's Formula"
i googled it meself... :)

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.