SlideShare une entreprise Scribd logo
1  sur  48
Télécharger pour lire hors ligne
Operating Systems
    Introduction

   Xiaoyu Zhang




                    1
Computing Devices Everywhere




                               2
Computer System Organization
• Computer-system operation
  – One or more CPUs, device controllers connect through
    common bus providing access to shared memory
  – Concurrent execution of CPUs and devices competing
    for memory cycles




                                                           3
How do we tame complexity?
• Every piece of computer hardware different
  – Different CPU
     • Pentium, PowerPC, MIPS, …
  – Different amounts of memory, disk, …
  – Different types of devices
     • Mice, Keyboards, Sensors, Cameras, Fingerprint readers
  – Different networking environment
     • Cable, DSL, Wireless, Firewalls,…


• Questions:
  – Does the programmer need to write a single program
    that performs many independent activities?
  – Does every program have to be altered for every piece
    of hardware?
  – Does a faulty program crash everything?
  – Does every program have access to all hardware?
                                                                4
Four Components of a Computer System




An operating system is the interface between the user and the hardware.

Definition: An operating system implements a virtual machine that is
(hopefully) easier and safer to program and use than the raw hardware.    5
Operating System
       Application
                                    Virtual Machine Interface
 Operating System
                                    Physical Machine Interface
         Hardware
• Services (Resource management): The OS provides standard services
  (the interface) which the hardware implements. These services
  include the file system, virtual memory, networking, CPU scheduling,
  etc.
• Coordination (Control): The OS coordinates multiple applications and
  users to achieve fairness and efficiency (throughput). Examples:
  concurrency, protection, networking, and security.

• The OS design goal is to make the machine convenient to use (a
  software engineering problem) and efficient (a system and
  engineering problem).
                                                                     6
Virtual Machines: Layers of OSs
• Useful for OS development
   – When OS crashes, restricted to one VM
   – Can aid testing programs on other OSs




                                             7
Virtual Machines
• Software emulation of an abstract machine
   – Make it look like hardware has features you want
   – Programs from one hardware & OS work on another one
• Programming simplicity
   –   Each process thinks it has all memory/CPU time
   –   Each process thinks it owns all devices
   –   Different Devices appear to have same interface
   –   Device Interfaces more powerful than raw hardware
        • Bitmapped display ⇒ windowing system
        • Ethernet card ⇒ reliable, ordered, networking (TCP/IP)
• Fault Isolation
   – Processes unable to directly impact other processes
   – Bugs cannot crash whole machine
• Protection and Portability

                                                                   8
Summary of Operating System
               Principles
• OS as juggler: providing the illusion of a dedicated machine
  with infinite memory and CPU.

• OS as government: protecting users from each other,
  allocating resources efficiently and fairly, and providing
  secure and safe communication.

• OS as complex system: keeping OS design and
  implementation as simple as possible is the key to getting the
  OS to work.

• OS as history teacher: learning from past to predict the
  future, i.e., OS design tradeoffs change with technology.

                                                                   9
What is an Operating System,… Really?
• Most Likely:
   –   Memory Management
   –   I/O Management
   –   CPU Scheduling
   –   Communications? (Does Email belong in OS?)
• What about?
   –   File System?
   –   Multimedia Support?
   –   User Interface?
   –   Internet Browser? 
• Is this only interesting to Academics??

                                                    10
Operating System Definition (cont)
• No universally accepted definition

• “Everything a vendor ships when you order an
  operating system” is good approximation
   – But varies wildly

• “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
                                                     11
Why Study Operating Systems?
• Abstraction: How to get the OS to give users an
  illusion of infinite memory, CPUs, resources, world
  wide computing, etc.
• System Design: How to make tradeoffs between
   – performance and the convenience of OS abstractions,
   – performance and the simplicity of OS design, and
   – putting functionality in hardware or software.
• As systems change the OS must adapt (e.g., new
  hardware, software).

                                                       12
Why Study Operating Systems?
• The operating system makes the computer work - it is a key
  abstraction layer for applications.
• Understanding operating systems will enable you to use your
  computer more effectively. They are an excellent example of
  system design issues whose results and ideas you will apply in
  all aspects of experimental computer science.
• Background: To understand this course you must have a solid
  basic understanding of hardware (CS 331: CPU instruction
  sets, memory hierarchies, I/O systems, etc.) and solid
  programming skills (complex data structures, debugging, etc.,
  e.g. what you learned in CS 311)
• Obviously, you cannot understand the implications of how
  components intersect without understanding the
  components.

                                                               13
What if we didn’t have an Operating
                  System?
•   Source Code⇒Compiler⇒Object Code⇒Hardware
•   How do you get object code onto the hardware?
•   How do you print out the answer?
•   Once upon a time, had to Toggle in program in
    binary and read out answer from LED’s!




                    Altair 8080                     14
Simple OS: What if only one
              application?
• Examples:
  – Very early computers
  – Early PCs
  – Embedded controllers (elevators, cars, etc)
• OS becomes just a library of standard services
  – Standard device drivers
  – Interrupt handlers
  – Math libraries

                                                  15
MS-DOS Layer Structure




                         16
More complex OS: Multiple Apps
• Full Coordination and Protection
   – Manage interactions between different users
   – Multiple programs running simultaneously
   – Multiplex and protect Hardware Resources
      • CPU, Memory, I/O devices like disks, printers, etc
• Facilitator
   – Still provides Standard libraries, facilities

• Would this complexity make sense if there were
  only one application that you cared about?
                                                             17
Interrupt Driven O.S.
• Most modern operating systems are interrupt driven.
   – Start-up: 1) Load O.S. (kernel) and start it running.
   –           2) O.S. waits for an event (an interrupt).

• Definition of interrupt:
   – An interrupt is a method to ensure that the CPU takes note of an
     event.

• Types of interrupt:
   – Hardware interrupts (e.g. from an I/O device)
   – Software interrupt (from an executing process. System Call)
       • Also called a trap or an exception
       • Generated to signal error (e.g. divide by zero)
       • or to request service from OS (e.g. I/O).
