Introduction to Computer Science - PowerPoint PPT Presentation

1 / 36
About This Presentation
Title:

Introduction to Computer Science

Description:

ei-Pang Yang, Database Lab, CIS, NCTU. Objectives. Describe the ... Lists of programs waiting to run are kept on the disk in queues suitable to their job class. ... – PowerPoint PPT presentation

Number of Views:85
Avg rating:3.0/5.0
Slides: 37
Provided by: web2CcN
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Computer Science


1
Introduction to Computer Science
  • CHAPTER 3
  • Operating Systems
  • Software in the Background

2
Objectives
  • Describe the functions of an Operating System
  • Explain the basics of a PC operating system
  • Describe the advantages of a graphical operating
    system
  • Differentiate among different versions of
    Microsoft Windows
  • Explain the need for network operating systems
  • Describe the methods of resource allocation on
    large computers
  • Be able to describe the differences among
    multiprocessing, multiprogramming, and
    timesharing
  • Explain the principles of memory management

3
Operating System Basic Concept
  • Definition provides access to all resources
  • Kernel (supervisor program)
  • Manages the operating system
  • Memory resident
  • Loads set of programs that lies between
    applications software and the hardware
  • Fundamental software that controls non-resident
    portions of the OS as needed
  • Booting Loads the kernel into memory

4
The Booting Process
5
Operating Systems Hidden Software
  • Computer hardware needs software to make it work.
  • An operating system is a set of programs that
    lies between applications software and the
    computer hardware

Fig. 2-1
6
Operating Systems Supervisor Program
  • The term systems software means all programs
    related to coordinating computer operations,
    including the
  • operating system,
  • programming language translators (compliers), and
  • service programs.
  • The program that manages the operating system is
    the supervisor program, most of which remains
    resident in memory.

Fig. 2-2
7
Operating Systems main functions
  • The supervisor controls the entire operating
    system and loads into memory other operating
    system programs (called nonresident) from disk
    storage only as needed.
  • An operating system has four main functions
  • manage the computers resources, such as the CPU,
    memory, disk drives, and printers
  • establish a user interface execute and
  • execute and provide services for applications
    software.
  • Carries out all input and output operation
  • Much of the work of an operating system is hidden
    from the user.

8
Platform and Wintel
  • User interested in application software to make
    the PC useful
  • Application software is platform specific
  • Platform Computer hardware and operating system
    software that dictate what other software can run
  • Wintel Intel-based PC running Microsoft Windows

9
User Interface
  • Facilitates communication between the user and
    the operating system
  • Two forms
  • Command line
  • Text-based
  • Key commands
  • Examples MS-DOS, Unix
  • Graphical user interface (GUI)
  • Visual images
  • Menus
  • Examples Windows, Mac OS, Linux

10
Types of OS
  • 1. Command line
  • 2. Single user PC
  • 3. Network Operating System (NOS)
  • MS-DOS
  • Microsoft Windows
  • Mac OS
  • UNIX
  • LINUX
  • Network Operating System NOS
  • Generally, an application program can run on just
    one operating system.
  • Although operating systems differ, many of their
    basic functions are similar.

11
A Windows Overview Early Day
  • Operating environment for MS-DOS
  • Windows started out as an operating environment,
  • another layer added to separate the operating
    system from the user.
  • Shell layer added between users and DOS
  • This layer is often called a shell because it
    forms a coating,
  • with icons and menus, over the operating system.

12
A Windows Overview Today
  • Home/consumer market
  • Windows 95
  • Windows 98
  • Windows Millennium Edition (ME)
  • Corporate market
  • Windows NT
  • Windows 2000
  • Windows XP
  • Pocket computers and Internet appliances
  • Windows CE

13
Mac OS
  • First commercially successful GUI (1984)
  • Served as a model to other GUI systems

14
UNIX
  • Supports
  • Multi-user
  • Time-sharing
  • Character-based system
  • Command-line interface
  • Runs on various processors and many types of
    computers
  • Primary OS used on Internet servers

15
LINUX
  • UNIX-like OS
  • Open-source software
  • Download it free
  • Make changes
  • Distribute copies
  • PC Setup
  • PC comes with Windows installed
  • Install LINUX in a dual-boot configuration
  • Advantages over Windows
  • Extremely stable
  • Internet support
  • Reinstallation is simpler

