Optimal scheduling order for two queues of jobs
There is a simple pseudo-polynomial time algorithm that works when all tasks take the same unit time. You can transform your problem into this by rounding all completion times to some greatest common divisor, and splitting all longer tasks up into copies of unit portions. E.g. if your original completion times were $6$, $8$ and $12$ seconds you could use $2$ seconds as your unit time. Then you'd have respectively 3 copies, 4 copies and 6 copies of the unit task in a row.
Let's name the two queues $A$ and $B$. Let $T[i,j]$ be the optimal time needed to run the first $i$ tasks from $A$ and the first $j$ tasks from $B$. Let $A[i]$ be the resources required for task $i$ from $A$ and similarly for $B$. Let $m$ be the maximum number of resources available.
Of course $T[x,0] = T[0,x] = x$. Then:
$$T[i,j] = 1 + \begin{cases}T[i-1, j-1] &amp; \text{if }A[i] + B[j] \leq m\\\min (T[i-1,j], T[i,j-1]) &amp;\text{otherwise}\end{cases} $$
If you keep track of your choices you can reconstruct the optimal solution. The above is also amenable to bottom-up dynamic programming, in fact you only need to have two arrays $T_i[j]$ and $T_{i-1}[j]$.

I'm not claiming the above is terribly good or an optimal solution, but it's a simple algorithm that gets the job done. Perhaps someone else has a better answer.