200 likes | 356 Views
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D. Operating Systems {week 06}. Systems and models. A system is a part of the real world that we wish to analyze Made up of autonomous entities interacting with one another
E N D
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D. Operating Systems{week 06}
Systems and models • A system is a part of the real worldthat we wish to analyze • Made up of autonomous entitiesinteracting with one another • A model is an abstractrepresentation of a system • We use models in analysis and design • Only relevant properties are included
Using models for analysis (i) • Simulate a system’s behavior using a model • Models have tunable input parameters • Observe the simulation; analyze output • Predict behavior of the real systemby analyzing behavior of the model • Behavior of the model depends ontime, input parameters, and eventsgenerated within the environment
Using models for analysis (ii) • We can model numerous systems usingthe following components: • User: a single user of the system • Service: a node providing a service • Queue: an array of users waiting for service
Modeling uncertainty • Mathematical models can be categorized as: • Deterministic: • Behavior is predictable with 100% certainty • Stochastic: • Behavior is uncertain, based on random events
Stochastic models • A stochastic model is one thatincorporates uncertainty intoits behavior • One or more attributes change their values according to a probability distribution
Probability distributions (i) • A probability distribution specifies the probability of each value of somerandom variable • Uniform distribution: • All values areequally probable
Probability distributions (ii) • A probability distribution specifies the probability of each value of somerandom variable • Normal distribution: • Values are moreprobable at ornear the mean • This will forma bell curve
Probability distributions (iii) • A probability distribution specifies the probability of each valueof some random variable • Exponential distribution: • Values are times betweenevents in a Poisson processin which events occur bothcontinuously and independently,but at a constant average rate
Analyzing operating systems (i) • To study the performance of an operating system, we can: • Take measurements onthe real system • e.g. Unix time command • Run a simulation model • Apply an analytical model • e.g. Queuing theory, exponential distributions, etc.
Analyzing operating systems (ii) • External performance goals: • Minimize user response time • Maximize throughput • Number of jobs completed per unit time • Minimize turnaround time • Average time to complete jobs • Maximize fairness • Maximize degree of multiprogramming • Number of processes supported without degradation
Analyzing operating systems (iii) • Internal performance goals: • Maximize CPU utilization • Maximize disk utilization • Minimize disk access time • Enforce priorities • Minimize overhead • e.g. time for scheduling algorithm, context switching • Avoid starvation of long-running jobs • Enforce real-time deadlines (sometimes)
Analyzing operating systems (iv) • Some key performance measures: • Average number of jobs in the system • Average number of jobs waiting in a queue • Average time a job spends in the system • Average time a job spends in the queues • CPU utilization • Total number of jobs serviced (i.e. throughput)
P3 P1 P2 P3 P1 P3 P1 0 2 4 6 8 10 12 13 Round-Robin (RR) • RR is a preemptive algorithmthat gives all ready processesa fair time slice of CPU time • Using a time slice of 2 ms.... time
Priority Scheduling (i) • Associate a priority number with each process • The dispatcher selects the processwith the highest priority • For multiple ready processeswith identical priority values,use FCFS (or ...) • Key problem is starvation • Overcome starvation by aging, increasingthe priority of a process as it ages
process Priority Scheduling (ii) • Is priority scheduling preemptiveor non-preemptive? • Non-preemptive priority scheduling places higher-priority processes at the head of the queue • Preemptive priority scheduling requires a running process to be interrupted and preempted upon the arrival of a higher-priority process (use this one for Project #1)
Multiclass systems • Operating systems that support priority schemes are often called multiclass systems use a separate schedulingalgorithm for each queue
Multilevel Queue (MQ) • Assign processes to multiple queues,each with its own scheduling algorithm
Multilevel Feedback Queue (MFQ) • Dynamically assign processes to multiple queues based on actual CPU burst times • i.e. feedback quantum is synonymouswith time slice
Practice! • Apply the FCFS, SJF, RR, and Preemptive Priority scheduling algorithms to this table: • For RR, use a time slice of 10 ms • Calculate the wait and turnaround times ofeach process, as well as overall averages lower number indicates a higher priority recalculate using context switch time tcs = 20 μs