43 | | N:: scan at least this many slots |
44 | | (if scan N slots and have enough jobs to send, stop) |
45 | | M:: scan at most this many slots |
46 | | (even if don't have enough jobs to send yet) |
47 | | L:: if scan this many locked slots, print warning msg |
48 | | (should increase shmem size) |
| 47 | N:: scan at least this many slots (if scan N slots and have enough jobs to send, stop) |
| 48 | M:: scan at most this many slots (even if don't have enough jobs to send yet) |
| 49 | L:: if scan this many locked slots, print warning msg (should increase shmem size) |
58 | | i = i+1 % array_size |
59 | | slots_scanned++ |
60 | | if slots_scanned > M |
61 | | break |
62 | | if shmem[i] is empty |
63 | | continue |
64 | | if shmem[i] is locked |
65 | | slots_locked++ |
66 | | continue |
67 | | j = shmem[i] |
68 | | if !fast_filter(j) continue; |
69 | | v = v(h, j) |
70 | | if v > lowest score in x |
71 | | lock j |
72 | | release semaphore |
73 | | if !slow_filter(j) |
74 | | acquire semaphore |
75 | | unlock j |
76 | | continue |
77 | | acquire semaphore |
78 | | if x satisfies client's work request |
79 | | unlock and remove lowest-score element of x |
80 | | add j to x |
81 | | if x satisfies client's work request and slots_scanned >= N |
82 | | break; |
| 59 | i = i+1 % array_size |
| 60 | slots_scanned++ |
| 61 | if slots_scanned > M |
| 62 | break |
| 63 | if shmem[i] is empty |
| 64 | continue |
| 65 | if shmem[i] is locked |
| 66 | slots_locked++ |
| 67 | continue |
| 68 | j = shmem[i] |
| 69 | if !job_feasible_fast(j) continue; |
| 70 | v = v(h, j) |
| 71 | if v <= lowest score in x |
| 72 | continue |
| 73 | S = jobs in x with value >= v |
| 74 | if !job_set_feasible(S+j) |
| 75 | continue |
| 76 | lock j |
| 77 | release semaphore |
| 78 | if !job_feasible_slow(j) |
| 79 | acquire semaphore |
| 80 | unlock j |
| 81 | continue |
| 82 | acquire semaphore |
| 83 | add j to x |
| 84 | while (x minus lowest-val element) satisfies work request |
| 85 | remove lowest-val element of x |
| 86 | while !job_set_feasible(x) |
| 87 | remove lowest-value element of x |
| 88 | if x satisfies work request and slots_scanned >= N |
| 89 | break; |