Class 7: IO and Operating Systems - PowerPoint PPT Presentation

1 / 61
About This Presentation
Title:

Class 7: IO and Operating Systems

Description:

... Density disc, supported by Toshiba, Time Warner, Matsushita Electric, Hitachi, ... Compact Disc and fully agreed upon Toshiba's SuperDensity Disc. ... – PowerPoint PPT presentation

Number of Views:378
Avg rating:3.0/5.0
Slides: 62
Provided by: McCor2
Category:

less

Transcript and Presenter's Notes

Title: Class 7: IO and Operating Systems


1
Class 7 I/O and Operating Systems
  • Input/ Output (I/O)
  • A. I/O, CPU and System Bus Function
  • 1. I/O Module
  • 2. I/O Addressing
  • B. I/O Devices Function
  • 1. Allocation of space to disk
  • 2. CD-ROM, CD-R, CD-RW
  • 3. DVD
  • 4. Keyboards, displays
  • II. Operating System
  • A. Process Management
  • 1. Multiprogramming
  • 2. Scheduling, Resource Management
  • B. Memory Management
  • 1. Partitioning
  • 2. Paging
  • 3. Virtual Memory

2
I/O Devices
  • I/O devices are also called peripherals, which
    provides an efficient mode of communication
    between the computer system and the outside
    environment.
  • Categories
  • Human readable
  • Screen, printer, keyboard, digital camera
  • Machine readable
  • CD, Hard-disk , tape systems, scanner
  • Communication
  • Modem, Ethernet Card, Antenna

3
I/O Modules
  • Peripheral devices do not connect to the system
    bus directly. I/O modules interface to the system
    bus and peripheral devices.

4
Why not connecting peripherals directly to the
system bus?
  • Technically Impractical.
  • Peripherals are electromechanical or
    electromagnetic devices whose operation manners
    are different from those of processor or memory.
    It is very hard if not impossible to incorporate
    the necessary logic into processor.
  • Different Data Format
  • Peripherals use different data formats and
    word length from system bus. So I/O modules are
    required to adjust the difference.
  • Speed Mismatch
  • The data transfer rate of peripheral is
    usually different from that of processor or
    memory. I/O module can be used to synchronize the
    data transfer.

5
I/O Data Buffering
  • Processor, memory and I/O devices have different
    data rate and data formats. So the data buffering
    function is needed to compensate the speed
    mismatch and adjust the data form.
  • E.g Speed compensation
  • I/O module buffers the data from
  • system bus and send it out at the
  • peripherals data rate.
  • I/O module receives the data from
  • the peripheral at a slow speed,
  • and transfer it out to memory
  • or processor at a fast speed.

6
I/O Error Detection
  • I/O module checks peripherals operating
    conditions and report their error state. It
    could be mechanical error or data transfer error.
  • Example
  • The most common error information we experience
  • paper jam in a printer.

7
I/O Addressing Memory Mapped
  • Devices and memory share the same address space
  • I/O ports and registers are treated as memory
    locations
  • No special instruction needed to access I/O
    devices
  • I/O and memory use the same R/W wires

Advantage Simplify instruction
set. Disadvantage Memory address range is
reduced.
8
I/O Addressing Isolated I/O
  • Uses separate address space
  • Need I/O or memory selection lines
  • Use Special instruction to access I/O devices
  • I/O and memory use different R/W wires

9
Allocation of File Space to Disk
  • An allocation method refers to how disk blocks
    are allocated for files
  • Contiguous allocation
  • Linked allocation
  • Indexed allocation

10
Contiguous Allocation
  • Each file occupies a set of contiguous blocks on
    the disk.
  • Simple only starting location (block ) and
    length (number of blocks) are required.
  • Random access.
  • Wasteful of space - fragmentation.
  • Files may change size.

11
Extent-Based Systems
  • Many newer file systems use a modified contiguous
    allocation scheme.
  • Extent-based file systems allocate disk blocks in
    extents.
  • An extent is a contiguous block of disk space.
    Extents are allocated for file allocation. A file
    consists of one or more extents.

12
Linked Allocation
  • Each file is a linked list of disk blocks blocks
    may be scattered anywhere on the disk.
  • Simple need only starting address
  • Free-space management system no waste of space
  • No random access
  • File-allocation table (FAT) disk-space
    allocation used by MS-DOS and OS/2.

13
Linked Allocation FAT
14
Indexed Allocation
  • Need index table
  • Random access
  • Dynamic access without external fragmentation,
    but have overhead of index block.

15
Free Space on Disk
  • Two strategies-

