1 / 99

Introduction

Introduction. Operating Systems CS 550 Spring 2014 Kenneth Chiu (adapted from Silberschatz and Tanenbaum ). Textbook. Tanenbaum , “Modern Operating Systems”, 4 th ed. What’s This Course About?. Software systems design Caching Indirection When is it good to be lazy (copy-on-write)

natane
Download Presentation

Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction Operating SystemsCS 550Spring 2014Kenneth Chiu(adapted from Silberschatz and Tanenbaum)

  2. Textbook • Tanenbaum, “Modern Operating Systems”, 4th ed.

  3. What’s This Course About? • Software systems design • Caching • Indirection • When is it good to be lazy (copy-on-write) • When is it good to be eager (pre-fetching) • Modularity • Abstraction • Separation of concerns • We study OS as an exemplar. • But the basic ideas can be found anywhere. • Three years from now you are not going to remember the details about how virtual memory address translation works. • But hopefully you’ll retain the concepts and techniques, so that you could apply them in similar situations.

  4. What is an Operating system?

  5. Fundamental Questions • What is software? • What is hardware? • What is firmware? • What about ASICs?

  6. All Software on a Computer • Let’s see if we can list and categorize them.

  7. Computer System Structure • Computer systems have (at least) four interacting components: • Hardware: Provides basic computing resources • CPU, memory, I/O devices • Operating system: Controls and coordinates use of hardware among various applications and users. • Application programs: • Word processors, compilers, web browsers, database systems, video games • Users • People, machines, other computers

  8. What is an Operating System? • No universally accepted definition. • “Everything a vendor ships when you order an operating system” is good approximation. • But varies wildly. • One way you can define OS is to use the kernel-mode/user-mode separation as a clear, bright line. • “The one program running at all times on the computer” is the kernel.Everything else is either a system program (ships with the operating system) or an application program.

  9. What is not part of the OS? • Firmware? • Word processor? • Window manager? • Windows Control Panel? • Device driver? • Browser? • Anti-virus?

  10. Loose, approximate definition: A program that acts as an intermediary between a user of a computer and the computer hardware. • The OS is a resource allocator. • Manages all resources. • Decides between conflicting requests for efficient and fair resource use. • The OS is a control program. • Controls execution of programs to prevent errors and improper use of the computer.

  11. Goals • What are some OS goals? • Execute user programs and make solving user problems easier. • Make the computer system convenient to use. • Use the computer hardware in an efficient manner.

  12. Trade-Offs and Compromises • Users want convenience, ease of use. • Don’t care about resourceutilization. • What is resource utilization? Who cares about it? • On a shared computer, such as the machines in the remote.cs.binghamton.edu cluster, must keep all users happy. • What if the computer doesn’t allow multiple users to login? Does this problem just go away? • What other shared resources are there commonly? • Virtual machines • Web servers • Even on dedicated resources but frequently use shared resources from servers. • Mobile devices are resource poor, optimized for usability and battery life. • Some computers have little or no user interface, such as embedded computers in devices and automobiles.

  13. OS as an Abstraction Layer • Let’s say you want to write a word processor. Should you (as the application programmer) need to understand the details of the hard drive hardware? • The OS abstracts hardware.

  14. Hardware is messy and complicated • Why? • One of the purposes of an OS is to abstract the hardware; to turn ugly into pretty abstractions.

  15. Computer system organization

  16. Computer System Organization • One or more CPUs, device controllers connect through bus providing access to shared memory. • What is a bus? • Concurrent execution of CPUs and devices competing for memory cycles

  17. What Happens When You Boot the Computer Where does the term come from? • There is a phrase: “...pull yourself up by your bootstraps”. Pull Hard!

  18. What happens when you power-on your computer? • For a computer to do something, it must have machine instructions. • For example, to start Windows Vista, it must run the NTFS file system code. But how does it run the NTFS file system if it has no instructions in the first place? • Typically, there must be some amount of hard-coded ROM. Does this mean that NTFS must be in ROM? • To avoid putting Windows Vista in ROM, things are done incrementally, through a number of stages. • Only enough is put in ROM to allow it to pull in code from modifiable places, such as disk.

  19. When power is applied, the system is hard-wired to set the PC to a specific address, and load the first instruction from there. Does this address refer to ROM or RAM? • The BIOS (basic input/output system) is there. • BIOS does some basic things, mainly hardware related. • Then it loads a small chunk of memory from the boot device, and starts executing it. • Typically, if from hard drive, this will be in the MBR. • This then goes and loads something from the boot partition. • Then typically there is another stage loader. • So typically there will be at least 4 stages. Which stages are easy to modify?

  20. Interrupts Let’s say that you want to go sledding with your friend, but he hasn’t yet finished his OS assignment. • How to determine when your friend has finished his task? • You call him every N minutes to check. • You ask him to call you when he is done. • First is called polling, second is called an interrupt. • Asking him to call you is registering an interrupt.

  21. Interrupts are used to signal an event. • Interrupt transfers control to the interrupt service routine generally, through the interruptvector, which contains the addresses of all the service routines • Interrupt architecture must save the address of the interrupted instruction • Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt • A trap is a software-generated interrupt caused either by an error or a user request • An operating system is interrupt driven

  22. Interrupt Handling • The operating system preserves the state of the CPU by storing registers and the program counter • Determines which type of interrupt has occurred: • polling • vectored interrupt system • Separate segments of code determine what action should be taken for each type of interrupt

  23. Interrupt Timeline

  24. I/O Structure • I/O devices and the CPU can execute concurrently • Each device controller (hardware) is in charge of a particular device type • A device driver (software) interfaces the controller to the rest of the OS. • Each device controller has a local buffer (possibly very small). • CPU moves data from/to main memory to/from local buffers • I/O is from the device to local buffer of controller • Device controller informs CPU that it has finished its operation by causing an interrupt.

  25. Direct Memory Access Structure • Used for high-speed I/O devices able to transmit information at close to memory speeds • Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention • Only one interrupt is generated per block, rather than the one interrupt per byte

  26. Storage Structure • Main memory – only large storage medium that the CPU can access directly • Randomaccess • Typically volatile • Secondary storage – extension of main memory that provides large nonvolatilestorage capacity • Magnetic disks – rigid metal or glass platters covered with magnetic recording material • Disk surface is logically divided into tracks, which are subdivided into sectors • The disk controller determines the logical interaction between the device and the computer • Solid State Drives – Flash-based devices that are more expensive that disks, but generally faster. • Optical drives • Magnetic tape

  27. Storage Hierarchy • Storage systems organized in hierarchy • Speed • Cost • Volatility

  28. Disks

  29. computer system architecture

  30. Processors • What does a CPU do? • Operates in “cycles”, at least conceptually. • Fetch an instruction, decode, execute • Can an Intel CPU execute a program written for a Sun SPARC processor? Can an AMD CPU execute a program written for an Intel CPU? • Different CPUs may have different instruction set architectures (ISA). • What are key things that a CPU has? Why does it have them? What would happen if you got rid of them? • Registers • Program counter • Stack pointer • Program status word (PSW)

  31. Let’s say you download a computer game. It will take 30 minutes. What do you do while it’s downloading? Let’s say you click on a link in your browser and it takes 10 seconds to load. What do you do while it’s loading? What happens when a CPU needs to fetch something from RAM? Why not switch to another thread or process while waiting? • Simultaneous multithreading (SMT)/hyperthreading: • Some CPUs have multiple hardware contexts. They can switch instantly between threads.

  32. Computer-System Architecture • Most systems use a single general-purpose processor (PDAs through mainframes) • Most systems have special-purpose processors as well, in devices such as the disk drive. • Multiprocessorssystems growing in use and importance • Also known as parallel systems, tightly-coupled systems • Advantages include: • Increased throughput • Economy of scale • Increased reliability – graceful degradationor fault tolerance • Two types: • Asymmetric Multiprocessing • Symmetric Multiprocessing

  33. Symmetric Multiprocessing Architecture

  34. What is Moore’s Law? • Are CPUs getting faster?

  35. Multicore

  36. Multicore • Some CPUs have completely separate CPUs inside of them. This is known as multicore.

  37. Hybrid Computing • The GPU is fully programmable, and can be used for general computation. • GPU memory can only be accessed by GPU. GPU CPU Memory Memory

  38. Clustered Systems • Like multiprocessor systems, but multiple systems working together • Usually sharing storage via a storage-area network (SAN) • Provides a high-availabilityservice which survives failures • Asymmetric clusteringhas one machine in hot-standby mode • Symmetric clusteringhas multiple nodes running applications, monitoring each other • Some clusters are for high-performance computing (HPC) • Applications must be written to use parallelization

  39. Clustered Systems

  40. How do clustered systems compare to SMP and multicore systems? • Ease of programming? • Cost? • Performance? • Application type?

  41. Kernel (supervisor) mode • CPU can run in one of two modes: • Kernel (supervisor) • User • What’s different about these?

  42. history of operating systems

  43. First Digital Computer • Created by Charles Babbage (1792-1871) • Gears, etc. • Never worked. Mechanical precision of that age was not good enough. • First programmer: Ada Lovelace

  44. Computers • It’s 1940. • You are a mechanical engineer in the US. • You told your boss in the morning, “I need a computer this afternoon.” • What would you expect to see in your office later that day?

  45. The computer room (1940’s US) • Often parallel (pipelined or otherwise)

More Related