Operating Systems

Cards (304)

  • Silberschatz, Galvin and Gagne ©2018
  • Operating System
    A program that acts as an intermediary between a user of a computer and the computer hardware
  • Operating system 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
  • Computer system components
    • Hardware
    • Operating system
    • Application programs
    • Users
  • Operating system is a resource allocator and control program making efficient use of HW and managing execution of user programs
  • Mobile user interfaces such as touch screens, voice recognition
  • Some computers have little or no user interface, such as embedded computers in devices and automobiles
  • Today's OSes for general purpose and mobile computing also include middleware – a set of software frameworks that provide additional services to application developers such as databases, multimedia, graphics
  • Interrupt
    Transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines
  • An operating system is interrupt driven
  • Trap or exception
    A software-generated interrupt caused either by an error or a user request
  • Bootstrap program is loaded at power-up or reboot
  • Main memory
    Only large storage media that the CPU can access directly
  • Secondary storage
    Extension of main memory that provides large nonvolatile storage capacity
  • Hard Disk Drives (HDD)

    • 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
  • Non-volatile memory (NVM) devices

    • Faster than hard disks, nonvolatile
    • Various technologies
    • Becoming more popular as capacity and performance increases, price drops
  • Device Driver for each device controller to manage I/O
  • Caching – copying information into faster storage system; main memory can be viewed as a cache for secondary storage
  • Direct Memory Access (DMA) is used for high-speed I/O devices able to transmit information at close to memory speeds
  • Operating-System Operations
    1. Bootstrap program – simple code to initialize the system, load the kernel
    2. Kernel loads
    3. Starts system daemons (services provided outside of the kernel)
  • I/O
    Provides uniform interface between controller and kernel
  • Storage-Device Hierarchy
  • How a Modern Computer Works
  • Direct Memory Access Structure
    1. Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention
    2. Only one interrupt is generated per block, rather than the one interrupt per byte
  • Operating-System Operations
    1. Bootstrap program – simple code to initialize the system, load the kernel
    2. Kernel loads
    3. Starts system daemons (services provided outside of the kernel)
    4. Kernel interrupt driven (hardware and software)
  • Multiprogramming (Batch system)
    1. Single user cannot always keep CPU and I/O devices busy
    2. Multiprogramming organizes jobs (code and data) so CPU always has one to execute
    3. A subset of total jobs in system is kept in memory
    4. One job selected and run via job scheduling
    5. When job has to wait (for I/O for example), OS switches to another job
  • Multitasking (Timesharing)

    1. A logical extension of Batch systems– the CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing
    2. Response time should be < 1 second
    3. Each user has at least one program executing in memory (process)
    4. If several jobs ready to run at the same time CPU scheduling
    5. If processes don't fit in memory, swapping moves them in and out to run
    6. Virtual memory allows execution of processes not completely in memory
  • Memory Layout for Multiprogrammed System
  • Dual-mode Operation

    • Allows OS to protect itself and other system components
    • User mode and kernel mode
    • Mode bit provided by hardware
    • Provides ability to distinguish when system is running user code or kernel code
    • When a user is running mode bit is "user"
    • When kernel code is executing mode bit is "kernel"
    • System call changes mode to kernel, return from call resets it to user
    • Some instructions designated as privileged, only executable in kernel mode
  • Timer
    1. Timer to prevent infinite loop (or process hogging resources)
    2. Timer is set to interrupt the computer after some time period
    3. Keep a counter that is decremented by the physical clock
    4. Operating system set the counter (privileged instruction)
    5. When counter zero generate an interrupt
    6. Set up before scheduling process to regain control or terminate program that exceeds allotted time
  • Process
    A program in execution. It is a unit of work within the system. Program is a passive entity; process is an active entity.
  • Process Management Activities
    • 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
  • Memory Management

    • 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
  • File-system Management
    • Provides uniform, logical view of information storage
    • Abstracts physical properties to logical storage unit - file
    • Creating and deleting files and directories
    • Primitives to manipulate files and directories
    • Mapping files onto secondary storage
    • Backup files onto stable (non-volatile) storage media
  • Mass-Storage Management

    • Mounting and unmounting
    • Free-space management
    • Storage allocation
    • Disk scheduling
    • Partitioning
    • Protection
  • Caching
    • Information in use copied from slower to faster storage temporarily
    • Faster storage (cache) checked first to determine if information is there
    • Cache smaller than storage being cached
    • Cache management important design problem
    • Cache size and replacement policy
  • Characteristics of Various Types of Storage
  • Migration of data "A" from Disk to Register
  • I/O Subsystem
    • Memory management of I/O including buffering, caching, spooling
    • General device-driver interface
    • Drivers for specific hardware devices
  • 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
    • 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