Review Device Drivers Device Driver Device specific code in the kernel that interacts directly with the device hardware CS162 Operating Systems and Systems Programming Lecture 18 Supports a standard internal interface Same kernel I O system can interact easily with different device drivers Special device specific configuration supported with the ioctl system call Device Drivers typically divided into two pieces File Systems Naming and Directories Top half accessed in call path from system calls implements a set of standard cross device calls like open close read write ioctl strategy This is the kernel s interface to the device driver Top half will start I O to device may put thread to sleep until finished November 3rd 2008 Prof John Kubiatowicz http inst eecs berkeley edu cs162 Bottom half run as interrupt routine Gets input or transfers next block of output May wake sleeping threads if I O now complete 11 03 08 Review Magnetic Disk Characteristic Cylinder all the tracks under the head at a given point on all surface Head Read write data is a three stage process Kubiatowicz CS162 UCB Fall 2008 Track Sector Cylinder Lec 18 2 Goals for Today Queuing Theory File Systems Structure Naming Directories Platter Seek time position the head arm over the proper track into proper cylinder Rotational latency wait for the desired sector to rotate under the read write head Transfer time transfer a block of bits sector under the read write head Disk Latency Queueing Time Controller time Seek Time Rotation Time Xfer Time Media Time Seek Rot Xfer Result Hardware Controller Request Software Queue Device Driver Highest Bandwidth transfer large group of blocks sequentially from one track 11 03 08 Kubiatowicz CS162 UCB Fall 2008 Lec 18 3 Note Some slides and or pictures in the following are adapted from slides 2005 Silberschatz Galvin and Gagne Gagne Many slides generated from my lecture notes by Kubiatowicz 11 03 08 Kubiatowicz CS162 UCB Fall 2008 Lec 18 4 Introduction to Queuing Theory Controller Arrivals Queue Disk Background Use of random distributions Departures Queuing System What about queuing time Let s apply some queuing theory Queuing Theory applies to long term steady state behavior Arrival rate Departure rate Little s Law Mean tasks in system arrival rate x mean response time Observed by many Little was first to prove Simple interpretation you should see the same number of tasks in queue when entering as when leaving Applies to any system in equilibrium as long as nothing in black box is creating or destroying tasks Typical queuing theory doesn t deal with transient behavior only steady state behavior 11 03 08 Kubiatowicz CS162 UCB Fall 2008 Lec 18 5 A Little Queuing Theory Some Results Assumptions System in equilibrium No limit to the queue Time between successive arrivals is random and memoryless Arrival Rate Queue Service Rate 1 Tser Important values of C No variance or deterministic C 0 memoryless or exponential C 1 Past tells nothing about future Many complex systems or aggregates well described as memoryless mean Memoryless Disk response times C 1 5 wider variance long tail 11 03 08 Kubiatowicz CS162 UCB Fall 2008 Lec 18 6 A Little Queuing Theory An Example Example Usage Statistics User requests 10 x 8KB disk I Os per second Requests service exponentially distributed C 1 0 Avg service 20 ms From controller seek rot trans Ans server utilization u Tser What is the average time spent in the queue Ans Tq What is the number of requests in the queue Ans Lq Tq Little s law What is the avg response time for disk request Ans Tsys Tq Tser Called M M 1 queue Tq Tser x u 1 u Kubiatowicz CS162 UCB Fall 2008 Distribution of service times How utilized is the disk General service distribution no restrictions 1 server Called M G 1 queue Tq Tser x 1 C x u 1 u Squared coefficient of variance C 2 m12 Aggregate description of the distribution Mean m1 Questions Server Parameters that describe our system mean number of arriving customers second mean time to service a customer m1 Tser C squared coefficient of variance 2 m12 service rate 1 Tser u server utilization 0 u 1 u Tser Parameters we wish to compute Time spent in queue T q Length of queue Tq by Little s law Lq Results Memoryless service distribution C 1 11 03 08 Server spends variable time with customers Mean Average m1 p T T 2 2 2 2 Variance p T T m1 p T T m1 Lec 18 7 Computation avg arriving customers s 10 s Tser avg time to service customer 20 ms 0 02s u server utilization x Tser 10 s x 02s 0 2 Tq avg time customer in queue Tser x u 1 u 20 x 0 2 1 0 2 20 x 0 25 5 ms 0 005s Lq avg length of queue x Tq 10 s x 005s 0 05 Tsys avg time customer in system Tq Tser 25 ms 11 03 08 Kubiatowicz CS162 UCB Fall 2008 Lec 18 8 Queuing Theory Resources Administrivia Handouts page contains Queueing Theory Resources Scanned pages from Patterson and Hennesey book that gives further discussion and simple proof for general eq A complete website full of resources Midterms with queueing theory questions Midterm IIs from previous years that I ve taught Assume that Queueing theory is fair game for Midterm II or for the final 11 03 08 Kubiatowicz CS162 UCB Fall 2008 11 03 08 Lec 18 9 Disk Scheduling Disk can do only one request at a time What order do you choose to do queued requests FIFO Order 2 3 2 1 3 10 7 2 5 2 2 2 User Requests Head SSTF Shortest seek time first Pick the request that s closest on the disk Although called SSTF today must include rotational delay in calculation since rotation can be as long as seek Con SSTF good at reducing seeks but may lead to starvation 3 2 1 Disk Head Fair among requesters but order of arrival may be to random spots on the disk Very long seeks Course Feedback Tomorrow and Wednesday in Section Make sure to go to section Group Evaluations not Optional You will get a zero for project if you don t fill them out We use these for grading No normal office hours on Wednesday I will be gone for most of Wed Thu Will pop back for class on Wednesday Regrade requests for Midterm I must be in by next week Some discussion about the grading of Project I We are considering giving a few points back Always talk to your TA not the reader Feel free to ask questions in lectures and sections Visit my office hours except for this week M W 2 30 3 30 Or feel free to send email for a meeting 4 SCAN Implements an Elevator Algorithm take the closest request in the direction of travel No starvation but retains flavor of SSTF 11 03 08 Kubiatowicz CS162 UCB Fall
View Full Document
Unlocking...