tddd82 secure mobile systems lecture 6 quality of service
play

TDDD82 Secure Mobile Systems Lecture 6: Quality of Service Mikael - PowerPoint PPT Presentation

TDDD82 Secure Mobile Systems Lecture 6: Quality of Service Mikael Asplund Real-tjme Systems Laboratory Department of Computer and Informatjon Science Linkping University Based on slides by Simin Nadjm-Tehrani Reading Silberschatz et al.


  1. TDDD82 Secure Mobile Systems Lecture 6: Quality of Service Mikael Asplund Real-tjme Systems Laboratory Department of Computer and Informatjon Science Linköping University Based on slides by Simin Nadjm-Tehrani

  2. Reading ● Silberschatz et al. 9th and 10th editions – Chapter 5.1-5.5, 5.8 ● El-Gendy et al. 2003

  3. Overview Resource allocatjon problem: ● Allocate available resources – To some applicatjons/tasks/messages – If there is overload - which ones? ● Load mix and resources can change dynamically

  4. This lecture ● Scheduling on one CPU (short overview) ● From single CPU to networks – Some basic notjons: QoS parameters, requirements/provision ● Quality of service in networked (wired) applicatjons – QoS mechanisms – Intserv, Difgserv

  5. From previous lectures ● Tasks (processes) running on one CPU ● What are the shared resources? – CPU – Memory – I/O channels – ... ● What happens if the set of tasks that are ready to execute grows?

  6. CPU Scheduling

  7. Non-preemptive vs preemptive

  8. Static vs dynamic scheduling • Static (off-line) – complete a priori knowledge of the task set and its constraints is available – hard/safety-critical system • Dynamic (on-line) – partial taskset knowledge, runtime predictions – firm/soft/best-effort systems, hybrid systems

  9. CPU Scheduler

  10. Burstiness

  11. Burst histogram

  12. Which job should run? Burst time Interactive Waited 1 5ms Y 1ms 2 10ms N 20ms 3 2ms N 10ms 4 15ms Y 15ms 5 10ms N 40ms

  13. What is a good scheduler?

  14. Scheduling Criteria ● Throughput – # of processes that complete their execution per time unit ● Energy consumption – Mobile phones, cloud computing, ... ● Turnaround time – amount of time to execute a particular process ● Waiting time – amount of time a process has been waiting in the ready queue ● Response time – amount of time it takes from when a request was submitted until the first response is produced, not including output (for time-sharing environment) ● Deadlines met? – in real-time systems

  15. First-Come, First-Served (FCFS) Scheduling Process Burst Time P 1 24 P 2 3 P 3 3 Suppose that the processes arrive in the order: P 1 , P 2 , P 3 ● The Gantt Chart for the schedule is: ● P 1 P 2 P 3 0 24 27 30

  16. FCFS Performance P 1 P 2 P 3 0 24 27 30 Waiting time P i = start time P i – time of arrival for P i

  17. FCFS Performance P 1 P 2 P 3 0 24 27 30 Waiting time P i = start time P i – time of arrival for P i ● Waiting time for P 1 = 0; P 2 = 24; P 3 = 27 ● Average waiting time: (0 + 24 + 27) / 3 = 17 ● Average turnaround time: (24 + 27 + 30) / 3= 27

  18. FCFS normally used for non-preemptive batch scheduling, e.g. printer queues (i.e., burst time = job size)

  19. Can we do better?

  20. Yes! Suppose that the processes arrive in the order P 2 , P 3 , P 1 ● The Gantt chart for the schedule is: P 2 P 3 P 1 0 3 6 30 ● Waiting time for P 1 = 6 ; P 2 = 0, P 3 = 3 ● Average waiting time: (6 + 0 + 3)/3 = 3 - much better! ● Average turnaround time: (3 + 6 + 30) / 3) = 13

  21. Convoy effect ● Short process behind long process ● Idea: shortest job first?

  22. Shortest-Job-First (SJF) Scheduling ● Associate with each process the length of its next CPU burst. ● Use these lengths to schedule the shortest ready process ● SJF is optimal – gives minimum average waiting time for a given set of processes

  23. Two variants of SJF ● nonpreemptive SJF – once CPU given to the process, it cannot be preempted until it completes its CPU burst ● preemptive SJF – preempt if a new process arrives with CPU burst length less than remaining time of current executing process. – Also known as Shortest-Remaining-Time-First (SRTF)

  24. Example of Non-Preemptive SJF Process Arrival Time Burst Time P 1 0.0 7 P 2 2.0 4 P 3 4.0 1 P 4 5.0 4 ● with non-preemptive SJF: P 1 P 3 P 2 P 4 0 3 7 8 12 16 ● Average waiting time = (0 + 6 + 3 + 7) / 4 = 4 ● Average turnaround time = (7 + 10 + 4 + 11) /4 = 8

  25. Example of Preemptive SJF Process Arrival Time Burst Time P 1 0.0 7 P 2 2.0 4 P 3 4.0 1 P 4 5.0 4 ● with preemptive SJF: P 1 P 2 P 3 P 2 P 4 P 1 11 16 0 2 4 5 7 ● Average waiting time = (9 + 1 + 0 +2) / 4 = 3 ● Average turnaround time = (16 + 5 + 1 + 6) /4 = 7

  26. Predicting Length of Next Burst ● Need to estimate! ● Based on length of previous CPU bursts, using exponential averaging : 1. t n = actual length of n th CPU burst 2. τ n + 1 = predicted value for the next CPU burst 3. α , 0 ≤ α ≤ 1 + 4 . Define: τ n + 1 = α t n + ( 1 − α ) τ n .

  27. +

  28. SJF is a special case of priority scheduling

  29. Priority Scheduling ● A priority value (integer) is associated with each process ● The CPU is allocated to the process with the highest priority (often smallest integer  highest priority) – preemptive – nonpreemptive ● Allows giving high priority to important jobs – What are important jobs?

  30. Challenge for Priority Scheduling ● Problems: – Starvation – low-priority processes may never execute – Long jobs, even if delayed will monopolize the CPU ● Solution: – Aging – as time progresses increase the priority of the process ● How to balance age and priority?

  31. What if we make aging the main scheduling factor?

  32. Round Robin (RR) ● Each process gets a small unit of CPU time: – time quantum , usually 10-100 milliseconds. ● After this time has elapsed, the process is preempted and added to the end of the ready queue.

  33. Round Robin performance ● Assume n processes in the ready queue and time quantum q ● Each process gets 1/ n of the CPU time in chunks of at most q time units at once. ● No process waits more than ( n -1) q time units.

  34. Example: RR with Time Quantum q = 20 Process Burst Time P 1 53 P 2 17 P 3 68 P 4 24 The Gantt chart is: ● P 1 P 2 P 3 P 4 P 1 P 3 P 4 P 1 P 3 P 3 0 20 37 57 77 97 117 121 134 154 162 Typically, higher average turnaround than SJF, but better response ●

  35. Choice of time quantum (q) ● q very large  FCFS ● q very small  many context switches ● q must be large w.r.t. context switch time, otherwise too high overhead

  36. How is turnaround time affected by the choice of time quantum? ● Option A: – Increased Q → increased turnaround time ● Option B: – Increased Q → decreased turnaround time ● Option C: – No general rule

  37. RR: Turnaround Time Varies With Time Quantum

  38. Problems with RR and Priority Schedulers ● Priority based scheduling may cause starvation for some processes. ● Round robin based schedulers are maybe too ”fair”... we sometimes want to prioritize some processes. ● Solution: Soon, first lets talk about QoS in networking

  39. Quality of Service ● Not Best efgort ● Provide guarantee! ● Requires: – Model of source – Model of resource – Model of provider

  40. Recall lecture 5 ● Fault-tolerance requires replicatjon ● Consistent replicatjon requires agreement ● Agreement requires tjmeliness guarantees

  41. QoS Philosophies ● Service difgerentjatjon – When there are overloads some connectjons/packets/applicatjons are preferred to others ● Fairness – All should get something (but how much?) ● Orthogonal: Adaptatjon – Adaptjve ones should adapt to make room for non-adaptjve ones

  42. Networked applicatjons ● Edge nodes – CPU – Power – Memory (bufger space) ● Links – Bandwidth ● Forwarding nodes: bufger space

  43. QoS guarantees ● Need descriptjon of required/provided service – Service commitment: % of dropped packets, average end-to-end delay – Traffjc profjle: defjnitjon of the fmow entjtled to the service, arrival rates, burstjness, packet size,…

  44. Network quality of service (QoS) ● Applicatjon level requirements – Image quality (resolutjon/sharpness), viewing size, voice quality ● Enforcement level indicators – Throughput, delay, jituer, loss ratjo, reliability (lack of erroneous messages and duplicatjons)

  45. Applicatjon types ● Elastjc or inelastjc – Mail or video conference ● Interactjve or non-interactjve – Voice communicatjon or fjle transfer ● Tolerant or non-tolerant – MPEG video-on-demand or automated control ● Adaptjve or non-adaptjve – Audio/video streaming or electronic trading ● Real-tjme or non-real-tjme – IP-telephony or A/V on demand (streaming)

  46. QoS mechanisms: node level ● Admission control – To manage the limited resources in presence of oversubscriptjons – Examples: ● Policing (does the applicatjon ask for the same level of resources that was given as a traffjc profjle?) ● Shaping (infmuencing the fmow of packets fed into the network to adapt to agreed resource picture) ● Scheduling ● Bufger management

  47. Leaky bucket ● Smooth traffjc fmows ● Hard upper limit on rate ● Ineffjcient use of network resources

  48. Token Bucket Token Bucket mechanism, provides a means for limitjng input to ● specifjed Burst Size and Average Rate. Bucket can hold b tokens; ● tokens are generated at a rate of r token/sec ● unless bucket is full of tokens. – Over an interval of length t , the size of all admitued packets is less ● than or equal to ( r t + b) .

Recommend


More recommend