16
Network Operating Systems
  • Network Operating System (NOS)
  • An extension of operating systems for personal
    computers
  • designed to let computers on a network share
    resources such as hard disks and printers.
  • Windows NT Server, 2000 Server, .NET Server
  • Novell Net Ware, Unix, Linux
  • NOS supports data security, troubleshooting, and
    administrative control. Split between client and
    server computers
  • Server
  • File management
  • Client
  • Requests to the server
  • Messaging
  • Has own local OS
  • Makes the resources appear as if they are local
    to the clients computer

17
OS For Large Computers
  • Unlike the usual case with a personal computer, a
    large computer is used by many people.
  • Sharing special problems, by the operating
    system
  • CPU,
  • Memory,
  • Storage,
  • Printers.
  • OS must control
  • Who gets access to resources
  • Keeps the programs from different users from
    getting mixed up with one another

18
Resource Allocation
  • On a large computer with many users, shared
    resources are said to be allocated.
  • Resource hardware or software that is needed to
    complete a task
  • Resource Allocation assigning computer
    resources to certain programs
  • Resource De-allocation releasing resources when
    a task is complete
  • Sharing the Central Processing Unit
  • Sharing Memory
  • Sharing Storage Resources
  • Sharing Printing Resources

19
Sharing the CPU
  • The process of sharing a single central
    processing unit is controlled by the operating
    system.
  • One CPU
  • Multiprogramming
  • Event-driven
  • Timesharing
  • More than one CPU
  • Multiprocessing multiple CPUs can run several
    programs simultaneously

20
Multiprogramming Concurrent
  • One CPU Multiprogramming means that two or more
    programs are being executed concurrently on a
    computer with only one central processing unit.
  • The key word here is concurrently as opposed to
    simultaneously.
  • Concurrent Concurrent execution of two or more
    processes
  • Several processes open at once
  • Only one process can receive the attention of the
    CPU at any given moment
  • Effective because CPU speeds are many times
    faster than input/output speeds.

21
Multiprogramming Event-Driven
  • Multiprogramming is event-driven, meaning that
    programs share resources based on events that
    take place in the programs.
  • Normally, a program is allowed to complete a
    certain activity (event), such as a calculation,
    before relinquishing the resource (CPU, this
    example) to another program that is waiting for
    it.
  • An interrupt is a condition that causes normal
    program processing to be suspended temporarily.
    For example, if a program needs to read a record,
    that process is turned over to the operating
    system, and the CPU is allocated elsewhere.
  • In large computer systems, programs that run in
    an event-driven multiprogramming environment are
    usually batch programs, typically payroll or
    accounts receivable.

22
Event-driven Summary
  • One program receives the attention of the CPU
  • Its processing will be interrupted based upon
    events in the program
  • When processing needs to be temporarily
    suspended, an interrupt is generated
  • This is a signal to the operating system to
    evaluate the cause of the interrupt and determine
    who should now have CPU time

23
Event-driven Example
  • Two programs are running Payroll and Inventory
    Management
  • Payroll needs to read an employee record
  • Payroll generates an interrupt
  • Normal processing is temporarily suspended
  • The CPU looks at the interrupt and initiates the
    read operation
  • While waiting for the read to complete, the CPU
    begins processing the Inventory Management
    program
  • When the read operation is complete, another
    interrupt is generated
  • Normal processing is temporarily suspended
  • The CPU looks at the interrupt and determines its
    cause
  • The CPU will either continue processing the
    Inventory Management program or return to the
    Payroll program depending upon their priority

24
Multiprogramming Time-sharing
  • One program receives the attention of the CPU
  • A small fraction of CPU time (time slice) is
    allocated to the program
  • The time slice ends, the CPU begins processing a
    different program
  • Response time can vary based upon the number of
    users on the system
  • Response time is the time between a typed
    computer request and the computers reply
  • Typical time-sharing applications are credit
    checking, point-of-sale systems, and airline
    reservation systems.

25
Time-Sharing Process A and B
26
Sharing Memory
  • Program must be in memory to be executed
  • Problems
  • Programs compete for space
  • May have a very large program
  • Memory space for each program must not overlap
  • Memory management is the process of allocating
    memory to several programs and of keeping the
    programs in memory separate from each other.
  • The process of providing separate memory space to
    programs
  • Memory Protection keeps one program from
    interfering with another
  • Methods
  • Partitions or regions
  • Foreground and background
  • Virtual storage (virtual memory)

