Saturday, June 12, 2010

OperatingSystem


Chapter 1 – Introduction to OS

What is an Operating System?

§       Operating System is a Resource Manager.
      Handles multiple computer resources: CPU, Internal/External memory, Processes, Tasks, Applications, Users, etc…
      Manages and allocates resources to multiple users or multiple jobs running at the same time (e.g., processor time, memory space, I/O devices)
      Arranges to use the computer hardware in an efficient manner (maximize throughput, minimize response time) and in a fair manner.

§       It is a Control Program.
      Manages all the components of a complex computer system in an integrated manner. 
      Controls the execution of user programs and I/O devices to prevent errors and improper use of the computer resources.
      Looks over and protects the computer.

§       It is an extended/virtual machine
-      An interface between the user and hardware that hides the details of the hardware (e.g., I/O).
-      Constructs higher-level (virtual) resources out of lower-level (physical) resources (e.g., files).
-      Definition: Is a collection of software enhancements, executed on the bare hardware, culminating in a high-level virtual machine that serves as an advanced programming environment


Why Operating System?

§       Computer hardware is developed to execute user programs and make solving user problems easier.

§       An operating system makes a computer more convenient to use.
-      It acts as an interface between user and computer hardware. Therefore, the end-users are not particularly concerned with the computer’s architecture, and they view the computer system in terms of an application.
-      To programmers, it provides some basic utilities to assist him in creating programs, the management of files, and the control of I/O devices.



Operating System Objectives

§       Convenience
-      Makes the computer more convenient to use
§       Efficiency
-      Allows computer system resources to be used in an efficient manner
§       Ability to evolve
-      Permit effective development, testing, and introduction of new system functions without interfering with service

Services Provided by Operating Systems

§       Facilities for program creation
-      Editors, compilers, linkers, debuggers, etc.

§       Program execution
-      Loading in memory, I/O and file initialization.

§       Access to I/O and files
-      Deals with the specifics of I/O and file formats.

§       System access
-      Resolves conflicts for resource contention.
-      Protection in access to resources and data.

§       Error detection and response
-      internal and external hardware errors
§       memory error
§       device failure
-      software errors
§       arithmetic overflow
§       access forbidden memory locations
-      operating system cannot grant request of application

§       Accounting
-      collect statistics
-      monitor performance
-      used to anticipate future enhancements
-      used for billing users

Computer System Components

§       A computer system can be divided in to four components.

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

-      The Operating System: Controls and coordinates the use of the hardware among the various application programs for the various users.

-      The Application 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).

-      The Users: Users (people, machines, other computers).



§       These components can be viewed as layers, where each layer uses the services provided by the layer beneath it.

 













A Static View of System Components



Dynamic View of System Components
Another view of computer system components

History of Operating Systems

§       Let’s see how operating systems evolve over time.
§       This will help us to identify some common features of operating systems and how and why these systems have been developed as they are.

Evolution of Operating Systems

§       Early Systems (1950)
§       Simple Batch Systems (1960)
§       Multiprogrammed Batch Systems (1970)
§       Time-Sharing and Real-Time Systems (1970)
§       Personal/Desktop Systems (1980)
§       Multiprocessor Systems (1980)
§       Networked/Distributed Systems (1980)
§       Handheld Systems (1990)

Early Systems

§       Structure
-      Single user system.
-      Large machines run from console.
-      Programmer/User as operator.
-      Paper Tape or Punched cards.
-      No tapes/disks in computer.

§       Early software: Assemblers, Libraries of common subroutines, Device Drivers, Compilers, Linkers.
§       Significant amount of setup time.
§       Low CPU utilization.
§       But very secure.

Simple Batch Systems


§       Mainframe machines. Input devices were card readers. Output devices were line printer, tape drives, and card punch.
§       A job (a single program+ associated data + control information) usually on the punch cards submitted to the operator.
§       The output consisted of the results of the program or memory dump in case of error.
§       The operator used to batch together similar programs and run as a group to reduce setup time.
§       No user interaction while the job is executing.
§       Current examples include .bat files under Dos – Windows and shell files under Unix/Linux.
Example of card deck of a job

§       The operating systems (called resident monitor) manages the execution of each program in the batch.
-      Monitor utilities are loaded when needed.
-      Resident monitor is always in main memory and available for execution.
-      The resident monitor usually has the following part.
§       Control card interpreter – responsible for reading and carrying out instructions on the cards.
§       Loader – loads systems programs and applications programs into memory.
§       Device drivers – know special characteristics and properties for each of the system’s I/O devices.


§       In batch systems:
-      Initial control is in monitor.
-      Load next program and transfer control to it.
-      When a job completes, the control transfers back to monitor.
-      Automatically transfer control from one job to another (Automatic job sequencing).

Problems

§       Slow Performance – I/O and CPU could not overlap; card reader very slow.
§       CPU was often idle.

Solutions

1.    Off-line Operation
-      Speed up computation by loading jobs into memory from tapes while card reading and line printing is done off-line using smaller machines.


2.    Use spooling (Simultaneous Peripheral Operation On Line).
-      Cards are read directly from the card reader onto a disk and location of card images are kept in a table by the operating system.
-      The output is sent to the disk and when the job is completed then the output was actually printed.
-      I/O and computations were overlapped. 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.
§        


Uniprogramming Until Now

