1.a Introduction + 1.b History

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is an OS?

("In a very real sense the software provides the *character* of the system. Most PCs can run *one or more* operating systems and each one can have a very different look and feel." - D. A. Rusling, The Linux Kernel) 1.1

Zitat 2 about OS

("Operating systems turn ugly hardware into beautiful abstractions") 1.2

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) 1.3

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) 1.4

Definitions of Computer System Components

*CPU*: The hardware that executes instructions. *Processor*: A physical chip that contains one or more CPUs. *Core*: The basic computation unit of the CPU. *Multicore*: Including multiple computing cores on the same CPU. *Multiprocessor*: Including multiple processors. Although virtually all systems are now multicore, we use the general term CPU when referring to a single computational unit of a computer system and core as well as multicore when specifically referring to one or more cores on a CPU.

Multiprocessing Architecture: Symmetric (SMP)

- *One copy of the operating system in memory, but any CPU can run it.* - System call on a CPU, the CPU traps to the kernel and processes the syscall - One set of OS tables => dynamic balancing of memory and processes - No coordinator CPU bottleneck but two CPUs may run the OS code concurrently. - Synchronization for concurrent execution required [Chapter 04 - CPUs run different parts of the OS concurrently

I/O Structure

- After I/O starts, control returns to user program *only upon* I/O completion - Wait instruction idles the CPU until the next interrupt - Wait loop (contention for memory access) - At most one I/O request is outstanding at a time, no simultaneous I/O processing - After I/O starts, control returns to user program *without waiting* for I/O completion - System call - request to the OS to allow user to wait for I/O completion - Device-status table contains entry for each I/O device indicating its type, address, and state - OS indexes into I/O device table to determine device status and to modify table entry to include interrupt

What Operating Systems Do

- Depends on the point of view - Users want convenience, ease of use and good performance • Don't care about resource utilization - But shared computer such as mainframe or minicomputer must keep all users happy - Users of *dedicate systems* such as *workstations* have dedicated resources but frequently use shared resources from servers - Handheld computers 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

Computer System Operation (cont.), I/O

- I/O devices and the CPU can execute *concurrently* - Each device controller is in charge of a particular device type - Each device controller has a local buffer - *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*

Common Functions of Interrupts

- Interrupt transfers control to the interrupt service routine (ISR) generally, through the *interrupt vector*, which contains the addresses of all the service routines - Interrupt architecture must *save the address* of the interrupted instruction - A *trap* or *exception* is a software-generated interrupt caused either by an error or a user request - An operating system is *interrupt driven*

Summary and Q&A

- OS efficiently manage various resources (processes, memory, I/O, files, security) but also 'extend' machines with user abstractions: processes, address spaces, files. - OS can only execute programs in the main memory (the only large storage area that the processor can access directly). - Storage hierarchy ranges from small and fast but expensive (registers, caches) to larger, slower, but less expensive (main memory- volatile), to even larger, much slower, and much less expensive (disk - nonvolatile, magnetic tapes - nonvolatile). - The system hardware has two modes: user mode and kernel mode to prevent user programs from interfering with the proper operation of the system. • Switch to kernel mode: I/O control, timer management, and interrupt management. - Data structures that are used in an OS include lists, stacks, queues, trees, and maps. - Computing in a variety of environments: traditional computing, mobile computing, client- server systems, peer-to-peer systems, cloud systems, & real-time embedded systems. - Free and open-source operating systems are available in source-code format.

Operating System Definition (2)

- OS is a *control program* - Controls execution of programs to prevent errors and improper use of the computer

Operating System Definition

- OS is a resource allocator - OS is a resource allocator

Virtualization (2)

- Use cases involve laptops and desktops running multiple OSes for exploration or compatibility- Apple laptop running Mac OS X host, Windows as a guest => multi-mode OS - Developing apps for multiple OSes without having multiple systems- QA testing applications without having multiple systems- Executing and managing compute environments within data centers - VMM can run natively (not as guests), in which case they are the host - There is no general purpose host then (VMware ESX and Citrix XenServer)

I/O Structure: Direct Memory Access (DMA)

- 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

Mass-Storage Management

- Usually disks 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 - by OS or applications - Varies between WORM (write-once, read-many-times) and RW (read-write)

Multiprogramming

... started in 1965-1980 with 1965 IBM System/360 • Multiprogramming - Memory partitioned into several pieces, with a different job in each partition • Required special HW to protect each job against snooping and mischief by the other ones Job pool: data structure that allows OS to select which job to run next to increase CPU utilization • Mitigates the slow I/O vs. faster CPU by having the OS overlap the I/O of a currently executing job with computation of another job: - OS reads next job from card reader into a job queue - OS outputs printout of previous job from disk to printer • They were still batch systems, few hours needed between job submission and printed output; no interaction with the user • Time-sharing: a variant of multiprogramming with quick(er) response time => Interactive computing

Multiprocessing Architecture: Asymmetric (AMP)

A coordinator-worker asymmetric multiprocessor model. - Single copy of the operating system and its tables is present on CPU 1 and not on any of the others. -User processes shared (self-scheduling, load balancing) -Memory shared among all user processes -One buffer cache for disk block occupancy All system calls are redirected to CPU 1 for processing there. - CPU 1 may also run user processes if there is CPU time left over • May become bottleneck

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 is supported by multiplexing the CPUs among the processes / threads

1965-1980: Integrated Circuits and Multiprogramming Time-sharing => Interactive Computing

A time-shared OS allows many users to share the computer simultaneously • Uses CPU scheduling and multiprogramming to provide each user with a small portion of the computer - The CPU is multiplexed among several jobs that are kept in memory (aka processes) and on disk - The CPU is allocated to a job only if the job is in memory! - Job swapped in and out of memory to the disk => Job scheduling to decide which! - System must allocate memory to several jobs => Memory management needed - Job synchronization and communication, and deadlock mechanisms needed On-line communication between the user and the system is provided When the OS finishes the execution of one command, it seeks the next "control statement" not from a card reader, but from the user's keyboard • Keyboards: first means of interaction (I/O) between the user and the OS - On-line file system must be available for users to access data and code The file system resides on a collection of disks => Disk management needed

Virtualization (1)

Allows operating systems to run as applications within other OSes - Vast and growing industry[Useful and important - Emulation used when source CPU type different from target type (i.e. Apple's Rosetta for IBM PowerPC applications to execute on Intel x86) - Generally slowest method (machine-level instruction translation)- When computer language not compiled to native code - Interpretation - Virtualization - OS natively compiled for CPU, running guest OSes also natively compiled (initially to support concurrency on mainframes) - Consider VMware running WinXP guests, each running applications, all on native WinXP host OS - VMM (Virtual Machine Manager) provides virtualization services (e.g., VMware, VirtualBox, etc.)

Computing Environments: Peer-to-Peer

Another model of distributed systemP2P does not distinguish clients and servers - Instead, all nodes are considered peers - no centralized service- classical server is no longer bottleneck - Each may act as client, server or both - Node must join P2P network - Registers its service with central lookup service on network, or - Broadcast request for service and respond to requests for service via discovery protocol - Examples include file-sharing services (Napster and Gnutella), Voice over IP (VoIP) such as Skype (centralized login server, decentralized peers)

Computing Environments: Client-Server

Client-Server Computing: Special form of distributed computing - Dumb terminals supplanted by smart PCs - Many systems now servers, responding to requests generated by clients - Compute-server system provides an interface to client to request services (i.e., database); server executes action and sends results to client - File-server system provides interface for clients to store (create, update, read, delete) and retrieve files

Computing Environments: Cloud Computing (1)

Delivers computing, storage, even apps as a service across a network Logical extension of virtualization which is at the base for its functionality - Amazon EC2 has thousands of servers, millions of virtual machines, petabytes of storage available across the Internet, with pay based on usage Many types - Public cloud - available via Internet to anyone willing to pay- Private cloud - run by a company for the company's own use- Hybrid cloud - includes both public and private cloud components Many service types - Software as a Service (SaaS) - one or more applications available via the Internet (i.e., word processor) - Platform as a Service (PaaS) - software stack ready for application use via the Internet (i.e., a database server) - Infrastructure as a Service (IaaS) - servers or storage available over Internet (i.e., storage available for backup use)

Operating System Operations (cont.): Dual-mode

Dual-mode operation allows OS to protect itself and OS components - User mode and kernel mode- Mode bit provided by hardware - Provides ability to distinguish when system is running user code or kernel code - Some instructions designated as privileged, only executable in kernel mode- System call changes mode to kernel, return from call resets it to user - CPUs increasingly support multi-mode operations- i.e. virtual machine manager (VMM) mode for guest VMs [ Chapter 09 - i.e. Intel processors 4 protection rings, ARMv8 7 modes[ Chapter 02

Computing Environments: Traditional

Later half of 20th century, scarce computing resources Batch systems processed jobs in bulk Interactive systems waited for input from users Time-sharing systems shared time between multiple users (timer, scheduling algorithms) Today, stand-alone general purpose machines • But blurred as most systems interconnect with others (i.e., Internet) Portals provide web access to internal systems Network computers (thin clients) are like Web terminals Mobile computers sync with PCs & interconnect via wireless networks Networking becoming ubiquitous - even home systems use firewalls to protect home computers from security breaches (e.g., Internet attacks)

Clustered Systems

Like multiprocessor systems, but *multiple (multicore) systems* working together - Closely linked via a local-area network (LAN) or faster interconnect (InfiniBand) - Provides a high-availability service (via redundancy) to survive failures- Asymmetric clustering has one machine in hot-standby mode (monitoring the active server). - Symmetric clustering has multiple nodes running applications, monitoring each other (more than one application be available to run) - Some clusters are for high-performance computing (HPC) - Concurrent applications must be written to use parallelization - Some clusters over a wide-area network (WAN) have distributed lock manager (DLM) to avoid conflicting operations over data shared in the WAN - Usually sharing storage via a storage-area network (SAN) pool of storage

Storage Structure

Main memory - only large storage media that the CPU can access directly -Random access -Typically volatile (flüchtig) Secondary storage - extension of main memory that provides large nonvolatile storage capacity - *Hard 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 disks* - faster than hard disks, nonvolatile - Various technologies- Becoming more popular

Kernel Data Structures

Many similar to standard programming data structures: lists (double, single), stacks, queues, trees (binary search tree, balanced binary search tree), hash function -> hash maps, bitmap

Computer-System Architecture

Most systems use a single general-purpose processor - Most systems have special-purpose processors as well Multiprocessors systems growing in use and importance - Also known as parallel systems, tightly-coupled systems

A Multiprocessing Design: Non-Uniform Memory Access (NUMA)

Multiprocessor and multicore - CPUs connected by a shared system interconnect, share one physical address space - Fast access, no contention over system interconnect

Multiprocessors

Multiprocessors systems growing in use and importance - Also known as parallel systems, tightly-coupled systems- Advantages include: - Increased throughput - Economy of scale - Increased reliability - graceful degradation or fault tolerance - Two types: - - Asymmetric Multiprocessing (AMP) - each processor is assigned a special task. Symmetric Multiprocessing (SMP) - each processor performs all tasks

Operating System Operations: Multiprogramming (Batch system)

Multiprogramming (Batch system) 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 executed via *job scheduling* - When it has to wait (for I/O for example), OS switches to another job, and so on - CPU would idle in a non-multiprogrammed system- Think of lawyers (CPU) and clients (jobs) - No interactivity with user

Migration of data "A" from Disk to Register

Multitasking environments must be careful to use most recent value, no matter where it is stored in the storage hierarchy Multiprocessor environment must provide cache coherency in hardware such that all CPUs have the most recent value in their cache Distributed environment situation even more complex - Several copies of a datum can exist - Various solutions guarantee that when update to 1 replica, all other replicas are brought up to date as soon as possible

Operating System Definition (Cont.)

No universally accepted definition "Everything a vendor ships when you order an operating system" is a 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.

Operating System Definition (1)

OS is a *resource allocator* - Manages all resources - Decides between conflicting requests for efficient and fair resource use

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 directories- Mapping files onto secondary storage- Backup files onto stable (non-volatile) storage media

A Dual-Core Design

One processor chip and multicore - Each core with own register set and cache, locally shared L2 cache - Contention on bus to memory for N CPU cores.

I/O Subsystem

One purpose of OS is to hide peculiarities (Besonderheiten) 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

Open-Source Operating Systems

Operating systems made available in source-code format rather than just binary closed-source - Was the case between 1950-1980s Counter to the copy protection and Digital Rights Management (DRM) movement Started by Free Software Foundation (FSF) formed by Richard Stallman (1985), which has "copyleft" GNU Public License (GPL) (1) freedom to freely run the program(2) freedom to study and change the source code(3) freedom to give or sell copies with changes (4) freedom to give or sell copies without changes- Examples: GNU/Linux & BSD UNIX (including core of Mac OS X), and many more Can use VMM like, VMware Player (Free on Windows), Virtualbox (open source and free on many platforms - http://www.virtualbox.com) - Use VMM to run operating systems as guest for exploration

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 of attacks, 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 their controls to be managed, then also associated with each process, file - Privilege escalation allows user to change to effective ID with more rights

Computing Environments: Real-Time Embedded Systems

Real-time embedded systems most prevalent form of computers - Vary considerable, special purpose, limited purpose OS, real-time OS - Use expanding Many other special computing environments as well - Some have OSes, some perform tasks without an OS - Real-time OS has well-defined fixed time constraints - Processing must be done within constraint- Correct operation only if constraints met

Storage Hierarchy

Storage systems organized in hierarchy - Speed- Cost- Volatility Caching - copying information into faster storage system; main memory can be viewed as a cache for secondary storage Device Driver for each device controller to manage I/O - Provides uniform interface between controller and kernel

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

Transition from User to Kernel Mode: Timer

Timer to prevent infinite loop / process hogging resources while in user mode - Timer is set to interrupt the computer after some time period - fixed (1/250 second)- variable (1ms-1s) - Keep a counter that is decremented by the physical clock - Operating system sets the counter (privileged instruction) - When counter zero generate an interrupt - E.g., 10-bit counter, 1 ms clock, interrupts at intervals from 1 ms - 210 ms, with a step of 1 ms - Timer is set up before scheduling process to regain control or terminate program that exceeds allotted time - Instructions that modify the content of the timer are privileged

Operating System Operations: Timesharing (multitasking)

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 (=>process) executing in memory[management - 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 /larger than memory

Memory Management

To execute a program all (or part) of the instructions must be in memory All (or part) of the data that is needed by the program must be in memory. Memory management determines what is in memory and 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

Operating System Operations: Interrupt driven (hardware and software)

Waiting for something to happen; events triggered by an interrupt - Hardware interrupt by one of the devices - Software interrupt (exception or trap):- Software error (e.g., division by zero, invalid memory address)- Request for operating system service (system call)- Other process problems include infinite loop, processes modifying each other or the operating system

Computer Startup: bootstrap program

bootstrap program (initial program to run) is loaded at power-up or reboot - Typically stored in ROM or EPROM, generally known as *firmware* - Initializes all aspects of system- Loads operating system kernel and starts execution- Example GRUB (GRand Unified Bootloader)

Caching

copying information into faster storage system; main memory can be viewed as a cache for secondary storage - Important principle, performed at many levels in a computer (in hardware, operating system, software) - Information in use copied from slower to faster storage temporarily Faster storage (cache) checked first to determine if information is there - If it is, information used directly from the cache (fast) - If not, data copied to cache and used there - Cache smaller than storage being cached- Cache management important design problem - Cache size and replacement policy

Operating System Operations: Memory Layout for a Multiprogrammed System

job 1-4

Performance of Various Levels of Storage

see picture (Movement between levels of storage hierarchy can be explicit or implicit)

Computer system can be divided into four components: 3.

• 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

Computing Environments: Cloud Computing (2)

• Cloud computing environments composed of traditional OSes, plus VMMs, plus cloud management tools - Internet connectivity requires security like firewalls- Load balancers spread traffic across multiple applications

Computing Environments: Distributed

• Distributed computing - Collection of separate, possibly heterogeneous, systems networked together - Network is a communication path, TCP/IP most common - Local Area Network (LAN)- Wide Area Network (WAN)- Metropolitan Area Network (MAN) - Personal Area Network (PAN)- Network Operating System provides features between systems across network- Communication scheme allows systems to exchange messages - Illusion of a single system

Computing Environments: Mobile

• Handheld smartphones, tablets, etc. • Portable, lightweight - What is the functional difference between them and a "traditional" laptop? - Extra / more OS features (GPS, accelerometers, gyroscope, music, video, images, books) - Allows new types of apps like navigation, augmented reality - Use IEEE 802.11 wireless, or cellular data networks for connectivity - Power consumption is a high concern - Limited memory and storage capacity - Smaller processors, slower processing speed - Leaders are Apple iOS and Google Android

Computer system can be divided into four components: 1.

• Hardware - provides basic computing resources - CPU, memory, I/O devices

Computer system can be divided into four components: 2.

• Operating system- Controls and coordinates use of hardware among various applications and users

Summary and Q&A: history

• Operating systems long (hi)story: from human operators to modern multiprogramming Human programmers and operators (1940-155) Early batch systems (1955-1965) Multiprogramming systems (1965-1980) Personal computing systems (1980-present) • Including mobile devices (1990-present) • Major milestones in the development of systems and operating systems• Batching, multiprogramming, time-sharing, interactivity (keyboard, mouse, GUI) • Computing architectures development influences operating systems development• Ontogeny Recapitulates Phylogeny: changes in technology may bring obsolete concepts back • Influential operating systems: MS-DOS, MULTICS, UNIX, MINIX, Linux, Windows, iOS, Android. This ends the history of OS. Now we transition to concepts and their implementation.

Computer system can be divided into four components: 4.

• Users- People, machines, other computers


Kaugnay na mga set ng pag-aaral

История Казахстана 1-650

View Set

PSY 328 Cognitive Psych. Quiz 7 (Chp 13)

View Set

Managerial Accounting Chapter 10

View Set

Problem Solving, Unit Conversion, and Dimensional Analysis

View Set

BLUM Ch1. Exploring Linux command line tools

View Set