In this thesis we consider the optimal stochastic scheduling of a queueing system with two interconnected queues and a certain number of flexible servers. Jobs of a queue incur holding costs during the time they remain in the system. The objective is to find the optimal strategy, i.e. to allocate the servers to the queues, such that the expected holding
costs until the system is empty are minimized. Some special cases of the general model have already been considered in the literature but since there are only structural results concerning the optimal strategy we are interested in the
explicit solution of the problem or at least of certain
interesting cases. Since it is not possible to solve the general problem entirely because of its complexity we concentrate our research on some typical cases. So we study a general tandem queue and the problem of scheduling jobs on parallel servers. In order to be able to calculate the optimal strategy, it is necessary to consider preemptive policies and transfer the results to the nonpreemptive model. In some cases we are able to give the optimal strategy explicitly depending on how many jobs are present in the two queues and in some other cases we are capable to give conditions for which it is optimal to serve jobs only from a certain queue.