§       I/O operations are exceedingly slow (compared to instruction execution).
§       A program containing even a very small number of I/O operations will spend most of its time waiting for them.
§       Hence: poor CPU usage when only one program is present in memory.



Memory Layout of Uniprogramming















Memory layout of a simple batch processing system

 

Multiprogrammed Batch Systems


§       Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them.















§       If memory can hold several programs, then CPU can switch to another one whenever a program is waiting for an I/O to complete – This is multiprogramming.

 


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.

Time Sharing Systems (Interactive Systems)

§       TSS extends Batch multiprogramming to handle multiple interactive jobs – It’s Interactive Multiprogramming.
§       Multiple users simultaneously access the system through terminals.
§       Processor’s time is shared among multiple users, that is, 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).
§       On-line communication between the user and the system is provided; when the operating system finishes the execution of one command, it seeks the next “control statement” from the user’s keyboard.
§       TS system provides each user with her/her own virtual machine.

 

Multitasking

§       TS eventually supports multitasking.
§       A time share system that supports multiple processes (program in execution) per user is called a multitasking system.

Why Does Time Sharing Work?

§       Because of slow human reaction time, a typical user needs 2 seconds of processing time per minute.
§       Then many users should be able to share the same system without noticeable delay in the computer reaction time.

Batch Multiprogramming




Vs. Time Sharing


Batch Multi-Prog.
Time Sharing
Principle obj.
Max. Processor use
Min. response time
Source of inst. To OS
JCL provided with the job
Commands entered at the terminal

OS Features Needed for Time Sharing Systems

§       On-line file system must be available for users to access data and code.
§       Should do memory management
§       Should do CPU scheduling
§       Should do job synchronization and have communication facilities.
§       Should ensure that dead lock and indefinite waiting does not occur.
§       Should allow sharing of computer resources.

Personal Computer Systems

§       Personal computers – computer system dedicated to a single user.
§       Have a wide variety of I/O devices – keyboards, mice, display screens, small printers.
§       User convenience and responsiveness are of prime importance.
§       Can adopt technology developed for larger operating system.
§       Often individuals have sole use of computer and do not need advanced CPU utilization of protection features.
§       May run several different types of operating systems (Windows, MacOS, UNIX, Linux)
Two Categories of Computer Systems

§       Single Instruction Single Data (SISD)
-      Single processor executes a single instruction sequence to operate on data stored in a single memory.
-      This is a Uniprocessor.

§       Multiple Instruction Multiple Data (MIMD)
-      A set of processors simultaneously execute different instruction sequences on different data sets.
-      This is a Multiprocessor.

Multiprocessor Systems


§       Multiprocessor systems have more than one CPU in close communication.
-      Tightly coupled system – processors share memory and a clock; communication usually takes place through the shared memory.
§       Advantages of parallel system:
-      Increased throughput
-      Economical
-      Increased reliability
§       Graceful degradation


Multiprocessor architecture

Symmetric Multiprocessing (SMP)


§       Each processor runs an identical copy of the operating system.
§       Each processor can perform the same functions and share same main memory and I/O facilities (symmetric).
§       The OS schedules processes/threads across all the processors (real parallelism).
§       Existence of multiple processors is transparent to the user.
§       Incremental growth: just add another CPU!
§       Robustness: a single CPU failure does not halt the system, only the performance is reduced.
§       Many processes can run at once without performance deterioration.
§       Most modern operating systems support SMP

Asymmetric multiprocessing

§       Each processor is assigned a specific task; master processor schedules and allocated work to slave processors.
§       More common in extremely large systems


Distributed Systems



§       Distribute the computation among several physically separated 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 and fault tolerance
-      Communications
§       Requires networking infrastructure - Local area networks (LAN) or Wide area networks (WAN)
§       May be either client-server or peer-to-peer systems.





 
















General structure of client-server


Peer-to-peer systems

Network Operating System

§       Provides file sharing
§       Provides communication scheme
§       Runs independently from other computers on the network

Distributed Operating System

§       Less autonomy between computers
§       Gives the impression there is a single operating system controlling the network.

Clustered Systems

§       Clustering allows two or more systems to share external storage and balance CPU load.
§       Asymmetric clustering: one server runs the application while other servers standby.
§       Symmetric clustering: all N hosts are running the application.






Real-Time Systems


§       Note that not all Operating Systems are general-purpose systems.
§       Real-Time (RT) systems are dedicated systems that need to adhere to deadlines, i.e., time constraints.
§       Correctness of the computation depends not only on the logical result but also on the time at which the results are produced.
§       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.
§       Real-Time systems may be either hard or soft real-time.




Hard Real-Time System

§       Must meet its deadline.
§       Conflicts with time-sharing systems, not supported by general-purpose operating systems.
§       Often used as a control device in a dedicated application such as industrial control and robotics
§       Secondary storage limited or absent, data stored in short term memory, or read-only memory (ROM).


Soft Real-Time System

§       A critical real-time task gets priority over the other tasks (Deadline desirable but not mandatory).
§       Limited utility in industrial control of robotics
§       Useful in applications (multimedia, virtual reality) requiring advanced operating-system features.

Hand Held Systems


§       Personal Digital Assistants (PDAs)
§       Cellular telephones
§       Issues:
-      Limited memory
-      Slow processors
-      Small display screens.




Migration of Operating-System Concepts and Features























No comments:

Post a Comment