Interrupt Handling
• The operating system preserves the state of the CPU
  by storing registers and the program counter.
• The O.S. determines which type of interrupt has
  occurred.
   – Separate segments of code determine what action should
     be taken for each type of interrupt.
• The OS executes the sequence of commands
  associated with the given interrupt.
• The OS recovers the stored information from the
  original process and continues execution.
Example: Protecting Processes from
             Each Other
• Problem: Run multiple applications in such a way that
  they are protected from one another
• Goal:
   – Keep User Programs from Crashing OS
   – Keep User Programs from Crashing each other
   – [Keep Parts of OS from crashing other parts?]
• (Some of the required) Mechanisms:
   – Address Translation
   – Dual Mode Operation
• Simple Policy:
   – Programs are not allowed to read/write memory of other
     Programs or of Operating System
                                                              20
Address Translation
• Address Space
   – A group of memory addresses usable by something
   – Each program (process) and kernel has potentially different
     address spaces.
• Address Translation:
   – Translate from Virtual Addresses (emitted by CPU) into Physical
     Addresses (of memory)
   – Mapping often performed in Hardware by Memory Management
     Unit (MMU)

                   Virtual                   Physical
                  Addresses                 Addresses
         CPU                    MMU




                                                                       21
Example of Address Translation
     Code             Data 2
                                       Code
                     Stack 1
     Data                              Data
                      Heap 1
     Heap                              Heap
                      Code 1
     Stack                             Stack
                     Stack 2
     Prog 1           Data 1            Prog 2
    Virtual                            Virtual
    Address           Heap 2
                                       Address
    Space 1           Code 2           Space 2
                     OS code
                     OS data
Translation Map 1               Translation Map 2
                    OS heap &
                      Stacks

              Physical Address Space             22
Dual Mode Operation
•   Hardware provides at least two modes:
     – “Kernel” mode (or “supervisor” or “protected”)
     – “User” mode: Normal programs executed
•   Some instructions/ops prohibited in user mode:
     – Example: cannot modify page tables in user mode
          • Attempt to modify ⇒ Exception generated
•   Transitions from user mode to kernel mode:
     – System Calls, Interrupts, Other exceptions




                                                         24
UNIX System Structure
                 Applications
User Mode
                 Standard Libs




Kernel Mode




 Hardware




                                      25
“In conclusion…”
• Operating systems provide a virtual machine
  abstraction to handle diverse hardware
• Operating systems simplify application
  development by providing standard services
• Operating systems coordinate resources and
  protect users from each other
• Operating systems can provide an array of fault
  containment, fault tolerance, and fault recovery




                                                     26
Moore’s Law Change Drives OS
          Change
                   1981       2006      Factor
   CPU MHz,         10        3200x4    1,280
   Cycles/inst     3—10      0.25—0.5   6—40
  DRAM capacity    128KB       4GB      32,768

  Disk capacity    10MB        1TB      100,000

  Net bandwidth   9600 b/s    1 Gb/s    110,000

   # addr bits      16         32         2

 #users/machine     10s        ≤ 1       ≤ 0.1

      Price       $25,000     $4,000      0.2



 Typical academic computer 1981 vs 2006
                                                  27
Moore’s law effects
• Nothing like this in any other area of business
• Transportation in over 200 years:
   – 2 orders of magnitude from horseback @10mph to Concorde
     @1000mph
   – Computers do this every decade!
• What does this mean for us?
   – Techniques have to vary over time to adapt to changing tradeoffs
• I place a lot more emphasis on principles
   – The key concepts underlying computer systems
   – Less emphasis on facts that are likely to change over the next few
     years…
• Let’s examine the way changes in $/MIPS has radically
  changed how OS’s work

                                                                          28
Dawn of time
     ENIAC: (1945—1955)




• “The machine designed by Drs. Eckert and Mauchly was
  a monstrosity. When it was finished, the ENIAC filled an
  entire room, weighed thirty tons, and consumed two
  hundred kilowatts of power.”
• http://ei.cs.vt.edu/~history/ENIAC.Richey.HTML
                                                             29
History Phase 1 (1948—1970)
 Hardware Expensive, Humans Cheap
• When computers cost millions of $’s, optimize for
  more efficient use of the hardware!
  – Lack of interaction between user and computer

• User at console: one user at a time
• Batch monitor: load program, run, print

• Optimize to better use hardware
  – When user thinking at console, computer idle⇒BAD!
  – Feed computer batches and make users wait
• No protection: what if batch program has bug?

                                                        30
History Phase 1½ (late 60s/early 70s)
• Data channels, Interrupts: overlap I/O and compute
   – DMA – Direct Memory Access for I/O devices
   – I/O can be completed asynchronously
• Multiprogramming: several programs run simultaneously
   – Small jobs not delayed by large jobs
   – More overlap between I/O and CPU
   – Need memory protection between programs and/or OS
• Complexity gets out of hand:
   – Multics: announced in 1963, ran in 1969
       • 1777 people “contributed to Multics” (30-40 core dev)
       • Turing award lecture from Fernando Corbató (key researcher): “On
         building systems that will fail”
   – OS 360: released with 1000 known bugs (APARs)
       • “Anomalous Program Activity Report”
• OS finally becomes an important science:
   – How to deal with complexity???
   – UNIX based on Multics, but vastly simplified

                                                                            31
History Phase 2 (1970 – 1985)
Hardware Cheaper, Humans Expensive
• Computers available for tens of thousands of dollars instead of millions
• OS Technology maturing/stabilizing
• Interactive timesharing:
   – Use cheap terminals (~$1000) to let multiple users interact with the
      system at the same time
   – Sacrifice CPU time to get better response time
   – Users do debugging, editing, and email online
• Problem: Thrashing
   – Performance very non-linear
      response with load



                                                Response
                                                  time
   – Thrashing caused by many
      factors including
        • Swapping, queueing

                                                           Users
                                                                             32
History Phase 3 (1981— )
 Hardware Very Cheap, Humans Very Expensive
