An urgent test can move ahead of waiting work without interrupting the test already running. That simple rule changes the waiting time of every class of work in a shared textile lab. It can protect a time-sensitive sample, but it also shifts delay toward routine jobs.

A priority queue model makes that tradeoff measurable. This guide develops a two-class example for one shared test resource. It calculates urgent and routine waiting times and compares them with first-come service. It also tests the effect of long routine jobs and their spread. The inputs are fictional and illustrate the method; they are not a textile lab benchmark.

The main lesson is practical. A priority label changes the order of waiting jobs. It does not remove test duration, create instrument time, or waive a test method's requirements. A sound policy needs a clear queue boundary and reliable data. It must also reveal the burden placed on routine work.

Define which part of the lab process is a queue

A sample may pass through several steps. These include receipt, identification, conditioning and preparation. Testing, review and report release follow. The elapsed time from receipt to report can therefore contain several waits and several kinds of work. A model of one instrument cannot explain all of that time.

Define the queue entry as the moment a job is ready and eligible for the chosen resource. A sample awaiting required conditioning has not yet entered that instrument's ready queue. A job missing a method, specification or usable test piece may also be ineligible.

This distinction keeps a service promise honest. A buyer may care about the whole report lead time. The model estimates only the wait before one test starts. Record both clocks, and show how they connect. Do not start one clock at receipt and compare it with a result calculated from readiness.

The public scope of ISO 139 concerns atmospheres for conditioning and testing textiles. It supports treating conditioning as a real method requirement. The public page does not give all the steps needed to run a test. This queue example does not replace them.

The same care applies to approval work. ApparelDiary's fabric colour approval guide follows the material, target and buyer decision through sign-off. The model here addresses the wait for a ready test. It does not cover that full approval process.

Choose a priority rule that matches the work

In a nonpreemptive priority queue, the current test finishes before another begins. When the resource becomes free, it selects a waiting urgent job first. If no urgent job is waiting, it selects a routine job. Within each class, the oldest ready job goes first.

Nonpreemptive means that priority cannot stop a job already in service. An urgent sample arriving one minute into a long routine test must wait for the remaining service. This is often the key fact missing from a discussion based only on the order of the waiting list.

A preemptive rule allows higher-priority work to interrupt current service. Whether that is valid depends on the test, instrument and process. An interrupted run may lose its result or need a fresh preparation. Do not assume that an abstract resume rule describes the physical method.

MIT's priority queue lectures explain these rules. They derive a different mean waiting time for each rule. This article uses only the nonpreemptive case. The resource never pauses an active test because an urgent job arrives.

This policy also differs from earliest-due-date scheduling. A fixed urgent class gives all eligible urgent jobs the same class rank. A due-date rule sorts individual jobs by their deadlines. ApparelDiary's EDD and SPT guide addresses those sequencing choices. They should not be treated as the same model.

State the assumptions before calculating

There is one server: one resource that can process one job at a time. It might be an instrument with an operator dedicated for the whole service. If several instruments share one operator only during setup, that is a different resource structure.

Urgent and routine arrivals are independent Poisson streams with constant average rates. Service times are independent of arrivals and of one another. Each class has its own mean and second moment of service time. These moments are finite. The queue has enough space, no jobs abandon it, and the server works whenever eligible work waits.

The total workload must be less than one unit of resource time per unit of calendar time. Otherwise, this steady-state model has no finite overall mean waiting time. Passing that test does not mean that the waits are commercially acceptable.

This is an M/G/1 queue. The M denotes the Poisson arrival assumption. The G allows a general service-time distribution, and the one denotes a single server. The formulas need the first two service moments, rather than one specific service distribution. The worked base case uses exponential service only to make those moments easy to specify.

These assumptions exclude fixed daily batch releases, breaks, overnight closures and shared failures. They also exclude priority that changes while a job waits. If those features drive the lab's performance, build a more detailed model. Use this case as a benchmark. It will not be a complete forecast.

