I don't know if I make any strange mistake, but I have done the following simple thing.
 
 
File p.c :
 
#include <stdio.h>
 
FILE    *fp             ;
 
main()
{
register int    i       ;
 
for (i=0;i<1000;i++)
        {
        fp=popen("lpr -Plp","w");
        fprintf(fp,"Richiesta N. %d\n",i);
        pclose(fp);
        }
}
then
 
cc -o p p.c
 
./p
 
the result of lpq after this is:
 
waiting for lp to become ready (offline?)
Rank   Owner      Job  Files                                 Total Size
1st    root       33   (standard input)                      15 bytes
2nd    root       30   (standard input)                      15 bytes
3rd    root       35   (standard input)                      15 bytes
4th    root       36   (standard input)                      15 bytes
5th    root       29   (standard input)                      15 bytes
6th    root       31   (standard input)                      15 bytes
7th    root       37   (standard input)                      15 bytes
8th    root       38   (standard input)                      15 bytes
9th    root       39   (standard input)                      16 bytes
10th   root       40   (standard input)                      16 bytes
11th   root       41   (standard input)                      16 bytes
12th   root       42   (standard input)                      16 bytes
13th   root       32   (standard input)                      15 bytes
14th   root       34   (standard input)                      15 bytes
15th   root       56   (standard input)                      16 bytes
16th   root       57   (standard input)                      16 bytes
17th   root       43   (standard input)                      16 bytes
....etc
 
As you can see, the first on the queue is Job 33, while the second is 30 and so on ....
The sizes are irrilevant because they are the same.
For this reason, and for similar problems, it is desiderable that the order of the requests is the same. I think that must be a chance to respect the order of the requests to avoid situations like this.
 
Thanks.
 
 

Reply via email to