Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 09-30-2004, 01:52 PM   #1 (permalink)
Free Mars!
 
feelgood's Avatar
 
Location: I dunno, there's white people around me saying "eh" all the time
Operating System Scheduling

Hey Guys,

I'm working on figuring out process waiting time for 4 different operating system scheduling time.

The 4 different types are First Come, First Served, Shortest Job First, Non-preemptive and Round Robin.

I have 5 different Process

P1 takes 10 brust and are priority 3
P2 takes 1 burst and are priority 1
P3 takes 2 burst and are priority 3
P4 takes 1 burst and are priority 4
P5 takes 5 burst and are priority 2

FCFS
----------10-11--13-14-----19

Average wait time = (10+11+13+14)/5 = 9.6 millisecond

SJF
-1-2--4-----9----------19

Average wait time = (1+2+4+9)/5 = 3.2 millisecond

Nonpreemptive
-1-----6--8----------18-19

Average wait time = (1+6+8+18)/5 = 6.8 millisecond

RoundRobin Quantum = 1
-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19

I believe I've got the first 3 right. But Round Robin is somewhat more difficult to understand. I understand that each process are allocated to 1 time quantum of CPU. But what I can't understand is how to calculate the average waiting time. It's not the same as calculating the average wait time as the other 3 since once process #2 and 4 are completed, they're not part of the average waiting time formula anymore.
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war
feelgood is offline  
Old 09-30-2004, 02:38 PM   #2 (permalink)
Crazy
 
Assuming each process starts at the exact same time then your average waiting time is going to be

(0+1+2+3+4)/5 or 2
process 1 starts immedatily wait time is 0
process 2 starts at quantum 1, wait time is 1
process 3 starts at quantum 2, wait time is 2.
.
.
.
etc


I think that's how it worked anyway.. Been a while since I took that class.
NeoSparky is offline  
Old 10-11-2004, 08:07 PM   #3 (permalink)
Junkie
 
the average wait time will be the sum of each processes time on the ready queue divided by the total number of processes.

That is the process has information it wants to process but is waiting for another process on the run queue.

So if you have 5 processes that want to run then every time quantum you will gain 4 quantoms of wait time (then in the end divide by the number of processes).
Rekna is offline  
Old 10-12-2004, 02:39 PM   #4 (permalink)
Upright
 
Fascinating.. I just took an Operating Systems midterm today with that EXACT same problem on. Same burst times for each process and everything. Where did you get this problem from??

As for your question, I think that you need do this:
Everytime a process is not running, it is waiting. So you need to calculate the wait time for each process individually. It'll look something like this

Code:
00-01-02-03-04-05-06-07-08-09-10-11-12-13-14-15-16-17-18
P1-P2-P3-P4-P5-P1-P3-P5-P1-P5-P1-P5-P1-P5-P1-P1-P1-P1-P1
So for each process you need to add all the slices where its not running, this will be the total wait time for each process. For the end slices, where only P1 is running, it will not be waiting. Then sum each process' wait time and divide by 5.
schnable is offline  
Old 10-12-2004, 07:13 PM   #5 (permalink)
Junkie
 
It's probably from the book "Operating System Concepts" by silberschatz galvin and gagne. This book seems to be used universally in all OS classes.
Rekna is offline  
Old 10-12-2004, 07:32 PM   #6 (permalink)
Upright
 
Quote:
Originally Posted by Rekna
It's probably from the book "Operating System Concepts" by silberschatz galvin and gagne. This book seems to be used universally in all OS classes.
Now that you mention it, that IS the book we're using. I guess I'm just surprised my prof used a textbook problem on the midterm without modifying it at all.
schnable is offline  
 

Tags
operating, scheduling, system


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 07:54 AM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360