Linked list
Bit vector 00111100111111000110000001110000
16
Optical Storage CD-ROM
  • Originally for audio
  • More than 680Mbytes giving over 70 minutes audio
  • Polycarbonate coated with highly reflective coat,
    usually aluminium
  • Data stored as pits lands
  • Read by reflecting laser
  • Constant packing density
  • Constant linear velocity

17
CD-ROM Drive Speed Format
  • Audio is single speed
  • Constant linear velocity
  • 1.2 ms-1
  • Track (spiral) is 5.27km long
  • Gives 4391 seconds 73.2 minutes
  • Other speeds are quoted as multiples e.g. 24x
  • Quoted figure is maximum drive can achieve
  • Capacity 44,100 samples/channel/second x 2
    bytes/sample x 2 channels x 73 minutes x 60
    seconds/minute 772,632,000 bytes
  • FORMAT

18
CD and DVD
DVD types
19
DVD - technology
  • Multi-layer
  • Very high capacity (4.7G per layer)
  • Full length movie on single disk
  • Using MPEG compression
  • Finally standardized
  • Movies carry regional coding
  • Players only play correct region films
  • History
  • In 1993, two high-density optical storage
    standards were being developed one was the
    MultiMedia Compact Disc, backed by Philips and
    Sony, and the other was the Super Density disc,
    supported by Toshiba, Time Warner, Matsushita
    Electric, Hitachi, Mitsubishi Electric, Pioneer,
    Thomson, and JVC. IBM's president, Lou Gerstner,
    led an effort to unite the two camps behind a
    single standard, anticipating a repeat of the
    costly videotape format war between VHS and
    Betamax in the 1980s. Philips and Sony abandoned
    their MultiMedia Compact Disc and fully agreed
    upon Toshiba's SuperDensity Disc.

20
DVD Writable
  • Loads of standards
  • Supported by the DVD Forum
  • - DVD-R up to 4.7 GB, can only record once.
  • - DVD-RW up to 4.7 GB, similar to CD-RW
  • - DVD-R DL like DVD-R but double layer 8.5 GB
  • - DVD-RAM not so compatible with above, up to
    9.4 GB
  • Supported by the DVDRW Alliance
  • DVDR like DVD-R up to 4.7GB
  • DVDRW like DVDRW
  • DVDR DL a derivative of DVDR, up to 8.5 GB
  • DVD drives from 2004 should be able to read
    either of the competing recordable formats, older
    drives may favour DVD-R discs. Modern drives
    typically allow writing to both DVD-RW and
    DVDRW discs making the difference largely
    irrelevant.

21
Blu-ray Disc and HD DVD
  • Blu-ray is derived from the blue-violet laser
    used to read and write.
  • Because of its shorter wavelength (405 nm),
    substantially more data can be stored on a
    Blu-ray Disc than on the DVD format, which uses a
    red (650 nm) laser.
  • A Dual Layer Blu-ray Disc can store 50 GB, almost
    six times the capacity of a dual layer DVD.
  • High-Definition DVD is a high-density optical
    disc format designed for the storage of data and
    high-definition video.
  • Uses blue laser with shorter wavelength (same as
    Blu-ray)
  • HD DVD can store 30 GB of data.
  • Blu-ray was locked in a format war against HD DVD
    until the format emerged as the winner on
    February 19, 2008 when Toshiba the main driving
    force behind HD DVD announced it would no longer
    develop, manufacture and market HD DVD players
    and recorders.

22
Keyboards
  • Keyboard devices translate
  • keystrokes directly into
  • electrical signals.
  • A keyboard controller is used
  • to generate bit stream outputs.
  • The controller generates a bit
  • stream output according to
  • an internal program or lookup
  • table.

23
Qwerty Keyboard
24
Pointing Devices
  • Translates the spatial position of a pointer,
    stylus, or other selection device into numeric
    values within a system of two-dimensional
    coordinates.
  • Tablet Stylus
  • Three common input pad technologies
  • 1. Infrared detector
  • 2. Photosensor
  • 3. Pressure-sensitive pad

25
CRT Monitors
26
Liquid Crystal Displays (LCD)
27
Plasma Displays
28
Monitor Viewable Area
  • Aspect Ratio
  • - Many are 43
  • - More and more 169
  • Screen Size
  • - 15, 17, 19 and 21 inches popular
  • - Notebooks have 12 17 screens

29
HDTV
Important DTV Dates
July 1, 2006 All new 25 or larger sets must
have DTV tuners or be DTV-ready. March 1, 2007
All new 13 or larger sets must have DTV tuners
or be DTV-ready. Feb 17, 2009 Proposed shutoff
date for over-the-air analog broadcasts.
30
Software Fundamentals
  • Systems Software
  • Instructions that manage the hardware resources
  • Application Software
  • Instructions that perform specific user tasks

31
Why do we need operating systems?
  • Lets consider what happened before operating
    systems existed
  • First-Generation System Software (1945-1955)
  • Machine operation was hands on
  • A programmer would sign up for a time slot with
    one very expensive computer.
  • Loaded assembly instructions into memory
  • Loaded assembler and ran it
  • Loaded executable program into memory and ran it
  • Lots of idle computer time as the programmer
    ponders over results

32
Second Generation System Software (1955-1965)
  • Batch Operating Systems
  • Programmers give their programs (punched cards)
    to a specially-trained computer operator
  • The operator assembles several programs together
    and runs them as one big batch
  • All put on an input tape, results put on an
    output tape and printed
  • Programmers include Job Control Language
    statements in their programs
  • Assemble, Load, Run
  • They are not there to push the buttons
  • Advantages the computer is no longer sitting
    idle!
  • Disadvantages Unhappy programmersOnly one
    program in memory at a time

33
Third Generation System Software (1965-1985)
  • Multiprogramming Operating Systems
  • Multiple user programs loaded into memory at once
  • If a program pauses to wait for I/O, another
    program can be loaded and run in the meantime
  • Adds responsibility of protecting programs to the
    OS
  • Must not let errors in one program affect the
    others
  • So, the OS keeps track of the upper and lower
    address bounds of each program
  • If an error occurs
  • Cease execution
  • Remove it from memory
  • Begin on next program

Memory
0
Operating System
150
Program 1
325
Program 2
520
Program 3
620
Program 4
700
34
How Multiprogramming works
  • Process program local data
  • OS manages a queue (waiting line) of processes
    ready to run, called a job pool
  • When one job needs to wait for I/O operation to
    complete, OS switches to another job
  • When I/O request of first job is complete, OS
    stops running second job and gives CPU back to
    first job

1
3
4
2
5 etc.
35
History of Operating Systems
36
PC Operating System History
  • MS-DOS (Microsoft Disc Operating System) Early
    1980s.
  • Mac OS. Apple founders Steve Jobs and Steven
    Wozniak Xerox's PARC research laboratory GUI
    (Graphical User Interface).
  • 1983 the Apple Lisa installed the 1st GUI
    OS. Developed by Xerox. 10, 000!
  • 1984 Apples 2nd GUI OS----Mac OS.
  • MS-Windows Windows 1.0 November 1985
    (Clumsy and less capable)
  • Windows 3.0 1990 (Successful)
  • The alliance of Microsoft, IBM, INTEL, COMPAQ
    etc beats the Apple.
  • Windows 95Windows 98 Windows ME Windows
    2000 Windows XP

  • Windows NT Vista
    (2007)
  • Linux Started from a young computer student in
    Finland called Linus Torvalds in 1991. Supported
    by many giants, IBM, HP and other open source
    associations.

37
Other Operating Systems
  • Mobile devices
  • - like embedded linux, Windows CE, Pocket PC,
    and palm operating system.
  • Departmental Server Operating Systems
  • Support hundreds of concurrent users
  • UNIX, Linux, Windows 2000, Windows XP, Novell
    NetWare
  • Enterprise Operating Systems
  • Support thousands of concurrent users millions
    of transactions per day
  • IBMs OS/390, IBMs VM (Virtual Machine), IBMs
    VSE (Virtual Storage Extended), and IBMs OS/400

38
OS Market
  • Overall
  • Servers
  • Windows 70
  • Linux 20
  • Unix 10

39
The future of OS
  • Multi-media interfaces
  • User-interface incorporating all multi-media
  • Photography, touch, sound, fax, video, TV
  • Not just graphics and text
  • distributed computing environment and
    distributed operating systems
  • Currently users specify WHERE they want something
    to happen run program on machine X
  • Distributed OS - Run program (OS decides the
    best machine for the job)

40
Operating System Services
  • Program creation
  • Program execution
  • Access to I/O devices
  • Controlled access to files
  • System access
  • Error detection and response
  • Accounting

41
O/S as a Resource Manager
42
Operating System Types
  • Single-user, single tasking Examples Early
    batch systems, the Palm OS for Palm handheld
    computers
  • Single-user, multi-tasking - Windows 98 and the
    Mac OS.
  • Multi-user - allows many different users to take
    advantage of the computer's resources
    simultaneously. Example Unix.

43
Process Management
  • Two related issues
  • Ensuring that each process and application
    receives enough processor's time to function
    properly
  • Using as many processor cycles for real work as
    possible
  • The management is especially complicated for
    the multi-task operating system

44
Process Control Block
  • Process ID
  • State (new, ready, etc)
  • Priority
  • Program counter (PC)
  • Memory pointers
  • Starting/ending address in memory
  • Context data
  • Data of all related registers
  • I/O status
  • Accounting information
  • Used CPU time, time limits etc.

45
Process Management
  • Each process occupies a certain amount of RAM and
    uses registers, stacks and queues within the CPU
    and operating-system memory space.
  • When two processes are multi-tasking, the
    operating system allocates a certain number of
    CPU execution cycles to one process.
  • After that number of cycles, the operating system
    makes copies of all the registers, stacks and
    queues used by the processes.
  • It then loads all the registers, stacks and
    queues used by the second process and allocates
    it a certain number of CPU cycles.
  • When those are complete, it makes copies of all
    the registers, stacks and queues used by the
    second program, and loads the first program.
  • Each processs information is stored in the PCB
    (Process Control Block)

46
Process States
  • New A program is admitted by high-level
    scheduler but is not ready to execute.
  • Ready The process is ready to execute and is
    awaiting for processor.
  • Running The process is being executed by the
    processor.
  • Blocked (Waiting) The process is suspended from
    execution waiting for system resource, such as
    I/O.
  • Halted(Exit) The process has been terminated and
    will be destroyed by the operating system

47
Scheduling
  • Scheduling is the key to multi-tasking, which
    controls all the processes states and system
    resources.

48
Memory Management
  • In the multi-tasking system, memory management is
    important to allocate memory space to many
    processes efficiently.

49
Memory Management Partitioning
  • Splitting memory space into sections to allocate
    to processes and operating system.
  • Fixed-sized partitions
  • Equal-size partition
  • Unequal-size partition
  • Variable-size partitions

50
Fixed-Size Partitioning
  • Equal-size partition
  • Unequal-size partition
  • Drawbacks
  • If the process is not the same size as the
    partitioned memory block, memory space will be
    wasted.
  • Eg. A process needs to use 5 Mbytes memory.

51
Variable Sized Partitions
  • Allocate exactly the required memory space to a
    process
  • Drawbacks
  • Generates memory holes. Need defragment
    operation (similar as Disk derangement). The
    technique is called compaction.

52
Paging Logical Physical Address
  • Example
  • Every logical address has a page number (p) and a
    page offset (d).
  • The base memory location is found in the page
    table and the offset added.

53
Paging Example
  • 8-frame physical memory
  • 4 page logical address space
  • 4-word pages
  • Q How many bits in the logical
  • address?
  • Ans 2 bits for the page,
  • 2 bits for the offset 4
  • Q How many bits in the physical
  • address?
  • Ans 3 bits for frame,
  • 2 bits for offset 5

54
Example Allocating Free Frames
Before allocation
After allocation
55
Virtual (Logical) Memory Page Table
  • OS maps the virtual pages to physical page
    frames.
  • Page table is used to translate the virtual
    (logical ) address into a physical address.
  • Page table is usually stored in the main memory.
  • Example If page size 1024 bytes, then what
    physical address does virtual address 3244
    correspond to? How about virtual address 1001?
    How about virtual address 2010?

Virtual addr range
Phys addr range
0-1023 1024-2047 2048-3071 3072-4095 4096-5119 512
0-6143 6144-7167
5120-6143 2048-3071 7168-8191 0-1023
56
Translation Lookaside Buffer (TLB)
  • Usually the page table is stored in the main
    memory, hence every virtual memory reference
    causes two physical memory accesses
  • Fetch page table entry
  • Fetch data or instruction
  • By using TLB, we can reduce the number of main
    memory access.
  • TLB stores the most recently used page table
    entries in cache memory inside the CPU, which
    accelerates the virtual memory reference.

57
  • TLB Flow Chart

58
Virtual Memory
  • A hypothetical process example
  • Machine code 2 MBytes
  • Data storage 130 MBytes
  • Main Memory 128 MByte.
  • Error out of memory
  • Solution Virtual memory
  • Virtual memory is the mechanism which uses
    hard-disk space to emulate the memory size.
  • Virtual memory gives programmers and users
    the illusion that they have large memory to
    disposal.

59
Virtual Memory Example
60
What is Swapping?
  • Long term queue of processes stored on disk
  • Processes swapped in as space becomes available
  • As a process completes it is moved out of main
    memory
  • If none of the processes in memory are ready
    (i.e. all I/O blocked)
  • Swap out a blocked process to intermediate queue
  • Swap in a ready process or a new process
  • But swapping is an I/O process

61
Use of Swapping
Write a Comment
User Comments (0)
About PowerShow.com