• Computer costs $1K, Programmer costs $100K/year
   – If you can make someone 1% more efficient by giving
     them a computer, it’s worth it!
   – Use computers to make people more efficient
• Personal computing:
   – Computers cheap, so give everyone a PC
• Limited Hardware Resources Initially:
   – OS becomes a subroutine library
   – One application at a time (MSDOS, CP/M, …)
• Eventually PCs become powerful:
   – OS regains all the complexity of a “big” OS
   – multiprogramming, memory protection, etc (NT,OS/2)
• Question: As hardware gets cheaper does need for OS
  go away?

                                                           33
History Phase 3 (con’t)
             Graphical User Interfaces
• Xerox Star: 1981
   – Originally a research




                                 Xerox Star
     project (Alto)
   – First “mice”, “windows”
• Apple Lisa/Machintosh: 1984
   – “Look and Feel” suit 1988
• Microsoft Windows:
   – Win 1.0 (1985)
   – Win 3.1 (1990)
   – Win 95 (1995)
   – Win NT (1993)
   – Win 2000 (2000)             Windows 3.1
   – Win XP (2001)
   – Win Vista (2007)


                                               34
History Phase 4 (1989—): Distributed
                Systems
• Networking (Local Area Networking)
   – Different machines share resources
   – Printers, File Servers, Web Servers
   – Client – Server Model
• Services
   – Computing
   – File Storage




                                           35
History Phase 5 (1995—): Mobile
                Systems
• Ubiquitous Mobile Devices
   – Laptops, PDAs, phones
   – Small, portable, and inexpensive
       • Recently twice as many smart phones as PDAs
       • Many computers/person!
   – Limited capabilities (memory, CPU, power, etc…)
• Wireless/Wide Area Networking
   – Leveraging the infrastructure
   – Huge distributed pool of resources extend devices
   – Traditional computers split into pieces. Wireless keyboards/mice,
     CPU distributed, storage remote
• Peer-to-peer systems
   – Many devices with equal responsibilities work together
   – Components of “Operating System” spread across globe

                                                                         36
History of OS: Summary
• Change is continuous and OSs should adapt
   – Not: look how stupid batch processing was
   – But: Made sense at the time
• Situation today is much like the late 60s [poll]
   – Small OS: 100K lines
   – Large OS: >10M lines (5M for the browser!)
      • 100-1000 people-years
• Complexity still reigns
   – NT under development from early 90’s to late 90’s
      • Never worked very well
   – Jury still out on Windows 2000/XP
   – Windows Vista (aka “Longhorn”) delayed many times
      • Latest release date of 2005, 2006, 2007 (finally)


                                                            37
Now for a quick tour of OS Structures




                                        38
Operating System Structure
•   Multiprogramming needed for efficiency
      – Single user cannot keep CPU and I/O devices busy at all times
      – Multiprogramming organizes jobs (code and data) so CPU always has one to
        execute
      – A subset of total jobs in system is kept in memory
      – One job selected and run via job scheduling
      – When it has to wait (for I/O for example), OS switches to another job
•   Timesharing (multitasking) is logical extension in which CPU switches jobs so
    frequently that users can interact with each job while it is running, creating
    interactive computing
      – Response time should be < 1 second
      – Each user has at least one program executing in memory process
      – If several jobs ready to run at the same time  CPU scheduling
      – If processes don’t fit in memory, swapping moves them in and out to run
      – Virtual memory allows execution of processes not completely in memory


                                                                                     39
Operating System Services
        (What things does the OS do?)
• Services that (more-or-less) map onto components
   – Program execution
        • How do you execute concurrent sequences of instructions?
   – I/O operations
        • Standardized interfaces to extremely diverse devices
   – File system manipulation
        • How do you read/write/preserve files?
        • Looming concern: How do you even find files???
   – Communications
        • Networking protocols/Interface with CyberSpace?
• Control capabilities
   –   Error detection & recovery
   –   Resource allocation
   –   Accounting
   –   Protection

                                                                     40
Operating Systems Components
     (What are the pieces of the OS)
•   Process Management
•   Main-Memory Management
•   I/O System management
•   File Management
•   Networking
•   User Interfaces


                                       41
Process Management
• A process is a program in execution. It is a unit of work within the system.
  Program is a passive entity, process is an active entity.
• Process needs resources to accomplish its task
   – CPU, memory, I/O, files
   – Initialization data
• Process termination requires reclaim of any reusable resources
• Single-threaded process has one program counter specifying location of
  next instruction to execute
   – Process executes instructions sequentially, one at a time, until
      completion
• Multi-threaded process has one program counter per thread
• Typically system has many processes, some user, some operating system
  running concurrently on one or more CPUs
   – Concurrency by multiplexing the CPUs among the processes / threads

                                                                             42
Process Management Activities
The operating system is responsible for the following
  activities in connection with process management:
• Creating and deleting both user and system
  processes
• Suspending and resuming processes
• Providing mechanisms for process synchronization
• Providing mechanisms for process communication
• Providing mechanisms for deadlock handling

                                                    43
Memory Management
• All data in memory before and after processing
• All instructions in memory in order to execute
• Memory management determines what is in memory
  when
  – Optimizing CPU utilization and computer response to users
• Memory management activities
  – Keeping track of which parts of memory are currently
    being used and by whom
  – Deciding which processes (or parts thereof) and data to
    move into and out of memory
  – Allocating and deallocating memory space as needed

                                                              44
Storage Management
• OS provides uniform, logical view of information storage
   – Abstracts physical properties to logical storage unit - file
   – Each medium is controlled by device (i.e., disk drive, tape drive)
       • Varying properties include access speed, capacity, data-transfer rate,
         access method (sequential or random)


• File-System management
   – Files usually organized into directories
   – Access control on most systems to determine who can access what
   – OS activities include
       •   Creating and deleting files and directories
       •   Primitives to manipulate files and dirs
       •   Mapping files onto secondary storage
       •   Backup files onto stable (non-volatile) storage media



                                                                                  45
Mass-Storage Management
•   Usually disks used to store data that does not fit in main memory or data that
    must be kept for a “long” period of time.
