السلام عليكم ورحمة الله وبركاته
كيفكم اخواني اعضاء منتديات اعضاء الفريق العربي للبرمجة
اواجه مشكلة كبيرة في عمل برنامج بواسطة لغة السي بلس بلس البرنامج عبارة عن
(CPU Scheduling Simulator )
أنا حاولت اسبوع كامل لكن في أشياء في السي بلس بلس ماني عارف كيف اعملها
اتمنى منكم مساعدتي ولكم جزيل الشكر
وهذا المشروع
The User Processes:
Processes in this system fall under any one of the following types:
Type-1: Consists of:
10 CPU bursts of the following lengths: (1,2,1,1,1,3,1,2,2,1) Time Units,
09 I/O bursts of the following lengths: (6,4,10,3,5,3,2,10,6) Time Units.
Type-2: Consists of:
15 CPU bursts of 05 Time Units each, and
14 I/O bursts of 15 Time Units each.
Type-3: Consists of:
12 CPU bursts of 1000 Time Units each, and
11 I/O bursts of 05 Time Units each.
Type-4: Consists of:
A repeated pattern of (CPU, I/O1, Think, I/O2), where:
Each CPU burst takes 03 Time Units,
Each I/O burst takes 03 Time Units,
Think time takes 60 Time Units.
Any one of the types above can be created at any time. Type-4 has a maximum of N instances. No new processes of this type can be created after this limit. Processes of Type-1 to Type-3 terminate after executing their last CPU burst, while processes of Type-4 never
terminate, they cycle through their pattern forever. Assume that a process in its think period stays out of the Ready Queue, say in a special queue.
3. The Operating System components:
a) A number of CPU scheduling algorithms including, FCFS, SJF, RR, and a Multi-Level Feedback queue (MLF) with 3 levels. Assume that the Quantum size Q1 for RR and the first level of MLF is given as an input to the program at run time. Also assume that the quantum size for the second level of the MLF is Q2 = 2*Q1, and that the third level is FCFS.
B) A Supervisor, its job is to control all system operations, including the timer functions and interrupt handling.
c) A Dispatcher, its job is to do the context switching and assign the CPU to the process selected by the CPU scheduler.
d) A Creator, is responsible for creating new processes of a given type. This is done by creating their PCBs and putting them in the ready queue.
e) A Terminator, is responsible for terminating finished processes by disposing off their PCBs.
f) An I/O Monitor, it is responsible for monitoring the processes completing their I/O. It generates an I/O Completion interrupt to the CPU each time a process finishes its I/O burst. For simplicity of simulation, it also takes the process's PCB to the ready queue.
g) The Job Generator, it's purpose is to generate new jobs and select their types randomly, then call the creator to create their PCBs and enter them into the system. Job types are selected using an integer random number generator in the range [1,4] that has a uniform distribution over that range. The C / C++ rand() function can be used.
Jobs are assumed to arrive randomly according to Poisson distribution with an expected value, v, in the range [0,1] provided to the program at run time. Use the following Poisson generator at each time step to get the number of new jobs to be created at that time step, then use the random number generator to get its type.
h) The Poisson generator:
int poisson (double v)
{
double x, em;
int n;
em = exp(-V);
x = rand(seed); // 0< x <1
n = 0;
while (x > em)
{
n++;
x *= rand(seed);
}
return n;
}
i) A statistic collecting module, used to keep important information about the system and report the following:
1- The total number of time units used in the run.
2- The total number of each job type created and the total number of each job type terminated.
3- The Maximum, and Average queue length for each of the queues in the system.
4- The Minimum, Maximum, and Average response times for jobs of Type-4 only.
5- The Minimum, Maximum, and Average Turnaround time for each job type other than Type-4.
6- The Minimum, Maximum, and Average Turnaround time for all jobs other than those of Type-4.
7- The total system Throughput for jobs of Type-1 to Type-3.
8- The Percentage of CPU idle time, and CPU utilization.
9- The Minimum, Maximum, and Average of CPU overhead time.
4. Assumptions:
a) The CPU context switching time takes 1 Time Unit.
B) The I/O completion interrupt takes 3 Time Units.
c) The SVC start I/O interrupt takes 2 Time Units.
d) Job scheduling overhead takes 1 Time Unit.
e) All other supervisor activities take 1 Time Unit per call.
f) When the MLF queue is used, all processes are initially entered into the first level queue.
g) The MLF queue lets processes go from the first to the second and then to the third level only but not the reverse.
h) Response time is defined for Type-4 jobs only. It is the total time period spent from the end of I/O2 operation to the start of I/O1 operation, including the CPU burst time, CPU overhead and all Queue delays in this period.