Lecture 1 Computer Operating Systems

Embed Size (px)

Citation preview

  • 7/31/2019 Lecture 1 Computer Operating Systems

    1/32

    Computer Operating Systems

    Technical Elective 1

  • 7/31/2019 Lecture 1 Computer Operating Systems

    2/32

    What is an Operating System?

    Operating System (OS) Is a program that acts as an intermediary between a

    user of a computer and the computer hardware.

    Purpose Provide an environment in which a user can execute programs in

    a convenientand efficientmanner.

    Thus, the primary goal of an OS is to make the computer

    system convenientto use A secondary goal is to use the computer hardware in

    an efficientmanner.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    3/32

    Computer System

    Can be divided roughly into four components:

    1. The hardware

    2. The operating system (OS)

    3. The application programs (APs)

    4. And the users

  • 7/31/2019 Lecture 1 Computer Operating Systems

    4/32

    assembler Text editor Databasesystems

    User 1 User 2 User 3 User n. . .

    compiler . . .

    System & application programs

    Operating system

    Computer hardware

    Figure 1. Abstract View of the components of a computer system

  • 7/31/2019 Lecture 1 Computer Operating Systems

    5/32

    The Hardware provides the basic computing resources

    1. Central processing unit (CPU)

    2. The memory

    3. The I/O devices

    TheApplication programs define the ways in w/cthese resources are used to solve the computingproblems of the users.

    1. word processors

    2. spreadsheets,

    3. compilers,

    4. webbrowsers

  • 7/31/2019 Lecture 1 Computer Operating Systems

    6/32

    The operating system (OS) controls and

    coordinates the use of the hardware among

    the various application programs for the

    various users.

    1. Windows

    2. Linux

    3. Mac OS

    4. etc

  • 7/31/2019 Lecture 1 Computer Operating Systems

    7/32

    The users

    1. Encoder

    2. Programmer

    3. Analyst

    4. Etc

  • 7/31/2019 Lecture 1 Computer Operating Systems

    8/32

    Different views for an OS

    Resource allocator

    A computer has many resources (hardware &

    software) that may be required to solve a problem:

    CPU time, memory space, file-storage space, I/O devices,and so on.

    Control program

    Controls the execution of user programs to prevent

    errors and improper use of the computer. It is

    especially concerned with the operation and control

    of the I/O devices

  • 7/31/2019 Lecture 1 Computer Operating Systems

    9/32

    Note:

    In general, there is no completely adequate

    definition of an OS (accdg to: Siberschatz, Galvin,

    Gagne)

    A more common definition is that OS is the one

    program running at all times on the computer

    (usually called the kernel), with all else beingapplication programs.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    10/32

    Batch Systems

    Operating

    systems

    User

    programarea

    Fig. 2 Memory layout for a simple batch system

    - To speed up processing, operators batchedtogether jobs with similar needs

    and ran them through the computer as a group.- Early computers were (physically) enormously large machines run from a

    console.- Common input devices were card readers and tape drives and line

    printers, tape drives, and card punches for output devices.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    11/32

    cont

    The introduction of disk technology allowed the OS to keepall jobs on a disk, rather than a in a serial card reader.

    With direct access to several jobs, it could dojobscheduling to use resources and perform tasks efficiently.

    The most important aspect of job scheduling is the abilityto multiprogram.

    A single user cannot, in general, keep either the CPU or theI/O devices busy at all times.

    Multiprogramming increases CPU utilization by organizing

    jobs such that the CPU always has one to execute.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    12/32

    cont

    Operating

    systems

    Job

    1

    Job2

    Job

    3

    Job 4

    0

    512K

    Fig 3 Memory Layout for a Multiprogramming System

  • 7/31/2019 Lecture 1 Computer Operating Systems

    13/32

    ..cont,

    The OS keeps several jobs in memory simultaneously (fig 3)

    This set of jobs is a subset of the jobs kept in the job pool(since the number of jobs that can be kept simultaneouslyin memory is usually much smaller than the number of jobsthat can be in the job pool).

    The OS picks up and begins to execute one of the jobs inthe memory.

    Eventually, the job may have to wait for some task, such asan I/O operation to complete.

    In a non-multiprogrammed system, the CPU would sit idle. In a multiprogramming system, the OS simply switches to

    and executes another job.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    14/32

    ...cont

    When that job needs to wait, the CPU is switched toanother job and so on.

    Eventually, the first job finishes waiting and gets the CPUback.

    As long as there is always at least one job to execute, theCPU is never idle.

    Multiprogramming is the first instance where the OS mustmake decisions for the users.

    Multiprogrammed OS are therefore fairly sophisticated.

    All the jobs that enter the system are kept in the job pool. This pool consists of all processes residing on the disk

    awaiting allocation of main memory.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    15/32

    cont

    If several jobs are ready to be brought into memory, and there isnot enough room for all of them, then the system must chooseamong them.

    Making this decision isjob scheduling.

    When the OS selects a job from the job pool, it loads that job into

    memory for execution. Having several programs in memory at the same time requires

    some form ofmemory management.

    In addition, if several jobs are ready to run at the same time, thesystem must choose among them.

    Making this decision is CPU scheduling. Multiple jobs running concurrently require that their ability to affect

    one another be limited in all phases of the OS, includingprocessscheduling, disk storage, and memory management.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    16/32

    Time Sharing Systems

    Time sharing or multitasking, is a logicalextension of multiprogramming.

    CPU executes multiple jobs by switching amongthem, but the switches occurs so frequently thatthe users can interact with each program while itis running.

    An interactive, or hands-on computer systemprovides direct communication between the user

    and the system. Response time should be short-typically within a

    second or so.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    17/32

    cont

    Time-shared OS allows the many users to share thecomputer simultaneously.

    As the system switches rapidly from one user to thenext, each user is given the impression that the entire

    computer system is dedicated to her use, whereasactually one computer is being shared among manyusers.

    A time-shared system uses CPU scheduling andmultiprogramming to provide each user with a small

    portion of a time-shared computer. Each user has at least one separate program in

    memory.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    18/32

    cont

    A program that is loaded into memory and isexecuting is commonly referred to as aprocess.

    When a process executes, it typically executes for

    only a short time before it either finishes orneeds to perform I/O.

    I/O may be interactive; that is, output is to adisplay for the user and input is from a user

    keyboard, mouse, or other device. Since interactive I/O typically runs at people

    speeds, it may take a long time to complete.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    19/32

    cont

    Time-sharing systems are even more complexthan aremultiprogrammed OS.

    In both, several jobs must be kept simultaneously inmemory, so the system must have memory

    managementandprotection. So that a reasonable response time can be obtained,

    jobs may have to be swappedin and out of mainmemory to the disk that now serves as a backing storefor main memory.

    A common method of achieving this goal is virtualmemory, w/c is a technique that allows the executionof a job that may not be completely in memory.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    20/32

    cont

    Obvious advantage of this scheme is that

    programs can be larger than physical memory.

    Further, it abstracts main memoryinto a large,

    uniform array of storage, separating logical

    memory as viewed by the user from physical

    memory.

    This arrangement frees programmers from

    concern over memory-storage limitations.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    21/32

    cont

    Time-sharing systems must also provide afile system.

    The file system resides on a collection of disks; hence,disk managementmust be provided.

    Time-sharing systems must also provide a mechanismfor concurrent execution, w/c requires sophisticatedCPU-scheduling schemes

    To ensure orderly execution, the system must providemechanisms forjob synchronization andcommunication, and it may ensure that jobs do not getstuck in a deadlock, forever waiting for one another.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    22/32

    cont

    Idea of time-sharing was demonstrated as

    early as 1960, but since TS systems are

    difficultand expensive to build, they did not

    become common until 1970s.

    Although batch processing is still done, most

    systems today are time-sharing.

    Multiprogramming and time-sharing are the

    central themes of modern OS.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    23/32

    Personal Computer Systems

    Appeared in the 1970s

    1st decade, PCs lacked the features needed toprotect the OS from user programs

    PC OS therefore were neither multiuser normultitasking

    Goals of these OS have changed with time;

    instead of maximizing CPU and peripheralutilization, the systems opt for maximizinguser convenience and responsiveness.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    24/32

  • 7/31/2019 Lecture 1 Computer Operating Systems

    25/32

    Parallel Systems

    Most systems to date are single-processorsystems; that is, they have only one main CPU.

    However, there is trend toward multiprocessor

    systems Such systems have more than one processor

    in close communication, sharing the computer

    bus, the clock, and sometimes memory andperipheral devices referred as tightly coupledsystems.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    26/32

    contd

    Advantages:

    Increased throughput

    Less expensive

    Increased reliability

    Graceful degradation (a.k.a.fault tolerant)

    Most Common Multiple-processor systems

    1. Symmetric multiprocessing

    2. Asymetric multiprocessing

  • 7/31/2019 Lecture 1 Computer Operating Systems

    27/32

    contd

    Symmetric multiprocessing Each processor runs an identical copy of the OS, and

    these copies communicate with one other as needed.

    Asymmetric Multiprocessing Each processor is assigned a specific task.

    A master processorcontrols the system; the otherprocessors either look to the master for instruction orhave predefined tasks

    This scheme defines a master-slave relationship. Themaster processor schedules an allocates work to theslave processors.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    28/32

    contd

    The difference between symmetric and

    asymmetric multiprocessing may be the result of

    either hardware/software.

    Special hardware can differentiate themultiprocessors, or the software can be written

    to allow only one master and multiple slaves.

    Example, Suns OS SunOS version 4 providesasymmetric multiprocessing, whereas Version 5

    (Solaris 2) is symmetric on the same hardware.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    29/32

    contd

    As microprocessor(P) become less expensive andmore powerful, additional OS functions are off-loadedto slave processor, or back-ends.

    Example, it is fairly easy to add a P with its own

    memory to manage a disk system The P could receive a sequence of requests from the

    main CPU and implement its own disk queue andscheduling algorithm.

    This arrangement relieves the main CPU of theoverhead of disk scheduling

    PCs contain a P in the KB to convert the key strokesinto codes to be sent to the CPU.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    30/32

    Real Time Systems

    Anotherform of a special-purpose OS

    Used when there are rigid time requirementson the operation of the processoror the flow

    of data; Often used as a control device in a dedicated

    application.

    Sensors bring data to the PC The PC must analyze the data and possibly

    adjust controls to modify the sensor inputs.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    31/32

    contd

    Systems that control scientific experiments, medicalimaging systems, industrial control systems, andcertain display systems are real-time systems

    Also included are some automobile-engine fuel

    injection systems, home appliance controllers, andweapon systems.

    A real-time system has well defined, fixed timeconstraints.

    Contrast this requirement to a time-sharing system,where it is desirable (but not mandatory) to respondquickly, or to a batch system, where they may be notime constraints at all.

  • 7/31/2019 Lecture 1 Computer Operating Systems

    32/32

    Distributed Systems

    Growth of computer networks-especially the internetand the WWW

    PCs & workstations are capable of running a webbrowser for accessing a hypertext document in a web

    Inclusion of system software such as TCP/IP and PPPthat enables a computer to access the internet

    Loosely coupled systems, or distributed systems,processors do not share memory or a clock, insteadeach processor has its own local memory

    Processors communicate with one another althoughvarious communication lines, such as high-speed busesor telephone lines