•   Proper management is of central importance
•   Entire speed of computer operation hinges on disk subsystem and its algorithms
•   OS activities
     – Free-space management
     – Storage allocation
     – Disk scheduling
•   Some storage need not be fast
     – Tertiary storage includes optical storage, magnetic tape
     – Still must be managed
     – Varies between WORM (write-once, read-many-times) and RW (read-write)




                                                                                     46
I/O Subsystem
• One purpose of OS is to hide peculiarities of
  hardware devices from the user
• I/O subsystem responsible for
   – Memory management of I/O including
      • buffering (storing data temporarily while it is being
        transferred),
      • caching (storing parts of data in faster storage for
        performance),
      • spooling (the overlapping of output of one job with input of
        other jobs)
   – General device-driver interface
   – Drivers for specific hardware devices

                                                                       47
Protection and Security
• Protection – any mechanism for controlling access of
  processes or users to resources defined by the OS
• Security – defense of the system against internal and external
  attacks
   – Huge range, including denial-of-service, worms, viruses, identity
     theft, theft of service
• Systems generally first distinguish among users, to determine
  who can do what
   – User identities (user IDs, security IDs) include name and associated
     number, one per user
   – User ID then associated with all files, processes of that user to
     determine access control
   – Group identifier (group ID) allows set of users to be defined and
     controls managed, then also associated with each process, file
   – Privilege escalation allows user to change to effective ID with
     more rights

                                                                         48
Conclusion
• Rapid Change in Hardware Leads to changing OS
   – Batch ⇒ Multiprogramming ⇒ Timeshare ⇒
     Graphical UI ⇒ Ubiquitous Devices ⇒
     Cyberspace/Metaverse/??
• OS features migrated from mainframes ⇒ PCs
• Standard Components and Services
   –   Process Control
   –   Main Memory
   –   I/O
   –   File System
   –   UI
• Complexity is always out of control
   – However, “Resistance is NOT Useless!”

                                                  49

Contenu connexe

Tendances

What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelNeel Parikh
 
Computer system organization
Computer system organizationComputer system organization
Computer system organizationSyed Zaid Irshad
 
introduction to operating system
introduction to operating systemintroduction to operating system
introduction to operating systemHAMZA AHMED
 
Ch1: Operating System- Introduction
Ch1: Operating System- IntroductionCh1: Operating System- Introduction
Ch1: Operating System- IntroductionAhmar Hashmi
 
Operating system Concepts
Operating system Concepts Operating system Concepts
Operating system Concepts RANVIJAY GAUR
 
Operating System / System Operasi
Operating System / System Operasi                   Operating System / System Operasi
Operating System / System Operasi seolangit4
 
UNIT II-Programming in Linux
UNIT II-Programming in LinuxUNIT II-Programming in Linux
UNIT II-Programming in LinuxDr.YNM
 
Operating Systems 1 (3/12) - Architectures
Operating Systems 1 (3/12) - ArchitecturesOperating Systems 1 (3/12) - Architectures
Operating Systems 1 (3/12) - ArchitecturesPeter Tröger
 
Operating system concepts
Operating system conceptsOperating system concepts
Operating system conceptsStarlee Lathong
 
Operating Systems 1 (2/12) - Hardware Basics
Operating Systems 1 (2/12) - Hardware BasicsOperating Systems 1 (2/12) - Hardware Basics
Operating Systems 1 (2/12) - Hardware BasicsPeter Tröger
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecturevenkateswarlu G
 
Nt introduction(os)
Nt introduction(os)Nt introduction(os)
Nt introduction(os)NehaTadam
 
Operating Systems
Operating SystemsOperating Systems
Operating Systemsvampugani
 

Tendances (19)

What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernel
 
Computer system organization
Computer system organizationComputer system organization
Computer system organization
 
introduction to operating system
introduction to operating systemintroduction to operating system
introduction to operating system
 
Sistemas Operativos
Sistemas OperativosSistemas Operativos
Sistemas Operativos
 
Ch1: Operating System- Introduction
Ch1: Operating System- IntroductionCh1: Operating System- Introduction
Ch1: Operating System- Introduction
 
An Introduction to Operating Systems
An Introduction to Operating SystemsAn Introduction to Operating Systems
An Introduction to Operating Systems
 
L4 Microkernel :: Design Overview
L4 Microkernel :: Design OverviewL4 Microkernel :: Design Overview
L4 Microkernel :: Design Overview
 
Introduction to OS.
Introduction to OS.Introduction to OS.
Introduction to OS.
 
Operating system Concepts
Operating system Concepts Operating system Concepts
Operating system Concepts
 
Operating System / System Operasi
Operating System / System Operasi                   Operating System / System Operasi
Operating System / System Operasi
 
UNIT II-Programming in Linux
UNIT II-Programming in LinuxUNIT II-Programming in Linux
UNIT II-Programming in Linux
 
Operating Systems 1 (3/12) - Architectures
Operating Systems 1 (3/12) - ArchitecturesOperating Systems 1 (3/12) - Architectures
Operating Systems 1 (3/12) - Architectures
 
Operating system concepts
Operating system conceptsOperating system concepts
Operating system concepts
 
Os concepts
Os conceptsOs concepts
Os concepts
 
Operating Systems 1 (2/12) - Hardware Basics
Operating Systems 1 (2/12) - Hardware BasicsOperating Systems 1 (2/12) - Hardware Basics
Operating Systems 1 (2/12) - Hardware Basics
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecture
 
Cs8493 unit 5
Cs8493 unit 5Cs8493 unit 5
Cs8493 unit 5
 
Nt introduction(os)
Nt introduction(os)Nt introduction(os)
Nt introduction(os)
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 

Similaire à Chap1

Introduction to Operating System
Introduction to Operating SystemIntroduction to Operating System
Introduction to Operating Systempriya_sinha02
 
Principles of operating system
Principles of operating systemPrinciples of operating system
Principles of operating systemAnil Dharmapuri
 
