Basic Concepts Protection: Security: Mechanism for controlling the access of a processes or users to the resources defined by computer. Security: Process to defend the system from external or internal attacks.
Process Management Process creation and deletion. A process is a program in execution. 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
Common System Components Process Management Main Memory Management File Management I/O System Management Secondary Management Networking Protection System Command-Interpreter System
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.
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.. Mapping files onto secondary storage. File backup on stable (nonvolatile) storage media.
I/O System Management The I/O system consists of: A buffer-caching system A general device-driver interface Drivers for specific hardware devices
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
Networking (Distributed Systems) The processors in the system are connected through a communication network. Communication takes place using a protocol. A distributed system provides user access to various system resources. Access to a shared resource allows: Computation speed-up Increased data availability Enhanced reliability
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.
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
Operating System Services Program execution – system capability to load a program into memory and to run it. I/O operations – since user programs cannot execute I/O operations directly, the operating system must provide some means to perform I/O. File-system manipulation – program capability to read, write, create, and delete files.
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. Error detection – ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs.
Additional Operating System Functions Additional functions exist not for helping the user, but rather for ensuring efficient system operations. Resource allocation – allocating resources to multiple users or multiple jobs running at the same time. 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. Protection – ensuring that all access to system resources is controlled.
Real work is done in the kernel OS Kernel Users Applications Operating System API, AUI Operating System Kernel Computer Hardware Real work is done in the kernel
Entry Points into Kernel System Call Signal Interrupt Trap
System Calls An important task of an operating system is to provide black-box functions for the most frequently needed operations, so that users do not have to waste their time programming very low level code which is irrelevant to their purpose. These ready-made functions comprise frequently used code and are called system calls.
User processes must not be given open access to the kernel code System Calls User processes must not be given open access to the kernel code The system call interface layer contains entry point in the kernel code Any user or application request that involves access to any system resource must be handled by the kernel code
Information maintenance Communications Types Of System Calls Process Control File Management Device Management Information maintenance Communications
System Call Execution The user program makes a call to a library function. Library routine puts appropriate parameters at a well-known place (registers, stack, or a table in memory).(Call number) The trap instruction is executed to change mode from user to kernel. Control goes to operating system. Operating system determines which system call is to be carried out.
Semantics of System Call Execution … Kernel indexes the dispatch table, which contains pointers to service routines for system calls. Service routine is executed and return parameter or error code placed at well-known places (usually a CPU register). Control given back to user program. Library function executes the instruction following trap.
System Call … Process Call Library System Call trap Service Code Dispatch Table Service Code Kernel Code
Signal A signal is an event transmitted between one process and another process. In case of a signal, the process can take one of the three possible actions: default as defined by the OS, ignore the signal, or take a programmer specified action.
Operating System Structures Simple Structure Layered Approach Microkernels Virtual Machines
MS-DOS System Structure MS-DOS – written to provide the most functionality in the least space not divided into modules Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated
MS-DOS Layer Structure
Simple Structures … UNIX consists of two separable parts, the kernel and the system programs. Every thing below the system call interface and above the physical hardware is the kernel. An enormous amount of functionality combined in one level, UNIX is difficult to enhance as changes in one section could adversely affect other areas.
UNIX System Structure
Layered Approach The OS is broken up into a number of layers Bottom layer is hardware and the topmost layer ( layer N) is the user interface A typical layer consists of data structures and a set of routines to service the layer above it THE operating system by Dijkstra IBM’s OS/2
OS/2 Layer Structure
Layered Approach … Modularity Each layer uses functions and services of only lower layers Simplifies debugging and system verification. The major difficulty with layered approach is careful definition of layers, because a layer can only use the layers below it Less efficient than other approaches
Microkernel Structures the operating system by removing all non-essential components from the kernel and implementing them as system and user level programs Smaller kernel Main function is to provide a communication facility between client programs and the various services that are also running in the user space. 1 January 2019
Microkernel … Easier to extend the OS—new services are added to user space and consequently do not require modification of the kernel and/or its recompilation Easier to maintain operating system code (enhancement, debugging, etc.) OS is easier to port from one hardware to another More security and reliability Mach, MacOS X Server, QNX, OS/2, and Windows NT 1 January 2019
Windows NT Client-Server Structure 1 January 2019
Virtual Machines CPU scheduling and virtual memory techniques used to emulate hardware of the underlying machine, on which user can install an operating system that the virtual machine supports On a time-sharing system with virtual machine support, users may be working on different operating systems Pioneered by IBM VM operating system that ran CMS, a single-user interactive operating system 1 January 2019
Virtual Machines … Difficult to implement. System development done without disrupting normal system operation. 1 January 2019
Virtual Machines … 1 January 2019
VMWare on Windows 1 January 2019
VMWare on Windows 1 January 2019
System Design and Implementation Design Goals User: operating system should be convenient to use, easy to learn, reliable, safe, and fast. System designer and administrator: operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient. 1 January 2019
System Design and Implementation … Mechanism: determine how to do something Policy: determine what will be done Separation of mechanism and policy is important for flexibility. 1 January 2019
System Design and Implementation … Implementation in: Assembly language Higher level languages: Easier to code Compact code Easier to port 1 January 2019