C++ Programming Assignment For Operating Systems: Write Scheduling Program

Posted Under: Operating Systems

Ask A Question
DESCRIPTION
Posted
Modified
Viewed 16
All details are in attached file
Attachments
CSO Lab #1: Scheduling 1 Introduction In this lab you will simulate the scheduling of n processes P1, P2, ..., Pn on a single CPU. You will simulate both FIFO(First come, first serve) and Round Robin scheduling. 2 Trivial Case n = 1 Each process Pi, if run alone (i.e., if it were the only process) would have four phases (R1i, B1i, R2i, and B2i) followed by a final “termination phase”. 1. Pi would first run for time R1i (presumably initializing its data struc tures, but the reason is not relevant to the lab). 2. Pi would then block for time B1i (presumably reading its input). 3. Pi would then run for time R2i (computing its results). 4. Pi would the block for time B2i (outputting its results). 5. Finally, Pi would run for time 1 (just to terminate). 3 Creation Time and Breaking Ties Creation Time For simplicity all processes are created at time 0. No input is required to specify this rule Breaking Ties Use our standard tie-breaking rule. Since all processes are created at the same time, ties are broken by favoring the alphabetically first process. No input is needed to specify this rule. 1 4 Input All time units are milliseconds. Each simulation begins by reading the parameters for the current run. Specifically: n :The number of processes. SA : The scheduling algorithm to use. 1 signifies FIFO; 2 signifies RR with quantum q. q :The quantum for RR scheduling. q is present only if SA=2. R11, B11, R21, B21, ..., R1n, B1n, R2n, B2n : The four running and blocking times for each process. Note that all four values for Pi are given before any values for Pi+1. Remember that each Pi runs a third time, in order to terminate. Since that last run is always for 1 time unit, no input is needed for its specification. 5 Output At each cycle indicate which processes (if any) are running, which are ready, and which are blocked. See the two sample runs below. 6 Breaking Ties Use our standard tie-breaking rule. Since all processes have the same creation time, the alphabetically first process wins the tie. 7 Computer Language All 202 labs must be in the C (or C++) language. 8 A Simple, But Not Trivial, Example 8.1 Input n=2 There are 2 processes, P1 and P2. SA=1 FIFO scheduling (hence, no preemption and q is not present). Rs and Bs All Rs are 3 and all Bs are 2. 8.2 Input As Specified To Your Program 2 1 3 2 3 2 3 2 3 2 Note that the order is n, SA, R11, B11, R21, B21, R12, B12, R22, B22. Example Output: 9 An Example With Preemption 9.1 Input n=2 There are 2 processes, P1 and P2. SA=2 RR scheduling. q=1 RR quantum is 1ms. Rs and Bs All Rs are 3 and all Bs are 2. 9.2 Input As Specified To Your Program 2 2 1 3 2 3 2 3 2 3 2 Note that the order is n, SA, q, R11, B11, R21, B21, R12, B12, R22, B22. Output
Explanations and Answers 0

No answers posted

Post your Answer - free or at a fee

Login to your tutor account to post an answer

Posting a free answer earns you +20 points.

Login

NB: Post a homework question for free and get answers - free or paid homework help.

Get answers to: C++ Programming Assignment For Operating Systems: Write Scheduling Program or similar questions only at Tutlance.

Related Questions