Module 1: Introduction Silberschatz and Galvin 1999 1.2 Operating System Concepts What is an 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. Silberschatz and Galvin 1999 1.3 Operating System Concepts Computer System Components 1. Hardware provides basic computing resources (CPU, memory, I/O devices). 2. Operating system controls and coordinates the use of the hardware among the various application programs for the various users. 3. Applications programs define the ways in which the system resources are used to solve the computing problems of the users (compilers, database systems, video games, business programs). 4. Users (people, machines, other computers). Silberschatz and Galvin 1999 1.4 Operating System Concepts Abstract View of System Components Silberschatz and Galvin 1999 1.5 Operating System Concepts Operating System Definitions Resource allocator manages and allocates resources. Control program controls the execution of user programs and operations of I/O devices . Kernel the one program running at all times (all else being application programs). Silberschatz and Galvin 1999 1.6 Batch Operating system operating system which analyzes your i/p and groups them into batches . data in each batch is of similar characteristics. And then it performs operation on each individual batch. Reduce setup time by batching similar jobs Automatic job sequencing automatically transfers control from one job to another. First rudimentary operating system. the CPU is idle (or nearly so) during these relatively slow operations. EXAMPLE OF BATCH OPERATING SYSTEM IS AS FOLLOWS..
1) DOS (Disk operating system) 2) IBM OS/2 3) Windows 1,2,3 95, 98
Operating System Concepts Silberschatz and Galvin 1999 1.7 Batch system Operating System Concepts Silberschatz and Galvin 1999 1.8 Operating System Concepts Memory Layout for a Simple Batch System Silberschatz and Galvin 1999 1.9 vantages of Advantages 1.Batch processing takes much of the work of the operator to the computer. 2. Increased performance as a new job get started as soon as the previous job finished without any manual intervention.
Disadvantages 1.Difficult to debug program. 2.A job could enter an infinite loop. 3.Due to lack of protection scheme, one batch job can affect pending jobs. the operator to the computer. Increased performance as a new job get started as soon as the previous job finished without any manual intervention. Disadvantages Difficult to debug program.
Operating System Concepts Silberschatz and Galvin 1999 1.10 Operating System Concepts Multiprogrammed Batch Systems Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them. Silberschatz and Galvin 1999 1.11 Operating System Concepts OS Features Needed for Multiprogramming I/O routine supplied by the system. Memory management the system must allocate the memory to several jobs. CPU scheduling the system must choose among several jobs ready to run. Allocation of devices. Silberschatz and Galvin 1999 1.12 Multitasking Operating System Concepts Silberschatz and Galvin 1999 1.13 Multitasking(Time-sharing systems) Multitasking refers to term where multiple jobs are executed by the CPU simultaneously by switching between them. Switches occur so frequently that the users may interact with each program while it is running. Operating system does the following activities related to multitasking. it The user gives instructions to the operating system or to a program directly, and receives an immediate response. OS can handle multiple operations / executes multiple programs at a time. developed to provide interactive use of a computer system at a reasonable cost. uses concept of CPU scheduling and multiprogramming to provide each user with a small portion of a time-shared CPU. Each user has at least one separate program in memory.
Operating System Concepts Silberschatz and Galvin 1999 1.14 A program that is loaded into memory and is executing is commonly referred to as a process. When a process executes, it typically executes for only a very short time before it either finishes or needs to perform I/O. Operating System Concepts Silberschatz and Galvin 1999 1.15 Operating System Concepts 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. Well-defined fixed-time constraints. Hard real-time system. These systems are implemented in hardware as well as software. missing a deadline is a total system failure. Example uses include triggering airbag deployment in automobile crashes, and monitoring the heart rate of a patient during an operation. Time constrain is important Soft real-time system Useful in applications (multimedia, virtual reality) requiring advanced operating-system features. the usefulness of a result degrades after its deadline, thereby degrading the system's quality of service.
Silberschatz and Galvin 1999 1.16 Distributed Systems Distribute the computation among several physical processors. Loosely coupled system 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. Resources Sharing Computation speed up load sharing Reliability Communications
Operating System Concepts Silberschatz and Galvin 1999 1.17 Distributed Systems (Cont.) Network Operating System provides file sharing provides communication scheme Facility to provide proper authentication Option for message routing runs independently from other computers on the network Distributed Operating System Facility to communicate with remote machines Provides Less autonomous environment gives the impression there is a single operating system controlling the network. Provide mechanism for security and message routing
Operating System Concepts Silberschatz and Galvin 1999 1.18 Operating System Concepts Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System Design and Implementation System Generation Silberschatz and Galvin 1999 1.19 OS structure Important aspect of OS Multiprogramming Increase CPU utilization time sharing system-require interactive computer system Response time should be short Process-program loaded into the memory and id being executed Job pool contain all processes residing on disk awaiting allocation of main memory If there is no enough space for them the system must choose among them, it is done by Job scheduling Several programs in memory at same time-memory management If several jobs are ready to run at same time, system must choose among them- CPU scheduling Time sharing OS require swapping-processes are swapped in and out of main memory to disk
Operating System Concepts Silberschatz and Galvin 1999 1.20 Operating System Concepts Functions of OS 1. Process Management 2. Main Memory Management 3. Secondary-Storage Management 4. I/O System Management 5. File Management 6. Protection System 7. Networking 8. Command-Interpreter System Silberschatz and Galvin 1999 1.21 Operating System Concepts 1.Process Management A process is a program loaded into memory and is executing. A process needs certain resources, including CPU time, memory, files, and I/O devices, to accomplish its task. The operating system is responsible for the following activities in connection with process management. Process creation and deletion. process suspension and resumption. Provision of mechanisms for: process synchronization process communication Silberschatz and Galvin 1999 1.22 Operating System Concepts 2.Memory Management 1. Main-Memory Management-Memory is a large array of words or bytes, each with its own address. It is a repository of quickly accessible data shared by the CPU and I/O devices. Main memory is a volatile storage device. It loses its contents in the case of system failure. The operating system is responsible for the following activities in connections with memory management: Keep track of which parts of memory are currently being used and by whom. Decide which processes to load when memory space becomes available. Allocate and deallocate memory space as needed. Silberschatz and Galvin 1999 1.23 Operating System Concepts Memory Management(cont..) 2.Secondary-Storage Management- Since main memory (primary storage) is volatile and too small to accommodate all data and programs permanently, the computer system must provide secondary storage to back up main memory. Most modern computer systems use disks as the principle on-line storage medium, for both programs and data. The operating system is responsible for the following activities in connection with disk management: Free space management Storage allocation Disk scheduling Silberschatz and Galvin 1999 1.24 Operating System Concepts 3.I/O System Management Access to different devices are permitted only through OS. in UNIX systems ,Device specifications are hidden from OS itself, and here the device are managed by I/O subsystem. The I/O subsystem consists of: Keep track of which device are allocated on which process A general device-driver interface Drivers for specific hardware devices
Silberschatz and Galvin 1999 1.25 Operating System Concepts 4.Storage management 1. File Management-A file is a collection of related information defined by its creator. Commonly, files represent programs (both source and object forms) and data. The operating system is responsible for the following activities in connections with file management: File creation and deletion. Directory creation and deletion. Support of primitives for manipulating files and directories. Mapping files onto secondary storage. File backup on stable (nonvolatile) storage media. Silberschatz and Galvin 1999 1.26 Storage management(cont..) 2.mass storage management- secondary storage to backup main memory Compilers, assemblers, word processors, editors etc are stored on a disk until loaded into memory and then use the disk as both source and destination of their processing Activities performed with disk management are as follows 1. Free-space management 2. Storage allocation 3. Disk scheduling
Operating System Concepts Silberschatz and Galvin 1999 1.27 Operating System Concepts 5. Protection System Protection refers to a mechanism for controlling access by programs, processes, or users to both system and user resources. The protection mechanism must: distinguish between authorized and unauthorized usage. specify the controls to be imposed. provide a means of enforcement. Silberschatz and Galvin 1999 1.28 Operating System Concepts 6.Networking (Distributed Systems) A distributed system is a collection processors that do not share memory or a clock. Each processor has its own local memory. The processors in the system are connected through a communication network. A distributed system provides user access to various system resources. Provide facility for communicating with system Message forwarding Access to a shared resource allows: Computation speed-up Increased data availability Enhanced reliability Silberschatz and Galvin 1999 1.29 Operating System Concepts 7.Command-Interpreter System Many commands are given to the operating system by control statements which deal with: process creation and management I/O handling secondary-storage management main-memory management file-system access protection networking Silberschatz and Galvin 1999 1.30 Operating System Concepts Command-Interpreter System (Cont.) The program that reads and interprets control statements is called variously: command-line interpreter shell (in UNIX) Its function is to get and execute the next command statement.
Silberschatz and Galvin 1999 1.31 Operating System Concepts Operating System Services OS provides some services that are helpful for the users 1. User Interface-such as Dtrace command line(text commands),batch interface(commands and directives to control those commands are into files),graphical user interfaces(GUI) 2. Program execution system capability to load a program into memory and to run it. 3. I/O operations since user programs cannot execute I/O operations directly, the operating system must provide some means to perform I/O. 4. File-system manipulation program capability to read, write, create, and delete files. Silberschatz and Galvin 1999 1.32 OS services(conti..) 5. Communications exchange of information between processes executing either on the same computer or on different systems tied together by a network. Implemented via shared memory or message passing. 6. Error detection ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs. Operating System Concepts Silberschatz and Galvin 1999 1.33 A view of operating system services Operating System Concepts Silberschatz and Galvin 1999 1.34 Operating System Concepts Additional Operating System Functions Additional functions exist not for helping the user, but rather for ensuring efficient system operations. 1. Resource allocation allocating resources to multiple users or multiple jobs running at the same time. 2. Accounting keep track of and record which users use how much and what kinds of computer resources for account billing or for accumulating usage statistics. 3. Protection ensuring that all access to system resources is controlled.
Silberschatz and Galvin 1999 1.35 Operating System Concepts System Calls System calls provide the interface between a running program and the operating system. Generally available as C,C++, assembly-language instructions. Silberschatz and Galvin 1999 1.36 sequence of system calls required to copy a file: Operating System Concepts Silberschatz and Galvin 1999 1.37 The handling of a user application invoking the open( ) system call Operating System Concepts Silberschatz and Galvin 1999 1.38 Three general methods are used to pass parameters between a running program and the operating system. Pass parameters in registers. Store the parameters in a table in memory, and the table address is passed as a parameter in a register. Push (store) the parameters onto the stack by the program, and pop off the stack by operating system.
Operating System Concepts Silberschatz and Galvin 1999 1.39 Passing of parameters as a table Operating System Concepts Silberschatz and Galvin 1999 1.40 Operating System Concepts Silberschatz and Galvin 1999 1.41 Operating System Concepts Silberschatz and Galvin 1999 1.42 Operating System Concepts Silberschatz and Galvin 1999 1.43 `` Operating System Concepts Silberschatz and Galvin 1999 1.44 System Programs
Provides environment for program development and execution provide OS functionality through separate applications, which are not part of the kernel or command interpreters. They are also known as system utilities or system applications. Most systems also ship with useful applications such as calculators and simple editors, ( e.g. Notepad ). Some debate arises as to the border between system and non- system applications.
Operating System Concepts Silberschatz and Galvin 1999 1.45 System programs may be divided into 7 categories:
1. File management - programs to create, delete, copy, rename, print, list, and generally manipulate files and directories. 2. Status information - Utilities to check on the date, time, number of users, processes running, data logging, etc. System registries are used to store and recall configuration information for particular applications. 3. File modification - e.g. text editors and other tools which can change file contents. 4. Programming-language support - E.g. Compilers, linkers, debuggers, profilers, assemblers, library archive management, interpreters for common languages, and support for make. 5. Program loading and execution - loaders, dynamic loaders, overlay loaders, etc., as well as interactive debuggers. 6. Communications - Programs for providing connectivity between processes and users, including mail, web browsers, remote logins, file transfers, and remote command execution. 7. Background services - System daemons are commonly started when the system is booted, and run for as long as the system is running, handling necessary services. Examples include network daemons, print servers, process schedulers, and system error monitoring services.
Operating System Concepts Silberschatz and Galvin 1999 1.46 Most operating systems today also come complete with a set of application programs to provide additional services, such as web browsers, word processor, compiler, spreadsheets, games. views of the OS seen by most users is defined by the application programs and system programs, rather than by system calls.
Operating System Concepts Silberschatz and Galvin 1999 1.47 Operating-System Structure
1.Simple Structure E.g.:- MS-DOS It was written by a few programmers in a relatively short amount of time, without the benefit of modern software engineering techniques, and then gradually grew over time to exceed its original expectations. It does not break the system into subsystems has no distinction between user and kernel modes, allowing all programs direct access to the underlying hardware Operating System Concepts Silberschatz and Galvin 1999 1.48 Operating System Concepts MS-DOS Layer Structure Silberschatz and Galvin 1999 1.49 The original UNIX OS used a simple layered approach, but almost all the OS was in one big layer, not really breaking the OS down into layered subsystems:
Operating System Concepts Silberschatz and Galvin 1999 1.50 Operating System Concepts Silberschatz and Galvin 1999 1.51 2.Layered Approach Operating System Concepts Silberschatz and Galvin 1999 1.52 Layered Approach Another approach is to break the OS into a number of smaller layers, each of which rests on the layer below it, and relies solely on the services provided by the next lower layer. This approach allows each layer to be developed and debugged independently, with the assumption that all lower layers have already been debugged and are trusted to deliver proper services. The problem is deciding what order in which to place the layers, as no layer can call upon the services of any higher layer Layered approaches can also be less efficient, as a request for service from a higher layer has to filter through all lower layers before it reaches the HW, possibly with significant processing at each step.
Operating System Concepts Silberschatz and Galvin 1999 1.53 3.Micro kernels
The basic idea behind micro kernels is to remove all non-essential services from the kernel, and implement them as system applications instead, thereby making the kernel as small and efficient as possible. Most micro kernels provide basic process and memory management, and message passing between other services, and not much more. Security and protection can be enhanced, as most services are performed in user mode, not kernel mode. System expansion can also be easier, because it only involves adding more system applications, not rebuilding a new kernel. Mach was the first and most widely known microkernel, and now forms a major component of Mac OSX. Windows NT was originally microkernel, but suffered from performance problems relative to Windows 95. NT 4.0 improved performance by moving more services into the kernel, and now XP is back to being more monolithic. Another microkernel example is QNX, a real-time OS for embedded systems.