public void TaskFileReader2()
        {
            var fileName        = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Task3Import.txt");
            var resultReadInDto = TaskFileReader.ReadInTasksFromFile(fileName);
            var taskSet         = resultReadInDto.tasks;

            Assert.Equal(taskSet.Count, 2);
            Assert.Equal(taskSet[0].ExecutionTime, 52);
            Assert.Equal(taskSet[0].Period, 100);
            Assert.Equal(taskSet[0].Deadline, 110);
            Assert.Equal(0, taskSet[0].StaticPriority);
            Assert.Equal(taskSet[0].DynamicPriority, 0);


            Assert.Equal(52, taskSet[1].ExecutionTime);
            Assert.Equal(140, taskSet[1].Period);
            Assert.Equal(154, taskSet[1].Deadline);
            Assert.Equal(0, taskSet[1].StaticPriority);
            Assert.Equal(0, taskSet[1].DynamicPriority);

            var exist = ResponseTimeAnalysis.PerformScheduabilityStudy(taskSet, resultReadInDto.NumberOfPropertiesSpecificed);

            var id = 1;

            foreach (var task in taskSet)
            {
                task.Id = (id++).ToString();
            }
            EarliestDeadlineFirst.Simulate(taskSet);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("You have now started the coolest program ever!");
            Console.WriteLine("The ScheduleFinder 2000 is here to help you assign the right priorities to your tasks to make sure tht all deadlines are met!");
            Console.WriteLine("Type in the path to your task and let me assign priorities to the task:");
            var path = Console.ReadLine();

            while (!File.Exists(path))
            {
                Console.WriteLine("The path you provided is not valid. Can you please provide a valid path:");
                path = Console.ReadLine();
            }
            Console.WriteLine("Should schedule allow preemption? (y/n)");

            var allowPreemption = true;

            var readInTasks = TaskFileReader.ReadInTasksFromFile(path);
            var taskSet     = readInTasks.tasks;
            //This is all the 3 programs
            var isTaskScheduable = ResponseTimeAnalysis.PerformScheduabilityStudy(taskSet, readInTasks.NumberOfPropertiesSpecificed);


            var fileName = "Test";

            GenerateResultFile(taskSet, isTaskScheduable, fileName);

            Console.WriteLine(isTaskScheduable ? "The task set is scheduleable" : "No feasible assignment found.");
            foreach (var task in taskSet)
            {
                Console.WriteLine(task.ToString());
            }
        }