curl https://www.labs.cs.uregina.ca/330/Threads/Lab5.zip -O -s unzip Lab5.zip
(Please do this lab on os1 or os2)
This week, we will modify a "findMin" function written in C to a thread function. As a thread function, you will give it a portion of the array to work with, depending on the size of the array and the number of threads. Some of the code is provided for you already in main.c. You will notice that certain things are missing.
~/Lab6b$ ./demo How many threads? 10 How big is the array (100 elements or more)?135 475 459 103 45 98 184 28 175 82 356 282 376 430 357 208 387 37 49 99 361 61 40 105 21 233 121 5 328 270 389 369 96 347 323 492 296 7 372 323 88 227 104 463 8 312 22 394 201 70 492 61 482 384 166 354 116 286 359 443 407 247 164 3 445 486 494 92 344 365 414 284 443 17 98 450 181 120 343 381 41 187 441 23 70 458 376 37 244 86 332 2 332 347 4 128 184 350 220 28 66 485 311 9 2 260 458 34 379 153 414 272 339 206 294 260 164 21 148 259 107 331 260 290 177 116 418 361 317 489 240 382 473 402 390 326 Start:0, End:13 Start:13, End:26 Start:26, End:39 Start:39, End:52 Start:65, End:78 Start:78, End:91 Start:52, End:65 Start:104, End:117 Start:91, End:104 Start:117, End:135 min value in array is: 2 ~/Lab6b$ ./demo How many threads? 5 How big is the array (100 elements or more)?100 373 97 392 20 227 216 94 235 375 375 310 407 169 441 366 221 317 319 62 491 120 444 411 406 257 227 50 167 354 232 176 226 328 67 97 54 282 191 141 8 417 450 266 86 391 132 158 59 302 219 401 422 14 311 179 122 37 228 288 243 311 463 468 138 381 65 44 14 255 184 373 23 133 139 108 375 270 117 285 71 187 185 344 200 348 374 321 236 453 460 478 263 422 298 253 154 362 296 167 468 Start:0, End:20 Start:60, End:80 Start:20, End:40 Start:40, End:60 Start:80, End:100 min value in array is: 8
Submit 3 files to URCourses: