Sunteți pe pagina 1din 31

What is an Operating System?

An OS is a program that acts an intermediary between the user of a computer and computer hardware. Major cost of general purpose computing is software. OS simplifies and manages the complexity of running application programs efficiently.

Operating system Modular View

Virtual Mem Comm. Application Prmtvs Server File sys. Hardware + interrupts Process + primitives Devices Application Clients

Shell

User Processes

Directories

Web Server

Web Clients

Goals of an Operating System


Simplify the execution of user programs and make solving user problems easier. Use computer hardware efficiently.
Allow sharing of hardware and software resources.

Make application software portable and versatile. Provide isolation, security and protection among user programs. Improve overall system reliability like

error confinement, fault tolerance and reconfiguration.

System Generation

OS written for a class of machines, must be configured for each specific site.
SYSGEN program obtains info about specific hardware configuration and creates version of OS for hardware

Booting Bootstrap program - loader program loads kernel, kernel loads rest of OS.
Bootstrap program stored in ROM

OS Structure - Simple Approach


MS-DOS - provides a lot of functionality in little space.
Not divided into modules, Interfaces and levels of functionality are not well separated

UNIX - limited structuring, has 2 separable parts


Systems programs Kernel everything below system call interface and above physical hardware. File system, CPU scheduling, memory management

Operating System Basic Services


Programs that accept commands and requests from a user and a users program Manages, loads, and executes programs Manages hardware resources of the computer Act as an interface between the user and the system

Operating System Additional Services


Provides interfaces for the user and the users programs File support services I/O support services Means of starting the computer
Bootstrapping or booting the computer Initial Program Load (IPL)

Handles all interrupt processing Network services Provides tools and services for concurrent processing

Computer System Components


Hardware
Provides basic computing resources (CPU, memory, I/O devices).

Operating System
Controls and coordinates the use of hardware among application programs.

Application Programs
Solve computing problems of users (compilers, database systems, video games, business programs such as banking software).

Users
People, machines, other computers

Operating System(Cont.)
Interface manager Human interaction made easy interfacing, abstraction, control and sharing Resource manager Efficient use of resources Enhances hardware features virtual time, space and resource (processes, threads) System and data security and protection provider

Abstract View of System

User 1
compiler

User 2
assembler

User 3
Text editor

.........

User n

System and Application Programs


Operating System

Database system

Computer Hardware

Layered OS Structure
OS divided into number of layers - bottom layer is hardware, highest layer is the user interface. Each layer uses functions and services of only lowerlevel layers. THE Operating System Kernel has successive layers of abstraction.

Computer System Architecture

User Interface
Operating system provides these facilities for the user: Program creation : editors, debuggers, other development tools. Program execution : load, files, IO operations. Access to IO devices: Read and writes. Controlled access to files: protection mechanisms, abstraction of underlying device. System access: Controls who can access the system. Error detection and response: external, internal, software or hardware error. Accounting: Collect stats., load sharing , for billing purposes.

User Interface and Command Execution Services Types of user interfaces CLI - Command Line Interface GUI - Graphical User Interface Menu environment Shell User interface and command processor that interacts with the kernel UNIX: C, Bourne and Korn shells Command Languages IBM Mainframes JCL MS Windows BAT files,Windows Scripting Host UNIX shell scripts

Resource Manager
Processors : Allocation of processes to processors, preemption, scheduling. Memory: Allocation of main memory. IO devices : when to access io devices, which ones etc. Files: Partitions, space allocation and maintenance. Applications: Data & Objects.

Process Management

A process tree
A created two child processes, B and C B created three child processes, D, E, and F

Process Management
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

Processes
1. A program in execution 2. An entity that can be assigned to and executed on a processes 3. It is a unit of work 4. Multiprogramming, time-sharing and real-time transaction systems lead to the refinement of the concept of process. 5. A process can be defined by its attributes and behaviors : it can be viewed as an Abstract Data Type (ADT). 6. When instances of this ADT co-exist we have concurrent processing. 7. Issues in concurrent processing : synchronization, mutual exclusion, deadlock, communication.

Deadlock Handling

(a) A potential deadlock. (b) An actual deadlock.

Multiprogramming
If memory can hold several programs, then CPU can switch to another one whenever a program is awaiting for an I/O to complete This is multitasking (multiprogramming)

Time-sharing the CPU

Time slicing

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.

Virtual Memory
Programs can be larger than memory
Program loaded into memory as needed Active program and data swapped to a disk until needed

Memory space treated uniformly

Protection and Security When sharing resources, protection of the systems and user resources from intentional as well as inadvertent misuse. Protection generally deals with access control. Ex: Read only file Security deals usually with threats from outside the system that affects the integrity and availability of the system and information with the system. Example: username, password to access system. Data encryption to protect information.

Scheduling and resource management

Scheduling and resource management is an Operations Research (OR) problem. Goals : Efficient use of resources, satisfy the service time requested by a process, say, in a real-time system and of course, fairness. Short-term and long-term scheduling. Queuing is one of the basic operations associated with scheduling. Interrupt is another important concept in the context of scheduling.

Scheduling and Resource Management Differential responsiveness


discriminate between different classes of jobs

Fairness
give equal and fair access to all processes of the same class

Efficiency
maximize throughput, minimize response time, and accommodate as many users as possible

File System

File system for a university department

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.

File System

Implements long-term store (often on disk) Information stored in named objects called files
a convenient unit of access and protection for OS

Files (and portions) may be copied into virtual memory for manipulation by programs. OS supports a directory structure for organizing the files.

Some System Calls For Process Management and File Management

A process is a collection of one or more threads that can run simultaneously Useful when the application consists of several tasks that do not need to be serialized Gives the programmer a greater control over the timing of application-related events All threads within the same process share the same data and resources and a part of the processs execution context It is easier to create or destroy a thread or switch among threads (of the same process) than to do these with processes

Multithreading

S-ar putea să vă placă și