1 / 13

Lab 5 – Fair-Share Scheduler

Lab 5 – Fair-Share Scheduler. Project 5 – FSS. Scheduling is the method by which threads or processes are given access to system resources (e.g. processor time ). Scheduling is usually concerned with load balancing a system effectively to achieve a target quality of service .

milton
Télécharger la présentation

Lab 5 – Fair-Share Scheduler

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lab 5 – Fair-Share Scheduler

  2. Project 5 – FSS Scheduling is the method by which threads or processes are given access to system resources (e.g. processor time). Scheduling is usually concerned with load balancing a system effectively to achieve a target quality of service. Fair-share scheduling (FSS) is a scheduling strategy for computer operating systems in which the CPU usage is equally distributed among system users or groups, as opposed to equal distribution among processes. File Management

  3. Fair Scheduling • Fair-share scheduling is a scheduling strategy for computer operating systems in which the CPU usage is equally distributed among system users or groups, as opposed to equal distribution among processes. • For example, if four users (A,B,C,D) are concurrently executing one process each, the scheduler will logically divide the available CPU cycles such that each user gets 25% of the whole (100% / 4 = 25%). If user B starts a second process, each user will still receive 25% of the total cycles, but each of user B's processes will now use 12.5%. On the other hand, if a new user starts a process on the system, the scheduler will reapportion the available CPU cycles such that each user gets 20% of the whole (100% / 5 = 20%). File Management

  4. Fair Scheduling • Another layer of abstraction allows us to partition users into groups, and apply the fair share algorithm to the groups as well. In this case, the available CPU cycles are divided first among the groups, then among the users within the groups, and then among the processes for that user. • For example, if there are three groups (1,2,3) containing three, two, and four users respectively, the available CPU cycles will be distributed as follows: • 100% / 3 groups = 33.3% per group • Group 1: (33.3% / 3 users) = 11.1% per user • Group 2: (33.3% / 2 users) = 16.7% per user • Group 3: (33.3% / 4 users) = 8.3% per user File Management

  5. Demo CS345 W2014 New Task[0] myShell 0>>p5 Starting Project 5 Group[0] = 17 Group[1] = 18 Group[2] = 10 Group[3] = 1 Group[4] = 20 Create parent1 with 17 children New Task[1] parent1 New Task[2] child_1a New Task[3] child_1b New Task[4] child_1c … Create parent2 with 18 children New Task[19] parent2 New Task[20] child_2a … Create parent3 with 10 children New Task[38] parent3 New Task[39] child_3a … Create parent4 with 1 child New Task[49] parent4 New Task[50] child_4a Create parent5 with 20 children New Task[51] parent5 New Task[52] child_5a … New Task[72] Group Report 2707>> Groups: 45171 (25%) 47329 (26%) 27236 (15%) 4939 (2%) 51618 (29%) Groups: 61254 (25%) 64657 (26%) 37433 (15%) 6806 (2%) 71463 (29%) Groups: 61272 (25%) 64676 (26%) 37444 (15%) 6808 (2%) 71484 (29%) Groups: 59022 (25%) 62301 (26%) 36069 (15%) 6558 (2%) 68859 (29%) Groups: 59418 (25%) 62719 (26%) 36311 (15%) 6602 (2%) 69321 (29%) Groups: 59562 (25%) 62871 (26%) 36399 (15%) 6618 (2%) 69489 (29%) … Parent #1 Child #1a File Management

  6. Project 5 – FSS #define NUM_PARENTS 5 #define NUM_REPORT_SECONDS 5 long intgroup_count[NUM_PARENTS]; // parent counters int num_siblings[NUM_PARENTS]; // #in each group int P5_project5(int argc, char* argv[]) { childALive= createSemaphore("childALive", BINARY, 0); parentDead= createSemaphore("parentDead", BINARY, 0); do NUM_PARENTS times num_siblings[i] = (rand() % 25) + 1; group_count[i] = 0; // zero group counter createTask(name, parentTask, MED_PRIORITY, 3, argv); SEM_WAIT(parentDead); // wait for parent to die // create reporting task createTask("Group Report", groupReportTask, MED_PRIORITY, 2, groupReportArgv); } // end P5_project5 File Management

  7. Project 5 – FSS // ************************************************************* // group parent - create children // argv[0] = group base name // argv[1] = parent # // argv[2] = # of children // int parentTask(int argc, char* argv[]) // group 1 { do num_childrentimes createTask(name, childTask, MED_PRIORITY, 3, argv); SEM_WAIT(childALive); // wait for live child // parent goes zombie! SEM_SIGNAL(parentDead); // allow another parent while (1) { ++group_count[parent - 1]; SWAP; } return 0; } // end parentTask File Management

  8. Project 5 – FSS // ************************************************************* // child task // argv[0] = group base name // argv[1] = parent # // argv[2] = # of siblings // int childTask(int argc, char* argv[]) // child Task { SEM_SIGNAL(childALive); // child is alive!! // count # of times scheduled while (1) { ++group_count[parent-1]++; SWAP; } return 0; } // end childTask File Management

  9. Project 5 – FSS // ************************************************************* // Group Report task // int groupReportTask(int argc, char* argv[]) { int count = NUM_REPORT_SECONDS; while (1) { // update every second while (count-- > 0) SEM_WAIT(tics1sec); sum = 0; for (i = 0; i < NUM_PARENTS; ++i) sum += group_count[i]; printf("Groups:"); do NUM_PARENTS times printf(group_count[i], (group_count[i] * 100) / sum); group_count[i] = 0; count = NUM_REPORT_SECONDS; } return 0; } // end groupReportTask File Management

  10. Project 5 Grading Criteria • There are 20 points possible for Project 6. 2 pts- The P5 command dynamically switches between schedulers. 4 pts- Only tasks in the Ready Queue with a non-zero time are scheduled. 6 pts- When all tasks in the Ready Queue have a zero time, then new task times are calculated in a "fair" way. 2 pts- Group counts are approximately the same. 2 pts- Tasks are grouped according to their parent task. 2 pts- Parents share in clock time with their children. 2 pts- Fractional clocks are given to the parent. • In addition to the possible 20 points, the following bonus/penalties apply: +2 pts- Early pass-off (at least one day before due date.) +2 pts- Your fair scheduler works with dead ancestors. -2 pts- penalty for each school day late.. File Management

  11. Mutual Exclusion

  12. Suggested Project Progression 1. Read and comprehend the MS-DOS FAT File System help document as well as Stallings, Chapter 12. 2. Comprehend these lab specs. Discuss questions with classmates, the TA’s and/or the professor. Make sure you understand what the requirements are! 3. File Management

  13. Child #1a CS345 W2014 New Task[0] myShell 0>>p5 Starting Project 5 Group[0] = 17 Group[1] = 18 Group[2] = 10 Group[3] = 1 Group[4] = 20 Create parent1 with 17 children New Task[1] parent1 New Task[2] child_1a New Task[3] child_1b New Task[4] child_1c New Task[5] child_1d New Task[6] child_1e New Task[7] child_1f New Task[8] child_1g New Task[9] child_1h New Task[10] child_1i New Task[11] child_1j New Task[12] child_1k New Task[13] child_1l New Task[14] child_1m New Task[15] child_1n New Task[16] child_1o New Task[17] child_1p New Task[18] child_1q Create parent2 with 18 children New Task[19] parent2 New Task[20] child_2a New Task[21] child_2b New Task[22] child_2c New Task[23] child_2d New Task[24] child_2e New Task[25] child_2f New Task[26] child_2g New Task[27] child_2h New Task[28] child_2i New Task[29] child_2j New Task[30] child_2k New Task[31] child_2l New Task[32] child_2m New Task[33] child_2n New Task[34] child_2o New Task[35] child_2p New Task[36] child_2q New Task[37] child_2r Create parent3 with 10 children New Task[38] parent3 New Task[39] child_3a New Task[40] child_3b New Task[41] child_3c New Task[42] child_3d New Task[43] child_3e New Task[44] child_3f New Task[45] child_3g New Task[46] child_3h New Task[47] child_3i New Task[48] child_3j Create parent4 with 1 child New Task[49] parent4 New Task[50] child_4a Create parent5 with 20 children New Task[51] parent5 New Task[52] child_5a New Task[53] child_5b New Task[54] child_5c New Task[55] child_5d New Task[56] child_5e New Task[57] child_5f New Task[58] child_5g New Task[59] child_5h New Task[60] child_5i New Task[61] child_5j New Task[62] child_5k New Task[63] child_5l New Task[64] child_5m New Task[65] child_5n New Task[66] child_5o New Task[67] child_5p New Task[68] child_5q New Task[69] child_5r New Task[70] child_5s New Task[71] child_5t New Task[72] Group Report 2707>> Groups: 45171 (25%) 47329 (26%) 27236 (15%) 4939 (2%) 51618 (29%) Groups: 61254 (25%) 64657 (26%) 37433 (15%) 6806 (2%) 71463 (29%) Groups: 61272 (25%) 64676 (26%) 37444 (15%) 6808 (2%) 71484 (29%) Groups: 59022 (25%) 62301 (26%) 36069 (15%) 6558 (2%) 68859 (29%) Groups: 59418 (25%) 62719 (26%) 36311 (15%) 6602 (2%) 69321 (29%) Groups: 59562 (25%) 62871 (26%) 36399 (15%) 6618 (2%) 69489 (29%) Parent #1 File Management

More Related