Mba i-ifm-u-3 operating systems
Mba i-ifm-u-3 operating systemsMba i-ifm-u-3 operating systems
Mba i-ifm-u-3 operating systemsRai University
 
Mba i-ifm-u-3 operating systems
Mba i-ifm-u-3 operating systemsMba i-ifm-u-3 operating systems
Mba i-ifm-u-3 operating systemsRai University
 
Bsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systemsBsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systemsRai University
 
Bsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systemsBsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systemsRai University
 
Bca i-fundamental of computer-u-3-functions operating systems
Bca  i-fundamental of  computer-u-3-functions operating systemsBca  i-fundamental of  computer-u-3-functions operating systems
Bca i-fundamental of computer-u-3-functions operating systemsRai University
 
Mca i-fundamental of computer-u-3-functions operating systems
Mca  i-fundamental of  computer-u-3-functions operating systemsMca  i-fundamental of  computer-u-3-functions operating systems
Mca i-fundamental of computer-u-3-functions operating systemsRai University
 
lecture1 details of operating system abraham silberchatz
lecture1 details of operating system abraham silberchatzlecture1 details of operating system abraham silberchatz
lecture1 details of operating system abraham silberchatzMrsKAVITHASAsstProfC
 
What is operating system
What is operating systemWhat is operating system
What is operating systemSuvithak
 
Bba i-introduction to computer-u-3-functions operating systems
Bba  i-introduction to computer-u-3-functions operating systemsBba  i-introduction to computer-u-3-functions operating systems
Bba i-introduction to computer-u-3-functions operating systemsRai University
 
Kernel security Concepts
Kernel security ConceptsKernel security Concepts
Kernel security ConceptsMohit Saxena
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsNational Cheng Kung University
 
EMBEDDED OS
EMBEDDED OSEMBEDDED OS
EMBEDDED OSAJAL A J
 

Similaire à Chap1 (20)

os_1.pdf
os_1.pdfos_1.pdf
os_1.pdf
 
Introduction to Operating System
Introduction to Operating SystemIntroduction to Operating System
Introduction to Operating System
 
Principles of operating system
Principles of operating systemPrinciples of operating system
Principles of operating system
 
Advanced_OS_Unit 1 & 2.ppt
Advanced_OS_Unit 1 & 2.pptAdvanced_OS_Unit 1 & 2.ppt
Advanced_OS_Unit 1 & 2.ppt
 
Distributive operating system
Distributive operating systemDistributive operating system
Distributive operating system
 
Unit 4
Unit  4Unit  4
Unit 4
 
Mba i-ifm-u-3 operating systems
Mba i-ifm-u-3 operating systemsMba i-ifm-u-3 operating systems
Mba i-ifm-u-3 operating systems
 
Mba i-ifm-u-3 operating systems
Mba i-ifm-u-3 operating systemsMba i-ifm-u-3 operating systems
Mba i-ifm-u-3 operating systems
 
Bsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systemsBsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systems
 
Bsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systemsBsc cs 1 fit u-3 operating systems
Bsc cs 1 fit u-3 operating systems
 
Bca i-fundamental of computer-u-3-functions operating systems
Bca  i-fundamental of  computer-u-3-functions operating systemsBca  i-fundamental of  computer-u-3-functions operating systems
Bca i-fundamental of computer-u-3-functions operating systems
 
Mca i-fundamental of computer-u-3-functions operating systems
Mca  i-fundamental of  computer-u-3-functions operating systemsMca  i-fundamental of  computer-u-3-functions operating systems
Mca i-fundamental of computer-u-3-functions operating systems
 
lecture1 details of operating system abraham silberchatz
lecture1 details of operating system abraham silberchatzlecture1 details of operating system abraham silberchatz
lecture1 details of operating system abraham silberchatz
 
Ch 2
Ch 2Ch 2
Ch 2
 
Platform-Technology.pdf
Platform-Technology.pdfPlatform-Technology.pdf
Platform-Technology.pdf
 
What is operating system
What is operating systemWhat is operating system
What is operating system
 
Bba i-introduction to computer-u-3-functions operating systems
Bba  i-introduction to computer-u-3-functions operating systemsBba  i-introduction to computer-u-3-functions operating systems
Bba i-introduction to computer-u-3-functions operating systems
 
Kernel security Concepts
Kernel security ConceptsKernel security Concepts
Kernel security Concepts
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM Boards
 
EMBEDDED OS
EMBEDDED OSEMBEDDED OS
EMBEDDED OS
 

Dernier

How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17Celine George
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice documentXsasf Sfdfasd
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...Nguyen Thanh Tu Collection
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptxmary850239
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and stepobaje godwin sunday
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationMJDuyan
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfMohonDas
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17Celine George
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesCeline George
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxraviapr7
 
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxKatherine Villaluna
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17Celine George
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsEugene Lysak
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17Celine George
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxKatherine Villaluna
 
Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...raviapr7
 
Presentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphPresentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphNetziValdelomar1
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfTechSoup
 

Dernier (20)

How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice document
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptx
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and step
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive Education
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdf
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 Sales
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptx
 
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George Wells
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptx
 
Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...
 
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdfPersonal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
 
Presentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphPresentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a Paragraph
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
 