27
Partitions or Regions
  • Divide memory into sections
  • The partition must accommodate the largest
    possible program
  • Problem
  • May cause wasted memory space

28
Foreground and Background
  • Large all-purpose computers often divide their
    memory into foreground and background areas.
  • The foreground is generally for programs that
    have higher priority and therefore receive more
    CPU time. A typical foreground program is in a
    time-sharing environment, with the user at a
    terminal awaiting response.
  • The background is for programs with less pressing
    schedules and, thus, lower priorities and less
    CPU time. Typical background programs are batch
    programs in a multiprogramming environment.
  • Lists of programs waiting to run are kept on the
    disk in queues suitable to their job class.

29
Virtual Storage/Virtual Memory
  • Another memory management scheme virtual storage
    (also called virtual memory) part of the program
    is stored on disk and is brought into memory for
    execution only as needed. The parts not presently
    needed are the parts left on the disk.
  • Under virtual storage, a user appears to be using
    more memory space than is actually the case.
  • Memory is considered real storage, while the
    secondary storage holding the rest of the program
    (hard disk, most likely) is considered virtual
    storage.
  • Virtual storage can be implemented in a variety
    of ways a popular method is paging.

30
Virtual Storage Paging
  • Paging is the process of dividing a program into
    equal-size pieces called pages and storing them
    in equal-size memory spaces called page frames.
  • All pages and page frames are the same fixed
    size, typically 2K or 4K bytes.
  • The pages are stored in memory in noncontiguous
    locations, that is, locations not necessarily
    next to each other.
  • The operating system is able to keep track of
    page locations in memory by using a page table,
    which, index-like, lists each page that is part
    of the program and the corresponding beginning
    memory address where it has been placed.

31
Virtual Storage Paging Process
  • A portion of the program is placed in memory
  • The remainder is on disk
  • Sections on disk will be brought into memory as
    needed (one page at a time)
  • Problem -- Thrashing
  • Too large a portion of CPU time is spent
    locating the correct page and bringing it
    into memory
  • Solution
  • Run fewer programs concurrently
  • Add memory

32
Memory Protection
  • Memory protection the process of keeping one
    program from straying into another is called.
  • Without memory protection, in a multiprogramming
    environment it is theoretically possible for the
    computer, while executing one program, to destroy
    or modify another program by transferring to the
    wrong memory locations.
  • To avoid this problem, the operating system
    confines each program to certain defined limits
    in memory.
  • Action if assigned memory space is violated
  • Termination of executing program

??
33
Sharing Storage Resources
  • On a large computer, it is the operating system
    that keeps track of which file is where and also
    responds to commands to manipulate files.
  • The situation is complicated by the possibility
    that more than one user may want to read or write
    a record from the same disk pack at the same
    time.
  • Since the operating system must keep track of the
    process, any program instruction to read or write
    a record is routed to the operating system, which
    processes the request and then returns control to
    the program.

34
Sharing Printing Resources
  • Print resources are shared between active
    programs
  • Printouts are generated in pieces as the CPU
    gives each concurrent program some time
  • Problem
  • The current program may generate a few print
    lines
  • The CPU moves to the next program
  • The second program may generate a few print
    lines, etc.
  • Result
  • Printout is worthless as it contains a few lines
    from several programs
  • Solution Spooling
  • Each program thinks it is writing to the printer
  • The program actually writes to the hard disk
  • When the program is complete, the file on the
    hard disk is sent to the printer

35
Sharing Printing Resources Spooling
  • Spooling means that each program writes onto a
    disk each file that is to be printed.
  • Although the program thinks it is writing to the
    printer, the operating system intercepts that
    output and sends it instead to the disk.
  • When the entire file is on the disk, spooling is
    complete, and the disk files are printed intact.
  • Spooling to disk is much faster than writing that
    same record on a printer. A program, therefore,
    completes execution more quickly if records to be
    printed are written temporarily on disk instead.

36
Service Programs
  • Most resource allocation tasks, such as paging
    and spooling, are done by the operating system
    without involvement by a user.
  • The operating system can also perform explicit
    services at the request of the user.
  • Service programs, also known as utilities, avoid
    duplication of effort.
  • Prewritten programs perform many standard chores,
    such as
  • copying a file,
  • sorting a file, or
  • merging two files into one file.
Write a Comment
User Comments (0)
About PowerShow.com