Download presentation
Presentation is loading. Please wait.
1
1 Pertemuan 8 Penjadwalan (lanjutan) Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5
2
2 Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : mendemonstrasikan penjadwalan proses pada sistem interactive, real-time, dan thread (C3)
3
3 Outline Materi Interactive Scheduling: –Round Robin Scheduling –Penjadwalan dengan prioritas –Multiple Queues –Shortest process next –Guaranteed Scheduling –Lottery Scheduling –Fair-share Scheduling Penjadwalan pada sistem Real-time Policy versus Mechanism Penjadwalan Thread
4
4 Scheduling in Interactive Systems (1) Round Robin Scheduling –list of runnable processes –list of runnable processes after B uses up its quantum Each process is assigned a time interval, called quantum Process switch or context switch times to do switching
5
5 Scheduling in Interactive Systems (2) Priority scheduling Each process is assigned a priority, and the runnable process with the highest priority is allowed to run The scheduler may decrease the priority of currently running process Priority scheduling is used among classes and round-robin scheduling within each class
6
6 Scheduling in Interactive Systems (3) Multiple Queues Priority class of queuing processes Quantum given: 1, 2, 4, 8, 16 … Why? To reduce swapping i.e.long CPU-bound process eventually get large quantum short, interactive process get small quantum Example: Process with quantum 100 Quantum given: 1, 2, 4, 8, 16, 32, 64 (used 37) only 7 swap
7
7 Scheduling in Interactive Systems (4) Shortest process next Need to estimate the time of the next processes i.e. aT 0 + (1 a)T 1 where T 0 is the estimated time of the first command T 1 is that of the next command … With a = ½, add the new value to the current estimate and divide the sum by 2 Estimates: T 0, T 0 /2+ T 1 /2, T 0 /4+ T 1 /4+ T 2 /2, T 0 /8+ T 1 /8+ T 2 /4+ T 3 /2
8
8 Scheduling in Interactive Systems (5) Guaranteed Scheduling On a single user system with n processes running, each one should get 1/n of the CPU cycles Ratio of 0.5 means that process only had half of what it should have had Ratio of 2.0 means that process has had twice as much as it was entitled to
9
9 Scheduling in Interactive Systems (6) Lottery Scheduling Simpler implementation Give process lottery tickets for various system resources, such as CPU time A lottery ticket is chosen at random, but the process holding more tickets gets better chance to be chosen Can be used to solve problems that are difficult to handle with other methods Eg. Video server with several process at different frame rates
10
10 Scheduling in Interactive Systems (7) Fair Share Scheduling Take into account who owns a process Each user is allocated some fraction of the CPU Thus, if 2 users have been promised 50% of the CPU, they will each get that, no matter how many processes they have Example: User 1 has 4 processes: A, B, C, D User 2 has 1 process: E If both users are promised 50% of CPU time, the possible scheduling sequence would be A E B E C E D E A E … if user 1 entitled twice as much CPU time as user 2, we might get: A B E C D E A B E C D E …
11
11 Scheduling in Real-Time Systems Schedulable real-time system Given –m periodic events –event i occurs within period P i and requires C i seconds Then the load can only be handled if Example: –A soft real time system with three periodic event, with periods of 100, 200, and 500 ms. If these events require 50, 30, and 100 ms of CPU time per event the system is schedulable because 0.5 + 0.15 + 0.2 < 1
12
12 Policy versus Mechanism Separate what is allowed to be done with how it is done –a process knows which of its children threads are important and need priority Scheduling algorithm parameterized –mechanism in the kernel Parameters filled in by user processes –policy set by user process
13
13 Thread Scheduling (1) Possible scheduling of user-level threads 50-msec process quantum threads run 5 msec/CPU burst
14
14 Thread Scheduling (2) Possible scheduling of kernel-level threads 50-msec process quantum threads run 5 msec/CPU burst
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.