Chapter 1: Introduction What is an Operating System? Batch Systems Time Sharing Systems Personal Computer Systems Parallel or Multiprocessor Systems Distributed Systems Real -Time Systems Handheld Systems What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware (manages a computer’s hardware). Provides an environment in which a user can execute programs Operating system is an interface between user and hardware, between application program and hardware and between two programs. 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 Computer system can be divided into four components (see next slide): Hardware – provides basic computing resources CPU, memory, I/O devices Operating system Controls and coordinates use of hardware among various applications and users (e.g. Windows, Linux) Application programs – define the ways in which the system resources are used to solve the computing problems of the users Word processors, compilers(C, C++, Java), web browsers, database systems, video games Users People, machines, other computers Abstract View of System Components Operating System Definitions OS is a resource allocator Manages and allocates all resources (CPU time, memory space, file-storage space, I/O devices, etc.) Decides between conflicting requests for efficient and fair resource use OS is a control program Controls execution of programs to prevent errors and improper use of the computer (control operations of I/O devices) Parts of the OS The one program running at all times on the computer is the kernel. Shell – Operating systems such as Windows and Unix include a command interpreter as a special program. It is an interface between user and the kernel which can also be used to start an application program. Graphical User Interface (GUI) is an alternative interface for the OS. Everything else is either a system program (ships with the operating system), or an application program. Kernel Services I/O Management Process Management Memory Management File Systems Management Device Drivers Management System Calls (Application Program Interface) Interprocess Communication Protection System Networking Computer Startup Small piece of code – bootstrap program is loaded at power-up or reboot Typically stored in ROM or EEPROM (electrically erasable programmable ROM), generally known as firmware Initializes all aspects of system Loads operating system kernel and starts execution Computer System Organization Modern general purpose Computer-system consist of One or more CPUs, device controllers (disk controller, USB controller, memory controller, etc.) connected through common bus providing access to shared memory CPU and the device controllers can execute in parallel (concurrently), competing for memory cycles Memory controller synchronizes access to the memory to ensure orderly accessing memory controller Simple Batch Systems A fairly simple operating system was used. An operator other than the user was used. A card reader was used as input device. CPU is generally idle due to low speeds of mechanical I/O devices compared to those of electronic ones (e.g. slow punch card reader). Processing speed is increased by batching similar jobs together and run them as a group. Automatic job sequencing allows transfer of control from one job to another. Spooling Spooling: Simultaneous Peripheral Operation on-line Jobs are not read directly into memory but onto the disk. Since reading is time consuming, some other jobs can be performed during reading. Overlap I/O of one job with computation of another job. While executing one job, the OS: Reads next job from card reader into a storage area on the disk (job queue). Outputs printout of previous job from disk to printer The main goal is to reduce CPU idle time, since I/O speed is slower than CPU speed By spooling technique a printer could be used by users without waiting Multiprogrammed Batch Systems Several jobs are kept in main memory at the same time which is known as job pool. The operating system picks one job from memory to execute. When a job has to wait(e.g. for an input), operating system switches to another job. Eventually, the first job finishes waiting and gets the CPU back. OS Features Needed for Multiprogramming In multiprogramming systems there are several jobs in memory at the same time. When the operating system selects a job from the job pool, it loads that job into memory for execution. 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 Memory management – the system must allocate the memory to several jobs. CPU scheduling – the system must choose among several ready to run jobs. The system must know their exact locations in memory. Management of devices - including allocation , disk storage and memory management. Time-Sharing (multitasking) Systems–Interactive Computing A time-shared OS uses CPU scheduling and multiprogramming that provides each user a small portion of time. The CPU is multiplexed among several jobs that are kept in memory and on disk (the CPU is allocated to a job only if the job is in memory). The CPU is switched among multiple jobs so frequently that the users may interact with each program during execution. A job swapped in and out of memory to the disk. On-line communication between the user and the system is provided Time-sharing also compensates for low-speed I/O operations such as low-speed keyboard typing. A time-shared operating system allows many users to share the computer simultaneously (multiuser). Note: A program loaded into memory and executing is called a process, job or task (will be explained later). Personal Computer Systems Personal computers – computer system dedicated to a single user. I/O devices – keyboards, mice, display screens, small printers. Can adopt technology developed for larger operating system (different technologies can be adapted). May run several different types of operating systems (Windows, MacOS, UNIX, Linux) Client PCs, printers, servers Parallel or Multiprocessor Systems Multiprocessor systems have more than one CPU in close communication. Tightly coupled system – processors share memory and other resources; communication usually takes place through the shared memory. Advantages of parallel systems: Increased throughput: More work is done in the same time period. Increasing processors by n does not mean decreasing operation time by n. Economical: Shared peripherals and power supplies. Several programs can be run on same set of data on a shared disk Increased reliability • fail-soft systems. The failure of one processor does not halt the system. The rest continues to do the task • graceful degradation: The ability to continue providing service proportional to the level of surviving hardware. Parallel Systems (Cont.) Asymmetric multiprocessing Each processor is assigned a specific task; master processor schedules and allocates work to slave processors. More common in extremely large systems Symmetric multiprocessing (SMP) Each processor performs all tasks within the operating system All proccesors are peers, no mater-slave reationship Most modern operating systems support SMP Symmetric Multiprocessing Architecture multiple chips with single core (single core on the chip) A Dual-Core Design Multiple computing cores on a single chip - multicore More efficient than multiple chips with single core because onchip communication is faster than between-chip communication Figure shows dual-core design with two cores on the same chip Distributed Systems Distribute the computation among several physical processors referred to as sites, nodes, computers etc. Unlike tightly-coupled parallel systems, these are Loosely coupled systems each processor has its own local memory processors communicate with one another through various communications lines, such as high-speed buses or telephone lines. Advantages of distributed systems(DS). Resources Sharing (printers, files etc.) Computation speed up – load sharing (if there is an overloading on a site) Reliability (if one site fails in a DS, the remaining sites can potentially continue operating) Communications – information exchange Distributed Systems (cont) Requires networking infrastructure. Collection of separate, possibly heterogeneous, systems networked together Network is a communications path, TCP/IP is most common Personal Area Network (PAN) Local Area Network (LAN) Metropolitan Area Network (MAN) Wide Area Network (WAN) Internet Communication scheme allows systems to exchange messages Illusion of a single system Distributed systems may be either client-server systems or peer-to-peer systems Distributed System StructuresGeneral Structure of Client-Server Client-Server Computing Clients: PCs and mobile devices Servers: Systems responding to requests generated by clients Compute-server system provides an interface to which a client may send a request to perform an action (e.g. database) File-server system provides interface for clients to store and retrieve files (webserver) Peer-to-Peer Computing Another model of distributed system P2P does not distinguish clients and servers Instead all nodes are considered peers May each 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 Napster and Gnutella, Voice over IP (VoIP) such as Skype. It allows clients to make voice calls and video calls and to send text messages over the Internet. Real-Time Embedded Systems Embedded systems run real-time operating systems. Generally there is no user interface. They perform managing and monitoring of the hardware. Real-time systems often used as a control device in a dedicated application such as controlling scientific experiments, medical imaging systems, industrial control systems, and some display systems (car engines, manufacturing robots, DVDs, microwave ovens, firewalls,etc.) with little or no user interface Real-time OS has well-defined fixed time constraints Processing must be done within the defined constraint(in small time interval). Data brought by sensors to the computer, must be analyzed and corresponding control adjustments must be done in a small time interval Correct operation only if constraints met Mobile Systems Personal Digital Assistants (PDAs) Handheld smartphones, tablets, etc Use IEEE 802.11 wireless, or cellular data networks for connectivity Leaders are Apple iOS and Google Android Issues: Limited memory Slow processors Small display screens. History of Operating Systems First Generation: *1945-1955 *Vacuum Tubes *OS: Plugboards Second Generation: *1955-1965 *Transistors *OS: Batch Systems Third Generation: *1965-1980 *Integrated circuits *OS: Multiprogramming Fourth Generation: *1980-present *Large scale integration *Personal computers *OS: personal systems Next Generation: *???? *System connected to high speed networks *Wide area resource control *OS: net-centric computing, embedded systems.