Chap1

  • 1. Operating Systems Introduction Xiaoyu Zhang 1
  • 3. Computer System Organization • Computer-system operation – One or more CPUs, device controllers connect through common bus providing access to shared memory – Concurrent execution of CPUs and devices competing for memory cycles 3
  • 4. How do we tame complexity? • Every piece of computer hardware different – Different CPU • Pentium, PowerPC, MIPS, … – Different amounts of memory, disk, … – Different types of devices • Mice, Keyboards, Sensors, Cameras, Fingerprint readers – Different networking environment • Cable, DSL, Wireless, Firewalls,… • Questions: – Does the programmer need to write a single program that performs many independent activities? – Does every program have to be altered for every piece of hardware? – Does a faulty program crash everything? – Does every program have access to all hardware? 4
  • 5. Four Components of a Computer System An operating system is the interface between the user and the hardware. Definition: An operating system implements a virtual machine that is (hopefully) easier and safer to program and use than the raw hardware. 5
  • 6. Operating System Application Virtual Machine Interface Operating System Physical Machine Interface Hardware • Services (Resource management): The OS provides standard services (the interface) which the hardware implements. These services include the file system, virtual memory, networking, CPU scheduling, etc. • Coordination (Control): The OS coordinates multiple applications and users to achieve fairness and efficiency (throughput). Examples: concurrency, protection, networking, and security. • The OS design goal is to make the machine convenient to use (a software engineering problem) and efficient (a system and engineering problem). 6
  • 7. Virtual Machines: Layers of OSs • Useful for OS development – When OS crashes, restricted to one VM – Can aid testing programs on other OSs 7
  • 8. Virtual Machines • Software emulation of an abstract machine – Make it look like hardware has features you want – Programs from one hardware & OS work on another one • Programming simplicity – Each process thinks it has all memory/CPU time – Each process thinks it owns all devices – Different Devices appear to have same interface – Device Interfaces more powerful than raw hardware • Bitmapped display ⇒ windowing system • Ethernet card ⇒ reliable, ordered, networking (TCP/IP) • Fault Isolation – Processes unable to directly impact other processes – Bugs cannot crash whole machine • Protection and Portability 8
  • 9. Summary of Operating System Principles • OS as juggler: providing the illusion of a dedicated machine with infinite memory and CPU. • OS as government: protecting users from each other, allocating resources efficiently and fairly, and providing secure and safe communication. • OS as complex system: keeping OS design and implementation as simple as possible is the key to getting the OS to work. • OS as history teacher: learning from past to predict the future, i.e., OS design tradeoffs change with technology. 9
  • 10. What is an Operating System,… Really? • Most Likely: – Memory Management – I/O Management – CPU Scheduling – Communications? (Does Email belong in OS?) • What about? – File System? – Multimedia Support? – User Interface? – Internet Browser?  • Is this only interesting to Academics?? 10
  • 11. Operating System Definition (cont) • No universally accepted definition • “Everything a vendor ships when you order an operating system” is good approximation – But varies wildly • “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 11
  • 12. Why Study Operating Systems? • Abstraction: How to get the OS to give users an illusion of infinite memory, CPUs, resources, world wide computing, etc. • System Design: How to make tradeoffs between – performance and the convenience of OS abstractions, – performance and the simplicity of OS design, and – putting functionality in hardware or software. • As systems change the OS must adapt (e.g., new hardware, software). 12
  • 13. Why Study Operating Systems? • The operating system makes the computer work - it is a key abstraction layer for applications. • Understanding operating systems will enable you to use your computer more effectively. They are an excellent example of system design issues whose results and ideas you will apply in all aspects of experimental computer science. • Background: To understand this course you must have a solid basic understanding of hardware (CS 331: CPU instruction sets, memory hierarchies, I/O systems, etc.) and solid programming skills (complex data structures, debugging, etc., e.g. what you learned in CS 311) • Obviously, you cannot understand the implications of how components intersect without understanding the components. 13
  • 14. What if we didn’t have an Operating System? • Source Code⇒Compiler⇒Object Code⇒Hardware • How do you get object code onto the hardware? • How do you print out the answer? • Once upon a time, had to Toggle in program in binary and read out answer from LED’s! Altair 8080 14
  • 15. Simple OS: What if only one application? • Examples: – Very early computers – Early PCs – Embedded controllers (elevators, cars, etc) • OS becomes just a library of standard services – Standard device drivers – Interrupt handlers – Math libraries 15
  • 17. More complex OS: Multiple Apps • Full Coordination and Protection – Manage interactions between different users – Multiple programs running simultaneously – Multiplex and protect Hardware Resources • CPU, Memory, I/O devices like disks, printers, etc • Facilitator – Still provides Standard libraries, facilities • Would this complexity make sense if there were only one application that you cared about? 17
  • 18. Interrupt Driven O.S. • Most modern operating systems are interrupt driven. – Start-up: 1) Load O.S. (kernel) and start it running. – 2) O.S. waits for an event (an interrupt). • Definition of interrupt: – An interrupt is a method to ensure that the CPU takes note of an event. • Types of interrupt: – Hardware interrupts (e.g. from an I/O device) – Software interrupt (from an executing process. System Call) • Also called a trap or an exception • Generated to signal error (e.g. divide by zero) • or to request service from OS (e.g. I/O).
  • 19. Interrupt Handling • The operating system preserves the state of the CPU by storing registers and the program counter. • The O.S. determines which type of interrupt has occurred. – Separate segments of code determine what action should be taken for each type of interrupt. • The OS executes the sequence of commands associated with the given interrupt. • The OS recovers the stored information from the original process and continues execution.
  • 20. Example: Protecting Processes from Each Other • Problem: Run multiple applications in such a way that they are protected from one another • Goal: – Keep User Programs from Crashing OS – Keep User Programs from Crashing each other – [Keep Parts of OS from crashing other parts?] • (Some of the required) Mechanisms: – Address Translation – Dual Mode Operation • Simple Policy: – Programs are not allowed to read/write memory of other Programs or of Operating System 20
  • 21. Address Translation • Address Space – A group of memory addresses usable by something – Each program (process) and kernel has potentially different address spaces. • Address Translation: – Translate from Virtual Addresses (emitted by CPU) into Physical Addresses (of memory) – Mapping often performed in Hardware by Memory Management Unit (MMU) Virtual Physical Addresses Addresses CPU MMU 21
  • 22. Example of Address Translation Code Data 2 Code Stack 1 Data Data Heap 1 Heap Heap Code 1 Stack Stack Stack 2 Prog 1 Data 1 Prog 2 Virtual Virtual Address Heap 2 Address Space 1 Code 2 Space 2 OS code OS data Translation Map 1 Translation Map 2 OS heap & Stacks Physical Address Space 22
  • 23. Dual Mode Operation • Hardware provides at least two modes: – “Kernel” mode (or “supervisor” or “protected”) – “User” mode: Normal programs executed • Some instructions/ops prohibited in user mode: – Example: cannot modify page tables in user mode • Attempt to modify ⇒ Exception generated • Transitions from user mode to kernel mode: – System Calls, Interrupts, Other exceptions 24
  • 24. UNIX System Structure Applications User Mode Standard Libs Kernel Mode Hardware 25
  • 25. “In conclusion…” • Operating systems provide a virtual machine abstraction to handle diverse hardware • Operating systems simplify application development by providing standard services • Operating systems coordinate resources and protect users from each other • Operating systems can provide an array of fault containment, fault tolerance, and fault recovery 26
  • 26. Moore’s Law Change Drives OS Change 1981 2006 Factor CPU MHz, 10 3200x4 1,280 Cycles/inst 3—10 0.25—0.5 6—40 DRAM capacity 128KB 4GB 32,768 Disk capacity 10MB 1TB 100,000 Net bandwidth 9600 b/s 1 Gb/s 110,000 # addr bits 16 32 2 #users/machine 10s ≤ 1 ≤ 0.1 Price $25,000 $4,000 0.2 Typical academic computer 1981 vs 2006 27
  • 27. Moore’s law effects • Nothing like this in any other area of business • Transportation in over 200 years: – 2 orders of magnitude from horseback @10mph to Concorde @1000mph – Computers do this every decade! • What does this mean for us? – Techniques have to vary over time to adapt to changing tradeoffs • I place a lot more emphasis on principles – The key concepts underlying computer systems – Less emphasis on facts that are likely to change over the next few years… • Let’s examine the way changes in $/MIPS has radically changed how OS’s work 28
  • 28. Dawn of time ENIAC: (1945—1955) • “The machine designed by Drs. Eckert and Mauchly was a monstrosity. When it was finished, the ENIAC filled an entire room, weighed thirty tons, and consumed two hundred kilowatts of power.” • http://ei.cs.vt.edu/~history/ENIAC.Richey.HTML 29
  • 29. History Phase 1 (1948—1970) Hardware Expensive, Humans Cheap • When computers cost millions of $’s, optimize for more efficient use of the hardware! – Lack of interaction between user and computer • User at console: one user at a time • Batch monitor: load program, run, print • Optimize to better use hardware – When user thinking at console, computer idle⇒BAD! – Feed computer batches and make users wait • No protection: what if batch program has bug? 30
  • 30. History Phase 1½ (late 60s/early 70s) • Data channels, Interrupts: overlap I/O and compute – DMA – Direct Memory Access for I/O devices – I/O can be completed asynchronously • Multiprogramming: several programs run simultaneously – Small jobs not delayed by large jobs – More overlap between I/O and CPU – Need memory protection between programs and/or OS • Complexity gets out of hand: – Multics: announced in 1963, ran in 1969 • 1777 people “contributed to Multics” (30-40 core dev) • Turing award lecture from Fernando Corbató (key researcher): “On building systems that will fail” – OS 360: released with 1000 known bugs (APARs) • “Anomalous Program Activity Report” • OS finally becomes an important science: – How to deal with complexity??? – UNIX based on Multics, but vastly simplified 31
  • 31. History Phase 2 (1970 – 1985) Hardware Cheaper, Humans Expensive • Computers available for tens of thousands of dollars instead of millions • OS Technology maturing/stabilizing • Interactive timesharing: – Use cheap terminals (~$1000) to let multiple users interact with the system at the same time – Sacrifice CPU time to get better response time – Users do debugging, editing, and email online • Problem: Thrashing – Performance very non-linear response with load Response time – Thrashing caused by many factors including • Swapping, queueing Users 32
  • 32. History Phase 3 (1981— ) Hardware Very Cheap, Humans Very Expensive • Computer costs $1K, Programmer costs $100K/year – If you can make someone 1% more efficient by giving them a computer, it’s worth it! – Use computers to make people more efficient • Personal computing: – Computers cheap, so give everyone a PC • Limited Hardware Resources Initially: – OS becomes a subroutine library – One application at a time (MSDOS, CP/M, …) • Eventually PCs become powerful: – OS regains all the complexity of a “big” OS – multiprogramming, memory protection, etc (NT,OS/2) • Question: As hardware gets cheaper does need for OS go away? 33
  • 33. History Phase 3 (con’t) Graphical User Interfaces • Xerox Star: 1981 – Originally a research Xerox Star project (Alto) – First “mice”, “windows” • Apple Lisa/Machintosh: 1984 – “Look and Feel” suit 1988 • Microsoft Windows: – Win 1.0 (1985) – Win 3.1 (1990) – Win 95 (1995) – Win NT (1993) – Win 2000 (2000) Windows 3.1 – Win XP (2001) – Win Vista (2007) 34
  • 34. History Phase 4 (1989—): Distributed Systems • Networking (Local Area Networking) – Different machines share resources – Printers, File Servers, Web Servers – Client – Server Model • Services – Computing – File Storage 35
  • 35. History Phase 5 (1995—): Mobile Systems • Ubiquitous Mobile Devices – Laptops, PDAs, phones – Small, portable, and inexpensive • Recently twice as many smart phones as PDAs • Many computers/person! – Limited capabilities (memory, CPU, power, etc…) • Wireless/Wide Area Networking – Leveraging the infrastructure – Huge distributed pool of resources extend devices – Traditional computers split into pieces. Wireless keyboards/mice, CPU distributed, storage remote • Peer-to-peer systems – Many devices with equal responsibilities work together – Components of “Operating System” spread across globe 36
  • 36. History of OS: Summary • Change is continuous and OSs should adapt – Not: look how stupid batch processing was – But: Made sense at the time • Situation today is much like the late 60s [poll] – Small OS: 100K lines – Large OS: >10M lines (5M for the browser!) • 100-1000 people-years • Complexity still reigns – NT under development from early 90’s to late 90’s • Never worked very well – Jury still out on Windows 2000/XP – Windows Vista (aka “Longhorn”) delayed many times • Latest release date of 2005, 2006, 2007 (finally) 37
  • 37. Now for a quick tour of OS Structures 38
  • 38. Operating System Structure • Multiprogramming needed for efficiency – Single user cannot keep CPU and I/O devices busy at all times – Multiprogramming organizes jobs (code and data) so CPU always has one to execute – A subset of total jobs in system is kept in memory – One job selected and run via job scheduling – When it has to wait (for I/O for example), OS switches to another job • Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing – Response time should be < 1 second – Each user has at least one program executing in memory process – If several jobs ready to run at the same time  CPU scheduling – If processes don’t fit in memory, swapping moves them in and out to run – Virtual memory allows execution of processes not completely in memory 39
  • 39. Operating System Services (What things does the OS do?) • Services that (more-or-less) map onto components – Program execution • How do you execute concurrent sequences of instructions? – I/O operations • Standardized interfaces to extremely diverse devices – File system manipulation • How do you read/write/preserve files? • Looming concern: How do you even find files??? – Communications • Networking protocols/Interface with CyberSpace? • Control capabilities – Error detection & recovery – Resource allocation – Accounting – Protection 40
  • 40. Operating Systems Components (What are the pieces of the OS) • Process Management • Main-Memory Management • I/O System management • File Management • Networking • User Interfaces 41
  • 41. Process Management • A process is a program in execution. It is a unit of work within the system. Program is a passive entity, process is an active entity. • Process needs resources to accomplish its task – CPU, memory, I/O, files – Initialization data • Process termination requires reclaim of any reusable resources • Single-threaded process has one program counter specifying location of next instruction to execute – Process executes instructions sequentially, one at a time, until completion • Multi-threaded process has one program counter per thread • Typically system has many processes, some user, some operating system running concurrently on one or more CPUs – Concurrency by multiplexing the CPUs among the processes / threads 42
  • 42. Process Management Activities The operating system is responsible for the following activities in connection with process management: • Creating and deleting both user and system processes • Suspending and resuming processes • Providing mechanisms for process synchronization • Providing mechanisms for process communication • Providing mechanisms for deadlock handling 43
  • 43. Memory Management • All data in memory before and after processing • All instructions in memory in order to execute • Memory management determines what is in memory when – Optimizing CPU utilization and computer response to users • Memory management activities – Keeping track of which parts of memory are currently being used and by whom – Deciding which processes (or parts thereof) and data to move into and out of memory – Allocating and deallocating memory space as needed 44
  • 44. Storage Management • OS provides uniform, logical view of information storage – Abstracts physical properties to logical storage unit - file – Each medium is controlled by device (i.e., disk drive, tape drive) • Varying properties include access speed, capacity, data-transfer rate, access method (sequential or random) • File-System management – Files usually organized into directories – Access control on most systems to determine who can access what – OS activities include • Creating and deleting files and directories • Primitives to manipulate files and dirs • Mapping files onto secondary storage • Backup files onto stable (non-volatile) storage media 45
  • 45. Mass-Storage Management • Usually disks used to store data that does not fit in main memory or data that must be kept for a “long” period of time. • Proper management is of central importance • Entire speed of computer operation hinges on disk subsystem and its algorithms • OS activities – Free-space management – Storage allocation – Disk scheduling • Some storage need not be fast – Tertiary storage includes optical storage, magnetic tape – Still must be managed – Varies between WORM (write-once, read-many-times) and RW (read-write) 46
  • 46. I/O Subsystem • One purpose of OS is to hide peculiarities of hardware devices from the user • I/O subsystem responsible for – Memory management of I/O including • buffering (storing data temporarily while it is being transferred), • caching (storing parts of data in faster storage for performance), • spooling (the overlapping of output of one job with input of other jobs) – General device-driver interface – Drivers for specific hardware devices 47
  • 47. Protection and Security • Protection – any mechanism for controlling access of processes or users to resources defined by the OS • Security – defense of the system against internal and external attacks – Huge range, including denial-of-service, worms, viruses, identity theft, theft of service • Systems generally first distinguish among users, to determine who can do what – User identities (user IDs, security IDs) include name and associated number, one per user – User ID then associated with all files, processes of that user to determine access control – Group identifier (group ID) allows set of users to be defined and controls managed, then also associated with each process, file – Privilege escalation allows user to change to effective ID with more rights 48
  • 48. Conclusion • Rapid Change in Hardware Leads to changing OS – Batch ⇒ Multiprogramming ⇒ Timeshare ⇒ Graphical UI ⇒ Ubiquitous Devices ⇒ Cyberspace/Metaverse/?? • OS features migrated from mainframes ⇒ PCs • Standard Components and Services – Process Control – Main Memory – I/O – File System – UI • Complexity is always out of control – However, “Resistance is NOT Useless!” 49

