Operating Systems Principles (Introduction)



Download 0.78 Mb.
Page2/2
Date09.06.2018
Size0.78 Mb.
#54027
1   2
parts of tasks from queue giving equal or appropriate time to each of task in order to serve all tasks from the queue.

  • CPU switches between queue tasks after equal or predefined intervals of time and usually is never idle.

  • User interaction with the programs is possible


    1.2.1.1 Batch Systems
    Early computers were physically enormous machines run from a console. The common input devices were card readers and tape drives. The common output devices were line printers, tape drives, and card punches.
    Batch of Tasks (Jobs)


    Task #1

    Input

    Calculation



    Output

    Save Result



    Task #2

    Input


    Calculation

    Output


    Save Result

    Task #3

    Read


    Calculation

    Output


    Save Result

    CPU

    Input

    Output


    monitor
    Read


    printer2

    Save





    The user did not interact directly with the computer systems. Rather, the user prepared a job-which consisted of the program, the data, and some control information about the nature of the job (control cards)-and submitted it to the computer operator. The job was usually in the form of punch cards. At some later time (after minutes, hours, or days), the output appeared. The output consisted of the result of the program, as well as a dump of the final memory and register contents for debugging.
    The operating system in these early computers was fairly simple. Its major task was to transfer control automatically from one job to the next. The operating system was always resident in memory.

    To speed up processing, operators batched together jobs with similar needs and ran them through the computer as a group.




    Memory layout for batch system




    Disadvantage: In this execution environment, the CPU is often idle, because the speeds of the mechanical I/O devices are intrinsically slower than are those of electronic devices.

    Even a slow CPU works in the microsecond range, with thousands of instructions executed per second. A fast card reader, on the other hand, might read 1200 cards per minute (or 20 cards per second). Thus, the difference in speed between the CPU and its I/O devices may be three orders of magnitude or more.



    Over time, of course, improvements in technology and the introduction of disks resulted in faster I/O devices. However, CPU speeds increased to an even greater extent, so the problem was not only unresolved, but exacerbated.

    1.2.1.2 Multiprogrammed Systems


    • Mainframe computer systems were very huge and expensive.

    • The expensive system requires the most effective usage of expensive resources - especially the processor.

    • That was why the main purpose of the MainFrame OS was to utilize the processor by all means.

    • Thus appear the Multiprogrammed OS.

    The most important aspect of job scheduling is the ability to multiprogram. A single user cannot, in general, keep either the CPU or the I/O devices busy at all times.




    Advantage: Multiprogramming increases CPU utilization by organizing jobs so that the CPU always has one to execute.

    Task #1


    Read

    Calculation



    Output

    CPU

    Input

    Output

    CPU Scheduling


    monitor
    Read


    Task #2

    Input

    Calculation



    Output
    printer2

    Save


    Jobs in

    memory



    W

    W



    Task #3


    Read

    Calculation

    Output

    Job Scheduling

    Job pool on Disk



    Wait

    Memory management Resource Protection





    The idea is as follows: The operating system keeps several jobs in memory simultaneously. This set of jobs is a subset of the jobs kept in the job pool-since the number of jobs that can be kept simultaneously in memory is usually much smaller than the number of jobs that can be in the job pool.

    The operating system picks and begins to execute one of the jobs in the memory. Eventually, the job may have to wait for some task, such as an I/O operation, to complete.


    In a non-multiprogrammed system, the CPU would sit idle.

    In a multiprogramming system, the operating system simply switches to, and executes, another job.


    When that job needs to wait, the CPU is switched to another job, and so on. Eventually, the first job finishes waiting and gets the CPU back. As long as at least one job needs to execute, the CPU is never idle.

    Memory layout for multiprogramming system


    Multiprogramming is the first instance where the operating system must make decisions for the users. Multiprogrammed operating systems 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 disk awaiting allocation of main memory. If several jobs are ready to be brought into memory, and if there is not enough room for all of them, then the system must choose among them. Making this decision is job scheduling, which is discussed later.

    When the operating system 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 of memory management.

    In addition, if several jobs are ready to run at the same time, the system must choose among them. Making this decision is CPU scheduling.

    Finally, multiple jobs running concurrently require that their ability to affect one another be limited in all phases of the operating system, including process scheduling, disk storage, and memory management.


    Disadvantage: Multiprogrammed, batched systems provided an environment where the various system resources (for example, CPU, memory, peripheral devices) were utilized effectively, but it did not provide for user interaction with the computer system.



    Problems: Job and CPU scheduling, Memory management, different tasks resources protection issues should be taken in account to keep the system effective.

    1.2.1.3. Time Sharing Systems
    Time sharing (or multitasking) is a logical extension of multiprogramming.


    Advantage: The CPU executes multiple jobs by switching among them, but the switches occur so frequently that the users can interact with each program while it is running.


    Process #1

    Input


    Calculation

    Input


    Output

    Calculation

    Output

    Save Result



    Process #2

    Input


    Calculation

    Output


    Save Result

    Process #3

    Read


    Calculation

    Output


    Save Result

    CPU

    Input

    Output

    Processes in Physical Memory

    CPU time sharing

    Process concurrent execution




    monitor
    Read


    printer2

    Save



    Physical Memory

    Users


    Security

    Virtual Memory


    Paging

    Memory management and protection



    Disadvantage: Time-sharing operating systems are even more complex (difficult, expensive) than multiprogrammed operating systems.


    Problems: Job and CPU scheduling, Memory management, User and Security management, Protection issues should be taken in account to keep the system effective.

    An interactive (or hands-on) computer system provides direct communication between the user and the system. The user gives instructions to the operating system or to a program directly, using a keyboard or a mouse, and waits for immediate results. Accordingly, the response time should be short typically within 1 second or so.

    A time-shared operating system allows many users to share the computer simultaneously. Since each action or command in a time-shared system tends to be short, only a little CPU time is needed for each user. As the system switches rapidly from one user to the next, each user is given the impression that the entire computer system is dedicated to her use, even though it is being shared among many users.
    A time-shared operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of a time-shared computer.

    Each user has at least one separate program in memory. A program loaded into memory and executing is commonly referred to as a process. When a process executes, it typically executes for only a short time before it either finishes or needs to perform I/O. I/O may be interactive; that is, output is to a display 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. Input, for example, may be bounded by the user's typing speed; seven characters per second is fast for people, but incredibly slow for computers.

    Rather than let the CPU sit idle when this interactive input takes place, the operating system will rapidly switch the CPU to the program of some other user.
    In both, several jobs must be kept simultaneously in memory, so the system must have memory management and protection.

    To obtain a reasonable response time, jobs may have to be swapped in and out of main memory to the disk that now serves as a backing store for main memory. A common method for achieving this goal is virtual memory, which is a technique that allows the execution of a job that may not be completely in memory. The main advantage of the virtual-memory scheme is that programs can be larger than physical memory. Further, it abstracts main memory into 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.


    Time-sharing systems must also provide a file system (as should be done by any OS). The file system resides on a collection of disks; hence, disk management must be provided. Also, time-sharing systems provide a mechanism for concurrent execution, which requires sophisticated CPU-scheduling schemes. To ensure orderly execution, the system must provide mechanisms for job synchronization and communication, and it may ensure that jobs do not get stuck in a deadlock, forever waiting for one another.
    The idea of time sharing was demonstrated as early as 1960, but since time-shared systems are difficult and expensive to build, they did not become common until the early 1970s. Although some batch processing is still done, most systems today are time sharing. Accordingly, multiprogramming and time sharing are the central themes of modern operating systems, and they are the central themes of this course.

    System Evaluation Criteria

    CPU utilization (maximize) – keep the CPU as busy as possible

    Throughput (maximize) - # of processes that complete their execution per time unit

    Turnaround time (minimize)– amount of time to execute a particular process


    • CPU utilization: the time the CPU is busy during some time period. We want to keep the CPU as busy as possible. CPU utilization may range from 0 to 100 percent. In a real system, it should range from 40 percent (for a lightly loaded system) to 90 percent (for a heavily used system).

    • Throughput: If the CPU is busy executing processes, then work is being done. One measure of work is the number of processes completed per time unit, called throughput. For long processes, this rate may be 1 process per hour; for short transactions, throughput might be 10 processes per second.

    • Turnaround time: From the point of view of a particular process, the important criterion is how long it takes to execute that process. The interval from the time of submission of a process to the time of completion is the turnaround time. Turnaround time is the sum of the periods spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O.


    Resource Usage Table

    Batch System

    Seconds

    CPU

    HDD

    Printer

    CPU queue

    1

    T1







    T2,T3

    2




    T1




    T2,T3

    3




    T1




    T2,T3

    4

    T1







    T2,T3

    5

    T1







    T2,T3

    6

    T2







    T3

    7

    T2







    T3

    8




    T2




    T3

    9

    T2







    T3

    10







    T2

    T3

    11







    T2

    T3

    12

    T3










    13




    T3







    14




    T3







    15

    T3













    Task 1

    Sec







    CPU time. Calculations.

    1

    I/O time. Input from the HDD

    2

    CPU time. Calculations.

    2




    Task 2

    Sec







    CPU time. Calculations.

    2

    I/O time. Input from the HDD

    1

    CPU time. Calculations.

    1

    I/O time. Print on Printer.

    2




    Task 3

    Sec







    CPU time. Calculations.

    1

    I/O time. Output to HDD.

    2

    CPU time. Calculations.

    1







    Resource Usage Table

    Time Sharing System

    For external devices if the task takes the resource it keeps the resource until completing the operation with it.


    Seconds

    CPU

    HDD

    Printer

    CPU queue

    HDD queue

    1

    T1







    T2,T3




    2

    T2

    T1




    T3




    3

    T3

    T1




    T2




    4

    T2

    T3




    T1




    5

    T1

    T3







    T2

    6

    T3

    T2




    T1




    7

    T1







    T2




    8

    T2













    9







    T2







    10







    T2












    Resource Usage Table

    Multiprogrammed System

    The resource is dedicated if it’s free

    and if there is a request

    Seconds

    CPU

    HDD

    Printer

    CPU queue

    1

    T1







    T2,T3

    2

    T2

    T1




    T3

    3

    T2

    T1




    T3

    4

    T3

    T2




    T1

    5

    T1

    T3




    T2

    6

    T1

    T3




    T2

    7

    T2







    T3

    8

    T3




    T2




    9







    T2




    10
































































































    Overall time for all 3 tasks to finish

    Throughput

    Task1 Turnaround time

    Task2 Turnaround time

    Task3 Turnaround time

    Average Turnaround time for all tasks

    CPU utilization

    Batch

    15

    3/15

    5

    11

    15

    (15+11+5)/3=10.3

    8/15 ~53%

    Multiprogrammed

    9

    3/9

    6

    9

    8

    (6+9+8)/3=7.67

    8/9~89%

    Time Sharing

    10

    3/10

    7

    10

    6

    (7+10+6)/3=7.67

    8/10~80%





    Directory: Arm -> Public -> 2016-Spring-Operating-System-Priniciples -> Handouts
    Arm -> Armed conflict in the world today: a country by country review
    Arm -> Record of proceedings in the case of: board date
    Arm -> Record of proceedings in the case of: board date
    Arm -> Record of proceedings in the case of: board date
    Arm -> Record of proceedings in the case of: board date
    Arm -> Armenia Government Expenditure Database
    Arm -> Army 14. 1 Small Business Innovation Research (sbir) Proposal Submission Instructions
    Arm -> Record of proceedings in the case of: board date
    Handouts -> Interrupts types and classification Interrupt driven os interrupt handling Generic routine, interrupt vectors, interrupt chaining Interrupt implementation in the system Interrupt controller priorities, masks, reentrancy Silberschatz, Operating System
    Handouts -> Computer System Structures

    Download 0.78 Mb.

    Share with your friends:
  • 1   2




    The database is protected by copyright ©ininet.org 2024
    send message

        Main page