Prepare a two-class data table

Call the urgent class H and the routine class R. Lambda is an arrival rate. The mean service time is the average time for which the selected resource remains occupied by a job. Rho is the fraction of resource time demanded by that class in the long run.

Use one unit of time throughout the calculations. The following case receives one urgent job per hour and two routine jobs per hour. Convert these rates to jobs per minute before multiplying them by service durations measured in minutes.

Input

Urgent H

Routine R

Arrival rate per hour

1

2

Arrival rate per minute

1/60

2/60

Mean service time, minutes

6

15

Service coefficient of variation

1

1

Second service moment, minutes squared

72

450

Workload rho

0.10

0.50

The coefficient of variation is called CV. Divide the service standard deviation by its mean to find it. It has no unit. An exponential distribution has CV equal to one. Assume the service distribution has a finite variance. Its second moment equals the variance plus the squared mean.

E[S squared] = Mean(S) squared × (1 + CV squared)

For urgent work, the second moment is 6 squared times 2, which equals 72 square minutes. For routine work, it is 15 squared times 2, or 450 square minutes. These are not average service durations. They describe both duration and spread.

rho(H) = (1/60) × 6 = 0.10

rho(R) = (2/60) × 15 = 0.50

Total rho = 0.10 + 0.50 = 0.60

Thus the offered work occupies sixty percent of the resource on average. The remaining forty percent does not rule out a queue. Random arrivals can cluster. A long service can hold back later work even when average capacity exceeds average demand.

Calculate the residual-work term

An arriving job may find a test already running. The remaining duration of that service is part of its wait. This holds for an active test of either class. Define R0 as the mean residual service seen at a random arrival. Count zero when the server is idle.

R0 = 0.5 × Sum of lambda(k) × E[S(k) squared]

Here the sum covers both classes. Multiplying jobs per minute by square minutes produces minutes. Taking one half of the sum gives the residual-work term in the same time unit as the waiting result.

R0 = 0.5 × [(1/60) × 72 + (2/60) × 450]

R0 = 0.5 × (1.2 + 15) = 8.1 minutes

R0 is not the remaining time conditional on finding the server busy. It already includes arrivals that find no active job. Confusing these quantities can insert an extra utilization factor. It can also remove one that is needed. Either error gives a wrong answer.

NPTEL's residual-life explanation shows why the active service contributes to nonpreemptive waiting. A higher priority cannot erase that remaining service. The routine class therefore affects urgent waiting even though routine jobs still in the queue must yield.

Establish the first-come baseline

Before changing policy, calculate the same workload under first-come, first-served service, or FCFS. Under these assumptions, both classes have the same mean waiting time before service. Their mean time in the system differs because their mean service durations differ.

Use the Pollaczek–Khinchine mean-wait formula. Divide the residual-work term by one minus total utilization. Stanford's queueing notes derive this relationship and show the role of service variability.

FCFS mean queue wait = R0 ÷ (1 − rho)

FCFS mean queue wait = 8.1 ÷ 0.40 = 20.25 minutes

Add each class's own mean service to obtain mean time from ready arrival to completion. An urgent job takes 20.25 plus 6, or 26.25 minutes. A routine job takes 20.25 plus 15, or 35.25 minutes. Report review and release remain outside this boundary.

This baseline is useful for a policy trial. It holds demand and service assumptions fixed, so the comparison isolates the effect of the queue rule. Comparing one quiet week under FCFS with a much busier week under priority would not isolate that effect.

Calculate urgent-first waiting times

With urgent work ranked first, let W(H) and W(R) denote mean queue wait, excluding service. The MIT lectures give a general nonpreemptive priority formula. The following formulas apply it to two classes.

W(H) = R0 ÷ [1 − rho(H)]

W(R) = R0 ÷ {[1 − rho(H)] × [1 − rho(H) − rho(R)]}