Notes de l'éditeur

  1. What’s the largest single use of microprocessors? Not computers – Embedded computers (10 billion versus 400 million) Example: Nintendo game machine. Second largest? Automobiles. Both require concurrency, but no need for protection
  2. Computer system can be divided into four 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 – define the ways in which the system resources are used to solve the computing problems of the users Word processors, compilers, web browsers, database systems, video games Users People, machines, other computers
  3. Intel Pentium D 940 Extreme Edition – Dual hyperthreaded core
  4. The best part of computer science: Suppose you don’t know anything today, wait a few years and no one will know anything!
  5. OS first appeared as a subroutine “library” shared by all users. Library: pull card decks from wall.
  6. Multiprogramming: 2 jobs (1 takes 10 hrs, the other 10 mins). Don’t have to wait 10 hrs! www.multicians.org lists 1777 people who “contributed to Multics”. Probably 30-40 core developers.
  7. Computers are friendly things: 1 terminal, feed me. Add another terminal, feed me. Can you keep doing this? NO! Eventually fall off a cliff (add one more user, computer slows down by a factor of 1000)
  8. No, Feature creep. PC made OS a subroutine all over again. But then realized even single users need memory protection, multiprogramming, etc. Same is true of PDAs and phones
  9. Why do we need distributed systems? Resource sharing (printers, Internet connections,…) and info sharing (files, email, IM, …)
  10. How many people have written a 1K program? 15 pages How many people have written a 10K program? 150 pages