菜鸟遇到试验问题(C++),诚请各位达人帮助!
小弟最近在学习当中遇到一个试验,是关于内存调度的(scheduler) 请各位达人予以帮助:试验:
完成三个独立周期的任务(Task): 任务(运行周期,执行时间)
Task1(4,1) Task2(5,2) Task3(10,2)
每一个任务被执行以后,会进行循环(loop),并且要求显示是哪一个正在执行,每一个任务在耗尽自己的分配时间以后必须自行中止.
要求:
1.使用C或者C++设计三个独立的任务(Task).
2.将三个任务引入同一个调度(scheduler),并且每一个独立的任务在适当的时间运行.
试验的原版是英文的,翻译的不好请原谅,原版如下:
You are to implement 3 independent periodic tasks whose parameters (period, execution time) are as follows:
T1 = (4,1) T2 = (5,2) T3 = (10,2)
Each job within a task, when executing, should just loop, each time printing a message identifying who it is and checking elapsed time until its allocated time is used up. At this point it should terminate itself.
1. You should firstly work out the hyper period. Then design a valid schedule over the hyper period. Finally implement the schedule in the form of a table as described above.
2. Write a C function for each of the 3 tasks.
3. Write a program that implements the scheduler, i.e. that creates the table and starts the scheduler which then accesses the table at the appropriate time.
4. Confirm that the program behaves as expected.