The first denominator reflects the urgent work that can stand ahead of an urgent arrival. The routine denominator also reflects later urgent arrivals that pass a waiting routine job. In both formulas, R0 includes the current service of either class.

W(H) = 8.1 ÷ 0.90 = 9 minutes

W(R) = 8.1 ÷ (0.90 × 0.40) = 22.5 minutes

Urgent mean waiting falls by 11.25 minutes from the FCFS baseline. Routine mean waiting rises by 2.25 minutes. Add service to find mean completion times from ready arrival. Urgent work takes 15 minutes and routine work takes 37.5 minutes.

Measure, minutes

FCFS

Urgent-first priority

Urgent mean queue wait

20.25

9.00

Routine mean queue wait

20.25

22.50

Urgent mean time through resource

26.25

15.00

Routine mean time through resource

35.25

37.50

Little's relationship provides another useful check. Multiply each arrival rate per minute by its class waiting time. The mean urgent queue contains 0.15 job, while the mean routine queue contains 0.75 job. The total mean number waiting is 0.90 job. Fractional means are normal; an actual queue still contains whole jobs.

Check what is conserved and what changes

It is tempting to say that priority only redistributes a fixed average wait. That statement needs a precise choice of weights. Here the arrival-weighted average wait changes. The two classes have different mean service durations.

One third of arrivals are urgent and two thirds routine. Under priority, the average queue wait across arriving jobs is one third of 9 plus two thirds of 22.5, or 18 minutes. Under FCFS, it is 20.25 minutes. Shorter jobs gaining priority helps lower this particular average in the example.

The conservation relationship uses workload weights instead. Multiply each class wait by its rho and add the results. Ivo Adan's priority queue notes explain this weighted conservation law. It applies to the relevant work-conserving rules.

0.10 × 9 + 0.50 × 22.5 = 12.15 minutes

0.60 × 20.25 = 12.15 minutes

The two values agree. That check helps catch a swapped class label or a missing factor in a formula. It does not prove that any proposed real-world priority scheme satisfies all the model assumptions.

If routine work were ranked first, its mean wait would be 16.2 minutes and urgent wait would be 40.5 minutes. The arrival-weighted average would become 24.3 minutes. The workload-weighted total would still be 12.15. This is a calculation comparison, not a recommended lab policy.

priority queues for textile testing

Test variability before buying more capacity

Hold all arrival rates and mean service times fixed. Now change only the spread of routine service. Keep urgent service CV at one. The table shows the effect on the residual-work term and both waits.

Routine service CV

R0, minutes

Urgent wait, minutes

Routine wait, minutes

0, constant service

4.35

4.83

12.08

1, base case

8.10

9.00

22.50

2, more variable service

19.35

21.50

53.75

Total utilization remains sixty percent in every row. In the high-variability case, routine service has second moment 15 squared times 5, or 1,125 square minutes. Substituting that value in R0 produces 19.35 minutes. The priority denominators stay unchanged.

This comparison explains a common concern. Urgent work can wait a long time even when average utilization is moderate. Rare long routine jobs can create a large residual service for arriving urgent work. Static priority cannot interrupt those jobs once they start.

Separate avoidable disruption from valid test duration. Better preparation may reduce delays inside an occupied instrument slot. A more consistent method may reduce variation. But shortening a required exposure or ignoring an invalid run does not count as a sound capacity improvement. Each proposed change needs technical approval and a fresh measured service distribution.

Distinguish more urgent demand from more urgent labels

Suppose urgent arrivals increase from one to two per hour while routine arrivals remain at two. This is extra work. Urgent utilization rises to 0.20, total utilization to 0.70, and R0 to 8.7 minutes. Reapplying the formulas gives urgent wait of 10.875 minutes and routine wait of 36.25 minutes.

The routine class bears a large increase because more urgent work can pass it. Its mean ready-to-completion time rises to 51.25 minutes after adding fifteen minutes of service. The example makes the cost of accepting new rush volume visible before a promise is made.

