Käyttöjärjestelmät, Luent 11 WEEK cheduling tallings, Chapter 9 1 When? Lng-term Accept new prcess? Enugh memry? swap? Medium-term Bring a suspended prcess back, when? Enugh free memry? MPL, multiprcessing level? hrt-term Which prcess is switched t prcessr? I/O ervice rder f I/O requests (f prcesses)? Tbl 9 (alasa) Pririties eal time prcesses O kernel high pri 0 1 1 18 19 10 11 19 lw pri missile avidance prcess flight surface cntrl fixed navigatin pri lad cntrl swapper cleaner Waiting fr a lng duratin calculatr (18-10) Used a lt f CPU (fex full time slice) fixed pri variable pri CPU cheduling: Algrithms examples First-Cme-First-erved und bin Virtual und bin hrtest Prcess Next hrtest emaining Time Highest espnse ati Next Multilevel Feedback Fair hare cheduling FCF V PN T HN feedback F yksy 00, Tiina Niklander 11-1
Käyttöjärjestelmät, Luent 11 Esimerkkiprsessit (Tbl 9 [tal0]) FCF First Cme First erved (keskim) cpu time fr B (Fig 9 [tal0]) arrival time fr B 9 1 1 keskim 8 cmpletin time fr B ervice Time = CPU:ssa kulutettu aika Esimerkeissä ei mietitä I/O:n vaikutusta 8 und bin effect f the time slice (keskim) (Fig 9 [tal0]) 1 1 1 keskim 108 (keskim) (Fig 9 [tal0]) 1 1 11 keskim 100 9 10 PN hrtest Prcess Next Virtual :n jnmalli (keskim) (Fig 9 [tal0]) 11 1 keskim 11 1 yksy 00, Tiina Niklander 11 -
Käyttöjärjestelmät, Luent 11 T hrtest emaining Time (keskim) (Fig 9 [tal0]) 1 1 keskim HN Highest espnse ati Next (keskim) (Fig 9 [tal0]) time spent waiting CPU + expected service time respnse rati = ------------------------------------------------------------- expected service time 9 1 keskim 80 (+)/ > (+)/ 1 1 Multilevel Feedback (Fig 910 [tal0]) Feedback q=1 1 1 1 1 1 (keskim) Virhe? (Fig 9 [tal0]) 18 1 1 keskim 100 1 1 Feedback q= i Virhe? 1 1 1 1 1 1 1 1 (Fig 9 [tal0]) (keskim) keskim 10 Yhteenvet Tbl 9 [tal0] Fig 9 [tal0] 1 yksy 00, Tiina Niklander 11 -
Käyttöjärjestelmät, Luent 11 Queuing systems Fig 9 [tal0] ee: http://williamtallingscm/tudentupprthtml Jnmallin merkinnät 19 0 Käyttöasteen vaikutus 8 = / (1-U) 0 0 0 10 U 0 * 0 * 08 8* Validiteettialue: λ < µ U HUOM: Eri kaavat estävälle ja keskeyttävälle (n pririty) (pririty with preemptin) 1 (pririty) yksy 00, Tiina Niklander 11 -
Käyttöjärjestelmät, Luent 11 imulintiesimerkki Tulksia HUOM: imulinnin tulkset pätevät vain kkeillulle kurmalle Tässä esimerkissä: aapumistiheys ja Palveluaika Ts satunnaistettuja: Arvtaan kullekin prsessille erikseen! 0000 prsessia λ = 08 T = 1 s ρ = λt Odtusarvja! s = 08 Y-akseli n nrmalisitu: Kknaisaika n jaettu suritusajalla : pitkillä töillä vakillinen käyttäytyminen (nin kertaa suritusaika) FCF: nin 1/ töistä (Lyhyimmät) yli 10-kertainen läpimen suritusaikaan nähden Kertaus 8 Imprtant themes 1/ tructure f O Prcess and thread PCB, TCB, executin, mde and cntext switch Memry management MMU s structure Different methds Memry allcatin, address translatin Virtual memry Paging, address translatin Page table, page fault, PT, TLB Plicies, methds and algrithms Imprtant themes / Lcality Interrupts and interrupt handling, executin cycle Multiprgramming User mde, kernel mde 9 0 yksy 00, Tiina Niklander 11 -
Käyttöjärjestelmät, Luent 11 Other themes UNIX, Linux, Windws Histry and evlutin f O ynkrnizatin and mutual exclusin cache Kertausta Osa: (vanhja kalvja) Use eview Questins prvided in the bk! If yu can withut extra reading give a precise answer, then yu shuld d well in the exam Check that yu can slve the weekly exercises, even if the numbers vary 1 Layer mdel ystem calls Interrupts O structure applicatins user shell ystem call Varushjelmat Palvelupyynnöt Keskeytykset POCE MANAGEMENT EOUCE MANAGEMENT prtectin FILE YTEM MEMOY MANAGEMENT blcks I/O MANAGEMENT Laiteajurit Keskeytyskäsittely Laitehjaimet ja laitteet Executin cycle Kuva 1 Interrupt handling (kuva 110) Bk pages 1- tart Interrupt Handler * Kernel mde vs user mde * Disabling and enabling interrupts tart Interrupt Handler * * yksy 00, Tiina Niklander 11 -
Käyttöjärjestelmät, Luent 11 ystem call: read(fd, buffer, nbytes) Tan01 1-1 Kernel (Fig 10 [tal 0]) 8 Prcess states O data structures Kuva 10 Kuva 8 9 0 Threads laris TCB 1 yksy 00, Tiina Niklander 11 -
Käyttöjärjestelmät, Luent 11 (imple) memry management Technique Fixed partitining Dynamic partitining Buddy ystem imple segmentatin imple paging Descriptin Memry divided t static partitins at system generatin time Allcated when needed and nly the amunt requested Dynamic allcatin using fixed sizes Prcess in ne allcated area Prcess divided t segments Each segment allcated dynamically Memry divided t frames, prcess t pages trengths imple t implement, little verhead N internal fragmentatin Practically n external fragmentatin N internal fragmentatin N external fragmentatin Weaknesses Internal fragmentatin External fragmentatin and need fr cmpactin mall amunt f internal fragmentatin External fragmentatin Internl fragmentatin nly n the last page Puu Buddy ystem Kuva Tw-level hierarchical page table Tp mst level in ne page and always in the memry Inverted page table v 1 K entries (= 10 = 10 ) 1K * 1K = 1M entries Frame number Index f the table Nt stred in the entry j TLB and cache Kuva 810 Kuva 88 8 yksy 00, Tiina Niklander 11-8
Käyttöjärjestelmät, Luent 11 Cmbined segmentatin and paging Kuva 81 Krvausplitiikka 9 0 Clck page replacement Wrking set Fig 819 [tal0] Fig 81 [tal0] 1 perid tarts n Mnday 910 Our sessins cntinue n Thursday 111 yksy 00, Tiina Niklander 11-9