We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

# CS604 Assignment No 02 Solution & Discussion Due Date: Dec. 06, 2016

Assignment No. 02 Graded Semester: Fall 2016 CS604: Operating Systems Total Marks: 20 Due Date:06/12/2016 Instructions: Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if: The assignment is submitted after due date. The submitted assignment does not open or file is corrupt. Assignment is copied(partial or full) from any source (websites, forums, students, etc) Note: You have to upload only .doc file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. Objective: The objective of this assignment is to provide hands on experience of: Implementation of CPU scheduling algorithm To know the algorithm behind different scheduling mechanisms Comparisons of CPU scheduling algorithms For any query about the assignment, contact at CS604@vu.edu.pk Assignment Question No. 1: (marks 15) Three processes P1, P2, P3 reaches at the same time for processing with burst time as given in the following Gantt chart. Process P1 P2 P3 Burst Time (ms) 10 4 8 Consider time slice of 4 milliseconds for both algorithms. You are required to provide Gantt chart for each of the following CPU scheduling algorithms and calculate average waiting time and average turnaround times. 1. Shortest Remaining Time First 2. Round Robin Write down all attributes in tabular form for both algorithms. Table format is given as under, Process Burst Time Arrival Start Wait Finish TA P1 10 P2 4 P3 8 Gantt Chart : ? Average waiting time = ? Average turnaround times (TA) = ? Note: No need to write theory. Just give Gantt chart, Waiting Time and Turnaround Time. Best of Luck

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

Views: 8005

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Attachments:

### Replies to This Discussion

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>

Note:-

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

&

can any one tell me how to calculate robin round calculations...

The basic purpose of this algorithm is to support time sharing system. This algorithm is similar to the FCFS algorithm but now it is preempted FCFS scheduling. The preempted take place after a fixed interval of time called quantum time of time slice. Its implementation requires timer interrupt based on which the preemption take place.
Consider the set of the processes lined up in the ready queue. The processes are taken out of the ready queue in FCFS order. Let us suppose that a process has been taken up for execution now. The execution cannot go beyond that time slice. This process may either finish up its execution before the time goes off or CPU will be preempted from it after the timer goes off and this cause an interrupt to the operating system. At this time, context switching will take place. The next process will be taken up from the ready queue. The process, which is left by the CPU, will be added to the tail of the ready queue.

robin hood scheduling

 process CPU Burst Time p1 10 p2 5 p3 2

The Gantt chart is shown below:

robin hood scheduling

Waiting time for P1 = 0 + (6-2) + (10-8) + (13-12) = 7 Millisecond
Waiting time for P2 = 2+ (8-4) + (12-10) = 8 millisecond
Waiting time for P3 = 4millisecond
Therefore average waiting time = (7+8+4)/3 = 6.33 Millisecond

As shown in figure: first p1 gets the cpu and get executed for 2 millisecond, then context switching occurs and P2 get cpu for 2 millisecond, then again content switching occur and P3 get cpu for 2 millisecond, since its cpu burst time is 2 millisecond only, therefore it complete its execution and thus do not get the cpu again. P1 and P2 similarly continue to share the CPU in the same fashion till they are done.

Overall performance depends on

• Size of the time quantum
1. If time quantum is large than the CPU burst then this algorithm become same as FCFS and thus performance degrade.
2. If the time quantum size is very small, then the number of content switches increases and the time quantum almost equal the time taken to switch the CPU from one process to another. Therefore 50% of time spent in switching of processes.
• Number of context switching

The number of context switches should not be too many to slow down the overall execution of all the processes. Time quantum should be large with respect to the context switch time. This is to ensure that a process keeps CPU for a maximum time as compared to the time spent in the context switching.

robin hood scheduling

Waiting time for P1 = 0 + (6-2) + (10-8) + (13-12) = 7 Millisecond
Waiting time for P2 = 2+ (8-4) + (12-10) = 8 millisecond
Waiting time for P3 = 4millisecond
Therefore average waiting time = (7+8+4)/3 = 6.33 Millisecond

ye calculations mein 0+(6-2)... so on ye kia logics hein?

i have done  robin round but i am facing difficulty about Shortest Remaining Time First arrival time. can anyone tell me about arrival time of Shortest Remaining Time First
. if i will put P1 = 0, P1=1, and P3=2 it will be ok or not ?

ap ne roundrobin main AT kaise lia ha

Three processes P1, P2, P3 reaches at the same time for processing with burst time as given in the following Gantt

this line shows k Arrival time same ha sab ka is this right we can consider T=0 for all

arrival time is not given so arrival time 0 ho ga kia??

i took AT=00 for all

Ayeza plzz give solution
merey se ni ho raha

Dear All,

pehle ye understand krein Round robin huta kia ha n SRTF kia huta ha

SRTF : es men shortest remaining time ko dekhtay huay execustion krein gay jis ka remaining time kam huga ya jo pehle se hee chalty huay process ka time agr kam ha tu usi ko proceed krein gay jabk k

Round Robin: es algo mein hum har time quantum pe cpu processko dein gay hir usko preempt krk next ko dein gay remaining time jab tak huga cpu her time quantum pe har process ko time de ga jis processak time khtam huta gya wo 0 hu jai ga jis a rehta huga wo chalta rahy ga

GG itna to understand ho gya ha

round robin mein har process ko time quantum4 rakh k process krein one by one reading ko table mein fill krein n avg waiting time nikalain then turn around time ka formulaha TA= Busrt time + waiting time

## Latest Activity

28 minutes ago
Soldierr liked Economics's profile
1 hour ago
Maham Raza. liked Maria's profile
1 hour ago
Qasim Ali updated their profile
2 hours ago
Mani Siddiqui BS VIII posted a status
"میرے درد سے کوئی ، کہیں اُداس نہ ہو جائے میں اپنے چہرے پے خوشیاں سجائے پھرتا"
3 hours ago
Maham Raza. liked Maham Raza.'s discussion VIP Kon.......???
3 hours ago
Black updated their profile
3 hours ago
Maham Raza. left a comment for Maria
3 hours ago
Maham Raza. and Maria are now friends
3 hours ago
Maham Raza. posted a discussion

### VIP Kon.......???

3 hours ago
3 hours ago
Mani Siddiqui BS VIII posted a status
"0سنو لوگو ! بڑی محبوب ہیں مجھ کو میری یہ نیم تر آنکھیں مگر اب بیچتا ہوں کہ ! مجھے ایک خواب کا تاوان بھرنا ہے"
3 hours ago

1

2