Now consider a different change: relabel every existing job urgent, without changing the total workload or service mix. If all such jobs follow arrival order, the result is the original single FCFS queue. Mean waiting returns to 20.25 minutes for both original groups. The label no longer selects a smaller protected class.

Do not use the extra-demand calculation for the relabeling case. The inputs have different meanings. Record why a job qualifies for priority. Also note whether it is new demand, a reclassified request or a rework visit.

Build an auditable measurement file

Record a job identifier, test family, priority at entry, ready timestamp, service start and service completion. Record the resource used and the reason for any pause or invalid result. Preserve the original priority and its changes if staff can alter it later.

Estimate queue wait as service start minus ready time. Estimate service as the occupied resource duration within the chosen boundary. If the source field already includes waiting, using it as service counts congestion twice. If the resource is released during a pause, elapsed job duration may overstate its occupancy.

Estimate the second moment by averaging squared service times. Do not square only the average. For example, durations of 5, 5, 5 and 45 minutes have mean fifteen. Their mean squared duration is 525 square minutes, while the square of their mean is only 225. That sample is a separate illustration, not the exponential base case's second moment of 450.

Keep unusually long but valid observations. Deleting them solely because they make the queue forecast worse hides the variability that creates delay. Correct confirmed timestamp errors, then explain any exclusions. A small sample may estimate the second moment poorly. Report how much history and how many completed jobs support it.

Textile labs also need clear service requests. BUTEX's testing service page describes test requests and service arrangements. Use such process requirements to define local eligibility. Do not turn a provider's published service mode into a universal arrival-rate or duration benchmark.

Separate test visits from commercial requests

The arrival rate should count the jobs that actually request the modeled resource. One commercial request may require several test visits. A repeat run after an invalid result may also return to the same queue. Counting only the original request can understate resource demand.

Choose the job unit before estimating a rate. If a standard test bundle always occupies the resource continuously, one bundle may be a useful unit. If its parts visit different instruments or return at different times, one bundle is not a single service in this model. Keep the route visible instead of hiding several queues inside one average.

Do not add a blanket rework percentage to service time and also count the repeat visits as new arrivals. That would count the same burden twice. A separate repeat visit belongs in the arrival stream. Work done within the original occupied slot belongs in that visit's service time. Correlated repeat arrivals may then require a richer arrival model.

Priority also needs a defined lifetime. A request may be urgent at receipt but routine once a missed dispatch has passed. Another may become urgent after a buyer changes a decision date. A static two-class calculation assumes the class used for queue service stays fixed. A policy with such changes needs its own trace and model.

Plan a measured priority trial

Start with a written decision rule that staff can apply before seeing the queue outcome. State who can approve urgent status and which ready jobs qualify. Define the timestamp that resolves ties within a class. Avoid judging success by how many requests were called urgent after they had already waited.

Record the counterfactual policy clearly: first-come service for the same eligible job stream. For a live trial, it may be impossible to observe both policies on the same real instrument at once. An analytical comparison or a validated replay can help separate the rule's effect from changes in demand. Label such results as modeled comparisons.

Compare the trial's measured arrival rates, mean service and second moments with the planning inputs. If these changed, calculate the revised analytical expectations before blaming or crediting the new priority rule. Report the job count in each class alongside the averages. A handful of urgent jobs can give an unstable mean.

Keep the acceptance criteria at the class level. Ask whether urgent waiting improves enough. Also check whether routine delays stay within the lab's agreed service limits. An overall average alone cannot answer that question. The weighted conservation check helps detect calculation errors. It cannot replace those service judgments.

Finally, log every exception in which staff deliberately select another job. The reason may be valid, such as a fixture restriction or an already prepared run. Repeated exceptions reveal that the modeled resource or eligibility rule is incomplete. Use them to improve the process description before fitting a more elaborate formula.

Operate and troubleshoot the policy

