Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Operating Systems Lecture 21: Clocks, Power Management, Disk Management, Study notes of Operating Systems

A lecture note from a computer science course on operating systems. The lecture covers various topics related to input/output management, including clocks, power management, disk management, and file systems. The hardware and software aspects of clocks, the use of timers for individual processes, and the organization and behavior of magnetic disks. It also touches upon disk scheduling algorithms and the history of disk-related concerns.

Typology: Study notes

Pre 2010

Uploaded on 03/16/2009

koofers-user-bv1
koofers-user-bv1 🇺🇸

10 documents

1 / 6

Toggle sidebar

Related documents


Partial preview of the text

Download Operating Systems Lecture 21: Clocks, Power Management, Disk Management and more Study notes Operating Systems in PDF only on Docsity! 1 Input/Output – IV Indranil Gupta Lecture 21 Oct 14, 2005 CS423UG Operating Systems CS 423UG - Operating Systems, Indranil Gupta 2 Content  Clocks  Power Management  Disk Management CS 423UG - Operating Systems, Indranil Gupta 3 Clock Hardware  Older/simpler clocks  tied to the 110 or 220 volt power line and cause interrupt on every voltage cycle at 50-60 Hz.  Current clocks consist of three components:  a crystal oscillator  a counter  a holding register  Feature:  The quartz crystal generates a periodic signal of very high accuracy (several GHz). This signal is fed into the counter which counts down to zero. When the counter is zero, it causes a CPU interrupt. The holding register is used to load the counter. CS 423UG - Operating Systems, Indranil Gupta 4 Other Functions  Preventing processes from running too long  Whenever a process is started, the scheduler initializes a counter to the value of that process' quantum in clock ticks. As the clock ticks, the counter is decremented, and when counter is zero, the clock driver calls the scheduler to set up another process  CPU accounting  The system should start a second timer (different from the main timer). Whenever a process starts, the second timer starts counting. When a process stops, the timer can be read out to tell how long the process has run. When a process is interrupted, the timer value should be stored (where?) and when the process restarts, the timer value should be restored.  Simpler way to do CPU accounting  Currently running process keeps a field in the PCB. At every clock tick, this field in the current process is incremented, i.e., every clock tick is ``charged'' to the process running at the time  Disadvantages: other IO interrupts could skew this accounting CS 423UG - Operating Systems, Indranil Gupta 5 Timer for Individual Process  Providing timers (alarm) to requests from processes in order to give a warning after a certain time interval  Process makes an alarm() system call specifying a time after which it should be sent a signal SIGALRM. When signal is received, the corresponding SIGALRM handler function specified by that process is run by the system  If the clock driver had enough clocks, it could set a separate clock for each request. This is of course not the case.  Simulate virtual clocks with a single physical clock.  Maintain (a) table in which the signal time for all pending times is kept, and (b) a variable giving the time of the next one. When clock is updated, the driver checks for the closest signal to occur. When that has been signaled, the table is searched for the next one to occur. CS 423UG - Operating Systems, Indranil Gupta 6 Watchdog Timer and Profiling  A timer is set, and when the timer goes off, instead of system executing a signal (as is the case for user signals), instead, the clock driver calls a procedure supplied by the caller  Use it for profiling  Build histogram of the program counter and see where it is spending its time.  Accounting  Debugging 2 CS 423UG - Operating Systems, Indranil Gupta 7 Soft Timers  Software-based timer, called soft timer, is a timer which  can be set to the requested frequency as needed  is checked by the kernel when entries are made for other reasons such as system calls, TLB misses, page faults, I/O interrupts, CPU going idle  if the soft timer has expired (find by polling the clock), the scheduled event is performed (e.g., packet transmission) with no need to switch to kernel mode  the kernel resets the soft timer again to go off; the kernel copies the current clock value to the timer and adds the timeout interval to it  Soft timer can avoid interrupts  if kernel entries are written frequently, so is the soft timer checked more frequently  frequency of soft timer could be as high as frequency of interrupts itself (without the cost of the interrupts)! CS 423UG - Operating Systems, Indranil Gupta 8 Power Management  ENIAC - first general purpose electronic computer had 18,000 vacuum tubes and consumed 140,000 watts of power.  Invention of transistors dropped the power usage dramatically, and computer industry stopped considering power requirements for some time.  Currently big change: mobile environments, mobile devices which run only on batteries (e.g., battery- powered computers laptops - IBM Think-pads, palmtops - Palm VII, HP Journadas, Webpads)  Battery/Energy performance results do not follow the Moore's law (Moore's law = double performance of hardware such as processors, memory every 18 months) CS 423UG - Operating Systems, Indranil Gupta 9 Approaches to reduce energy consumption  OS turns off parts of the computer when it is not in use (mostly I/O devices such as display)  Have CPU connected to multiple voltage levels – select the right one (at run-time), under the current circumstances  Application program uses less energy, possibly degrading quality of the user experience, but degrading it gracefully CS 423UG - Operating Systems, Indranil Gupta 10 File Systems CS 423UG - Operating Systems, Indranil Gupta 11 Disks First, Then File Systems Form factor: .5-1”× 4”× 5.7” Storage: 18-73GB Form factor: .4-.7” × 2.7” × 3.9” Storage: 4-27GB Form factor: .2-.4” × 2.1” × 3.4” Storage: 170MB-1GB CS 423UG - Operating Systems, Indranil Gupta 12 Magnetic Disk Capacity 1 10 100 1,000 10,000 100,000 M B y te s 80 84 88 92 96 00 1.8” 2.5” 3.5” 5.25” 8-14” 80%/year 5 CS 423UG - Operating Systems, Indranil Gupta 25 C-SCAN (Circular SCAN)  Method  Like SCAN but in addition, wrap around  Real implementation doesn’t go to the end (C- LOOK)  Pros  More uniform service time  Cons  Do nothing on the return trip 0 199 98, 183, 37, 122, 14, 124, 65, 67 (65, 67, 98, 122, 124, 183, 14, 37) 53 CS 423UG - Operating Systems, Indranil Gupta 26 History of Disk-related Concerns  When memory was expensive  Do as little book-keeping as possible  When disks were expensive  Get every last sector of usable space  When disks became more common  Make them much more reliable  When processor got much faster  Make the disk appear faster CS 423UG - Operating Systems, Indranil Gupta 27 Disk Versus Memory Memory  Latency in 10’s of processor cycles  Transfer rate 300+MB/s  Contiguous allocation gains ~10x Disk  Latency in milliseconds  Transfer rate 5-50MB/s  Contiguous allocation gains ~1000x CS 423UG - Operating Systems, Indranil Gupta 28 On-Disk Caching  Method  Put a RAM chip on disk controller to cache blocks  Seagate ATA disk has .5MB cache, IBM Ultra160 SCSI has 16MB cache  Some of the RAM space stores “firmware” (a separate program)  Blocks are replaced usually in LRU order  Pros  Good for reads if you have locality  Cons  Expensive  Need to deal with reliable writes CS 423UG - Operating Systems, Indranil Gupta 29 CD-ROM  Compact Disk – Read Only Memory, Optical Disk  1980 – Philips and Sony developed CD  CD is prepared (WRITE OPERATION)  Using a high-power infrared laser to burn 0.8 micron diameter holes in a coated glass master disk;  From the master disk, mold is created, processed and reflective layer is deposited on polycarbonate;  Data is written into a spiral track (22,188 revs, ~600 per mm)  Depressions on the polycarbonate substrate are called pits, the unburned areas between pits are called lands  CD is read (READ OPERATION)  Low-power laser diode shines infrared light with a wavelength of 0.78 micron on pits and lands as they stream by.  Laser is on the opposite side, so pits stick out as bumps in the flat surface.  Pits and lands return different light to the player’s photodetector (pit and land reflect light with a phase difference), hence the player tells pit from land. Pit length is 0.6 micrometers.  Pit/land and land/pit transitions represent 1, absence of transition is 0.  CD-Recordable, CD-Rewritables, DVD, single or dual-sided CS 423UG - Operating Systems, Indranil Gupta 30 RAID Architectures  Use parallel processing to speed up CPU performance  Use parallel I/O to improve disk performance, reliability (1988, Patterson)  Design new class of I/O devices called RAID – Redundant Array of Inexpensive Disks (also Redundant Array of Independent Disks)  Use the RAID in OS as a SLED (Single Large Expensive Disk), but with better performance and reliability 6 CS 423UG - Operating Systems, Indranil Gupta 31 RAID (cont.)  RAID consists of RAID SCSI controller plus a box of SCSI disks  Data are divided into stripes and distributed over disks for parallel operation  RAID 0 …RAID 5 : different types of RAID systems 1. RAID 0 organization writes consecutive stripes over the drives in round-robin fashion – operation is called striping 2. RAID 1 organization uses striping and duplicates all disks 3. RAID 2 uses words, even bytes and stripes across multiple disks. Also uses error codes, hence very robust scheme. 4. RAID 3, 4, 5 are alterations of the previous ones CS 423UG - Operating Systems, Indranil Gupta 32 Summary  Done with I/O!  File systems next  Reading for this lecture: Section 5.4  Reading for next lecture: Chapter 6  Reminder: MP2 due next Monday at 10 am!
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved