Operating Systems Lecture 1 - PowerPoint PPT Presentation

About This Presentation
Title:

Operating Systems Lecture 1

Description:

... iUniverse.com, www.barnesandnoble.com, or www.amazon.com. 2 ... CPU speed is usually measured by its clock cycle which is around Giga hertz for PCs. ... – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 20
Provided by: profmnag
Category:

less

Transcript and Presenter's Notes

Title: Operating Systems Lecture 1


1
Operating SystemsLecture 1
  • Crucial hardware concepts review
  • M. Naghibzadeh
  • Reference M. Naghibzadeh, Operating System
    Concepts and Techniques, iUniverse publisher,
    2005.
  • To order www.iUniverse.com, www.barnesandnoble.
    com, or www.amazon.com

2
Introduction
  • A computer is a device which runs programs.
  • A program is a set of instructions that is
    prepared to do a specific job.
  • The operating system is an special program which
    sits on top of the computer hardware. It acts as
    an interface between the running programs and the
    computer hardware to
  • Provide basic software modules to be used by
    programs
  • Facilitate efficient use of computer resources
  • Prevent running programs interference

3
Computer Hardware Organization
  • Within every computer there are many hardware
    devices.
  • Control unit,
  • Arithmetic-logic unit,
  • Cache memory,
  • And main memory are the basic devices.
  • Other devices are usually Input/Output devices.
  • Figure 1 shows essential logical interconnctions
    of the devices

4
Essential logical interconnctions of a computers
devices
  • Figure 1 Computer organization model

5
Physical interconnctions of a computers devices
  • To reduce internal interconnection wiring, buses
    are used to connect devices.
  • A bus is similar to a highway via which different
    parts of a city are connected.
  • There are at least three busses, address bus,
    data bus and control bus, in every computer.
  • Some computer devices are not directly connected
    to the computers internal bus.
  • In a 32-bit computer, for example, the address
    bus and data bus are each 32 bits wide.
  • There are mechanisms for possessing the address
    and data buses, otherwise data and addresses from
    different devices could become mixed up.
  • A model of the bus-based computer organization is
    shown in Figure 2.

6
Essential Physical interconnctions of a
computers devices
  • Figure 2 A bus-based Computer organization model

7
The Fetch-Execute Cycle
  • The computer reads an instruction from the main
    memory (RAM) and moves it to a temporary place
    called the Instruction Register (IR) in the
    Central Processing Unit (CPU).
  • It then finds out what has to be done with
    respect to this instruction and performs the
    actions.
  • It repeats this cycle of moving an instruction
    from the main memory to the CPU and executing it
    over and over again.
  • This is called Fetch-Execute Cycle

8
The Details of Fetch-Execute Cycle
  • Figure 3 A simplified functional model of a
    computer

9
Program Counter (PC) update
  • It is important to understand how the PC is
    filled.
  • The PC is automatically filled with an initial
    value when the computer is started or restarted.
  • When a new program is to be executed, the
    operating system will fill the PC with the first
    executable instruction of the program.
  • Otherwise, it is updated as shown in the figure
    3.
  • When an instruction is executed, the next
    instruction to be fetched is most likely the one
    immediately following this instruction. However,
    this is not always the case. Look at the piece of
    program below that is written in a pseudo code
    format.
  • 1. If A gt B
  • 2. then print A
  • 3. else print B
  • 4. endif
  • Most of the time, the PC update during the fetch
    cycle suffices.

10
Interrupt
  • Interrupt is a signal that is sent to the CPU to
    capture its attention. It may be issued by
    different sources, like
  • By a fault detecting hardware that is trying to
    informs the CPU of a circuitry malfunction
  • By a monitoring circuit within the ALU that
    controls the acceptability of the data size for
    the operation being performed and, consequently,
    the operation result size
  • By a user that may press a special key like
    break at any time
  • By an slave processor that wants to inform the
    CPU of the completion of the assigned task

11
Interrupt masking
  • Some interrupts are maskable by user programs.
  • Masked interrupts are ignored by the CPU. This
    is analogous to ignoring a door knock.
  • Some interrupts are not user-maskable. It is not
    reasonable to let the computer continue in the
    presence of a hardware failure.
  • However, all interrupts are maskable within the
    kernel of an operating system.

12
Interrupt Categorization
  • Interrupts are categorized into few classes.
  • Different classes of interrupts require.
    different handling consideration.
  • Each category of interrupts is represented by a
    bit in interrupt vector within the CPU.
  • Interrupt categories have priorities.
  • When handling a higher priority interrupt
    handling any lower priority interrupt is
    postponed.

13
Program execution suspension
  • A non-masked interrupt causes the suspension of
    the currently executing program.
  • It is usually possible to resume the execution of
    the program after the interrupt is handled.
  • Interrupt signals reach the CPU and are stored in
    the interrupt vector. The interrupt(s) is ignored
    until the currently executing machine instruction
    is completed.
  • There are very few exceptions. One example might
    be the move instruction in some computers that
    is suppose to move a big chunk, say 256 bytes, of
    data from one location of main memory to another.
  • The CPU always looks for interrupt signals just
    before fetching a new instruction to execute. If
    there are any interrupt signals, the system
    handles them in the order of priorities and
    urgencies.

14
Fetch-Execute Cycle with interrupt
  • Figure 4 A simplified functional model of a
    computer with interrupt

15
Privileged instructions
  • Privileged instructions are those which are not
    usable by assembly application programmers.
  • Privileged instructions are executable only
    within the operating system kernel
  • Other parts of the OS and application programmers
    may execute privileged instruction by special
    means that are provided by the operating system
  • Disable interrupt which disables all interrupts
    is a sample privileged instruction.

16
CPU speed
  • CPU speed is usually measured by its clock cycle
    which is around Giga hertz for PCs.
  • A clock cycle is usually the time that takes to
    move one data (instruction, or address) from one
    internal register to another.
  • A machine instruction execution takes around 10
    clock cycles.
  • There are other units of measuring a CPU speed,
    like Million instruction per second (MIPS) and
    Million Floating point instructions per second
    (MFLOPS).

17
Summary
  • The following subjects were discussed
  • Computer, Program, and operating system
  • Logical Computer organization model
  • Physical Computer organization model
  • Functional Computer organization model and the
    Fetch-Execute Cycle
  • Interrupt, Interrupt masking, Interrupt
    categorization, and interrupt handling.
  • CPU speed.

18
Find out
  • Your computers instruction categories based on
    their length.
  • The benefits of adjusting the PC register during
    the fetch cycle even though we have to readjust
    it during the execute cycle for some
    instructions?
  • You have just bought a new personal computer. No
    operating system is installed, what software does
    it have and for what purposes?
  • If your computer is a 32-bit one, what is the
    maximum memory size that the CPU can directly
    address (without using a base register)?
  • Your computers speed in terms of MIPS.
  • Your computers interrupt classes
  • Your computers interruptable instructions
  • Your computers privileged instructions

19
  • Thank you!
Write a Comment
User Comments (0)
About PowerShow.com