IT 3123 and Software Concepts Notice: This session is being recorded. Operating Systems I March 17 Copyright 2005 by Bob Brown Operating System and Application Application program: solves specific problems or performs specific functions Payroll Word processing Web server Operating system: supports the application by providing user interfaces, hardware interfaces, and resource management The hardware and the OS together define a virtual machine. Bare Bones Computer System Integrated Computer Environment Does not load instructions into main memory No user interface except for I/O routines provided with executing program Is idle (or busy waiting) when waiting for user input No facility to store, retrieve, or manipulate files No ability to control peripheral devices Can run only one program at a time Operating System Basic Act as an interface between the user and the system Accept commands and requests from a user and a user s program (interface between application program and hardware.) Manage, load, and execute programs Manage hardware resources of the computer Additional Provides a means of starting the computer Bootstrapping or booting the computer (also called Initial Program Load, or IPL) Provides file system services Handles all interrupt processing Provides I/O support services 1
Additional Provides interfaces for the user s programs Provides network services Provides tools and services for concurrent processing Required for Concurrent Processing Allocates resources such as memory, CPU time, and I/O devices to programs Protects users and programs from each other (with help from the hardware) Provides for inter-program communication Provides feedback to the system administrators to permit performance optimization of the computer system Memory-Resident OS Parts Memory Resident: always loaded in memory Commonly called the kernel Contains essential services required by other parts of the operating system and applications. Typically responsible for managing memory management, processes and tasks, and secondary storage Non Memory-Resident Applications Infrequently used programs, software tools, and commands These are loaded by the kernel as needed Thin Clients Diskless workstations or thin clients Programs, including the OS, are located on another computer on the network Programs run in the memory of the diskless workstation Program loading takes place over the network. Operating System User Command Interface File Core I/O Application Network Computer Network 2
OS Degree of Activity Interactive Also known as conversational systems Batch processing User submits programs or jobs for processing Little to no user interaction Event driven Interrupts or service requests and the OS A hardware platform may support a variety of operating systems An operating system may work on a variety of platforms and the OS A standard operating system that works on different hardware platforms: Provides program and file portability Enables user efficiency through recognizable interface Is (mostly) implemented through a systems programming language like C or C++ as opposed to assembly language Single Job Processing Only one program is loaded into memory and executed Example: MS-DOS Memory resident components Command interface shell I/O routines, including BIOS File management system User program in control OS Regains Control When program is finished control is transferred back to the command interpreter If the user s program requests I/O The user wishes to stop the program execution via a keyboard interrupt System malfunctions Single Job Processing Disadvantages Lack of security Programs can overwrite the resident OS Programs can write directly to I/O devices System provides minimum memory management and no scheduling CPU is often idle awaiting the completion of I/O operations 3
Concurrent Operations Multitasking (multiprogramming) vs. multiprocessing which implies multiple CPUs Concurrent processing vs. simultaneous processing Achieving Multitasking While one program is waiting for I/O to take place, another program is using the CPU to execute instructions. Interrupts notify CPU and OS when I/O is complete. Time-slicing: The CPU may be switched rapidly back and forth between different programs (Clock interrupts) Dispatching is the process of selecting which program to run at any given instant Sharing the CPU during I/O Breaks I/O represents a large percentage of a typical program s execution Time-sharing the CPU Time slicing Program Dispatching Running CPU Available I/O Request Time Expired Waiting Ready I/O Complete (This is a state transition diagram. ) Logical Equivalence of and Software Specialized hardware can be built to perform any function that can be implemented in software Software can be written to perform any function that hardware can perform. But, there has to be some hardware to run the software. 4
What the OS Needs from the Privileged instructions Protected memory A timer (clock) that can generate interrupts. Privileged Instructions Some instructions (like I/O) instructions are reserved for the operating system. A mode bit in the CPU s status word is set when the OS is in control Privileged instructions work when the mode bit is set and generate an illegal instruction interrupt when it is not. Protected Memory If any program can write to any memory location, a malicious or defective user program can damage OS code or data. Two ways to protect memory: Memory keys. These are bits like a mode bit attached to blocks of memory Virtual address spaces A Timer Generates Interrupts The OS gets control whenever an application program requests I/O services What if an application program never requests I/O services? Part of the hardware is a timer. It generates an interrupt at (short) intervals. The OS gets control to handle the interrupt. Can cut off a long-running program. Questions 5