Ejemplo n.º 1
0
        private static void Simulate(long threadsQuantity, long[] jobsDuration)
        {
            var threads = new MyPriorityQueue(threadsQuantity);
            var jobs    = new Queue <long>(jobsDuration);

            while (jobs.Any())
            {
                var newJobDuration = jobs.Dequeue();
                var activeThread   = threads.GetThread();
                Console.WriteLine($"{activeThread.Index} {activeThread.ReleaseTime}");
                activeThread.ReleaseTime += newJobDuration;
                threads.SiftDown(0);
            }
        }