Track urgent and routine results separately. A single blended mean can conceal worsening routine service. Report counts, queue waits, completion times and the share meeting each locally agreed target. Note whether those targets run from receipt, readiness or another milestone.

If urgent waits exceed the model, first compare the observed boundary with the modeled one. Check for long active tests, batch arrivals, downtime and priority changes. An instrument that waits for an unavailable operator is not the always-available single server assumed here.

If routine work ages too far, a lab may reserve some capacity or raise an old job's priority. Such rules can be sensible, but they change the model. Do not keep applying the static two-class formula unchanged and present its result as a forecast of the new policy.

The public scope of ISO/IEC 17025 concerns laboratory competence. It also addresses impartiality and consistent operation. A queue policy should fit the lab's controlled process. A priority rule alone does not establish conformity with that standard. It does not establish accreditation either.

Use simulation for rules the formula cannot represent

A detailed model can include calendars, sample batches, multiple instruments, shared staff and priority aging. Start by reproducing the simple analytical case. Then add one real operating feature at a time. This helps explain why each result changes.

SimPy's resource documentation distinguishes PriorityResource from PreemptiveResource. The former orders pending requests; the latter can interrupt resource users. In its priority ordering, lower numeric values mean higher priority. Record that convention to avoid reversing urgent and routine work in code.

Arrival assumptions may also need richer treatment. Takine's research on nonpreemptive priority queues studies a broader Markovian arrival setting. Its existence does not validate a Poisson fit for a particular lab. Check the data and choose a model appropriate to the release pattern.

Frequently asked questions

Does a nine-minute mean wait guarantee service within ten minutes?

No. A mean is not a maximum or a percentile. Some jobs can wait much longer. Suppose the target is ninety-five percent starting within ten minutes. That needs a waiting-time distribution or a suitable validated simulation. Its assumptions must also fit the operation.

Can the formula cover several instruments by dividing service time?

Not in general. Several parallel servers create different queue behavior. Shared operators, dedicated fixtures and test compatibility add further constraints. Use a model that represents those resources instead of replacing them with an artificially fast single server.

Is urgent-first always the best policy?

No. The preferred rule depends on deadlines, consequences, fairness and technical constraints. This calculation quantifies one policy's mean delays. It does not assign business value to each delay or choose who deserves priority.

Make the tradeoff explicit

In the worked case, urgent-first service lowers urgent mean waiting from 20.25 to 9 minutes. Routine waiting rises to 22.5 minutes. The gains depend on a protected class, a clear readiness boundary and a stable service process. More variable routine tests can still delay urgent work already waiting for an active run to finish.

Use those results to design a measured policy trial. Keep method requirements intact and monitor both classes. Revise the model when demand or operating rules change. Priority then becomes a clear service decision with visible costs. It is more useful than labeling every late sample urgent.

Priority waiting times follow queueing ideas, so see queuing theory for buffer sizing, EDD versus SPT dispatch rules and machine capacity planning.

References

1. MIT: Lectures on M/G/1 and Priority Queues. Nonpreemptive and preemptive priority formulas.

2. Ivo Adan: Priority Queues. Class waiting equations and the workload-weighted conservation law.

3. NPTEL: Residual Life in Priority Queues. The remaining service of an active job.

4. Stanford EE384X: Queueing Theory Handout. M/G/1 assumptions, second moments and the FCFS mean-wait formula.

5. SimPy: Shared Resources. Priority and preemptive resources and numeric priority order.

6. ISO 139: Textiles—Standard Atmospheres for Conditioning and Testing. Public scope of the conditioning and testing standard.

7. ISO/IEC 17025: Laboratory Competence Requirements. Public scope covering competence, impartiality and consistent operation.

8. BUTEX: Textile Testing and Consultation Services. Request and service-process context.

9. Takine: The Nonpreemptive Priority MAP/G/1 Queue. Primary research abstract for a broader arrival model.