COSC 4P13 - PowerPoint PPT Presentation

1 / 47
About This Presentation
Title:

COSC 4P13

Description:

An intensive study of computer operating system design. Multiprogramming. Time-sharing ... I/O logic interact with CPU via control bus ... Interrupts improve CPU usage ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 48
Provided by: coscB
Category:

less

Transcript and Presenter's Notes

Title: COSC 4P13


1
COSC 4P13
  • Operating Systems Design and Implementation

2
Course Description(1)
  • The Goals for this course
  • Understand UNIX
  • Understand Operating Systems
  • Prerequisites
  • COSC 2P13 Introduction to Operating Systems
  • COSC 2P91 Procedural Programming
  • COSC 1P12 Computer Organization and Assembly
    Language

3
Course Description(2)
  • An intensive study of computer operating system
    design
  • Multiprogramming
  • Time-sharing
  • Real-time processing
  • Job and task control
  • Synchronization of concurrent processes and
    processors
  • Resource scheduling
  • Protection
  • Management of hierarchical storage.

4
How to study this course
  • Read and remember
  • Read the book, remember the concepts and commands
  • Think
  • Think operating systems as natural administrative
    agents
  • Practice
  • Coding with UNIX, use and understand of UNIX
    commands and get the results

5
The Textbook Used
  • Uresh Vahalia, UNIX Internals The New Frontiers,
    Prentice Hall, 1996
  • Why we use this book?
  • UNIX is one of the popular operating systems of
    the world.
  • If you understand UNIX, you can understand other
    operating systems.

6
References
  • William Stallings, Operating Systems,4th Ed.,
    Prentice Hall,2000
  • A. Tanenbaum, Modern Operating Systems, 2nd ed.
    Prentice Hall 2001
  • Kay A. Robbins and Steven Robbins, Practical UNIX
    Programming, Prentice Hall,1996
  • W. R. Stevens, Advanced Programming in the UNIX
    Environment, Addison Wesley, 1992

7
Operating System Overview
  • Computer System
  • Computer Hardware
  • Components
  • Registers
  • Instruction execution
  • Interrupt
  • Memory Hierarchy and I/O
  • Operating System
  • Services of OS
  • Major Achievements
  • Characteristics of Modern OS

8
Computer System
Application Programs
Utilities
Operating-System
Computer Hardware
9
Computer Hardware
  • Processor
  • Main Memory
  • referred to as real memory or primary memory
  • volatile
  • I/O modules
  • secondary memory devices
  • communications equipment
  • terminals
  • System interconnection
  • communication among processors, memory, and I/O
    modules

10
Computer Componentstop-level view
Memory
  • MAR - Memory Address Register
  • address for next read or write
  • MBR - Memory Buffer Register
  • data to be written into memory
  • receives data read from memory
  • I/OAR - I/O Address
  • specifies a particular I/O device
  • I/OBR - I/O Buffer
  • exchange of data between an I/O module and the
    processor

.
.
.
CPU
Instruction
MAR
PC
Instruction
Instruction
.
IR
MBR
.
I/O AR
Data
I/O BR
Data
Data
I/O Module
Data
.
.
.
.
.
Buffers
11
I/O Module Structure
  • Data to/from system bus are buffered in data
    register(s)
  • Status/Control register(s)
  • I/O logic interact with CPU via control bus
  • Contains logic specific to the interface of each
    device

12
Processor Registers
  • User-visible registers
  • Data Registers
  • Address Registers
  • index register
  • segment pointer
  • stack pointer
  • Condition Codes or Flags
  • Control and Status Registers
  • Program Counter (PC)
  • Instruction Register (IR)
  • Program Status Word (PSW)

13
Instruction Execution
  • Processor executes instructions in a program
  • Instructions are fetched from memory one at a time

Fetch Cycle
Execute Cycle
Fetch Next Instruction
Execute Instruction
START
HALT
14
Instruction Fetch and Execute
  • The processor fetches the instruction from memory
  • Program counter (PC) holds address of the
    instruction to be fetched next
  • Program counter is incremented after each fetch

15
Instruction Register
  • Fetched instruction is placed here
  • Types of instructions
  • Processor-memory
  • transfer data between processor and memory
  • Processor-I/O
  • data transferred to or from a peripheral device
  • Data processing
  • arithmetic or logic operation on data
  • Control
  • alter sequence of execution

16
Interrupts
  • An interruption of the normal processing of
    processor
  • Improves processing efficiency
  • Allows the processor to execute other
    instructions while an I/O operation is in
    progress
  • A suspension of a process caused by an event
    external to that process and performed in such a
    way that the process can be resumed

17
Classes of Interrupts
  • Program
  • arithmetic overflow
  • division by zero
  • execute illegal instruction
  • reference outside users memory space
  • Timer
  • I/O
  • Hardware failure

18
Instruction Cycle with Interrupts
Fetch Cycle
Execute Cycle
Interrupt Cycle
Interrupts Disabled
Execute Instruction
Fetch Next Instruction
Check for Interrupt Process Interrupt
START
Interrupts Enabled
HALT
19
Interrupt Handler
  • A program that determines nature of the interrupt
    and performs whatever actions are needed
  • Control is transferred to this program
  • Generally part of the operating system

20
Interrupt Cycle
  • Processor checks for interrupts
  • If no interrupts fetch the next instruction for
    the current program
  • If an interrupt is pending, suspend execution of
    the current program, and execute the interrupt
    handler

21
Simple Interrupt Processing
22
Interrupts improve CPU usage
  • I/O pgm prepares the I/O module and issues the
    I/O command (eg to printer)
  • I/O pgm branches to user pgm
  • User code gets executed during I/O operation (eg
    printing) no waiting
  • User pgm gets interrupted (x) when I/O operation
    is done and branches to interrupt handler to
    examine status of I/O module
  • Execution of user code resumes

23
Multiple interrupts sequential order
  • Disable interrupts during an interrupt
  • Interrupts remain pending until the processor
    enables interrupts
  • After interrupt handler routine completes, the
    processor checks for additional interrupts

24
Multiple Interrupts priorities
  • Higher priority interrupts cause lower-priority
    interrupts to wait
  • Causes a lower-priority interrupt handler to be
    interrupted
  • Example when input arrives from communication
    line, it needs to be absorbed quickly to make
    room for more input

25
Cache/Main-Memory Structure
Memory Address
Slot Number
Tag
Block
0
0
1
1
2
Block (k words)
2
3
C - 1
Block Length (k words)
(b) Cache
Block
2n - 1
Word Length
(a) Main Memory
26
Cache Design
  • Cache size
  • Block size
  • Mapping function
  • Replacement algorithm

27
I/O Techniques
  • Programmed I/O
  • Interrupt-Driven I/O
  • Direct Memory Access

28
Programmed I/O
Insert Read command to I/O Module
  • I/O module performs the action, not the processor
  • Sets appropriate bits in the I/O status register
  • No interrupts occur
  • Processor is kept busy checking status

CPU I/O
Read Status of I/O Module
I/O CPU
Not Ready
Error Condition
Check Status
Ready
Read word from I/O Module
I/O CPU
Write word into memory
CPU Memory
No
Done?
Yes
Next Instruction
29
Interrupt-Driven I/O
Insert Read command to I/O Module
  • Processor is interrupted when I/O module ready to
    exchange data
  • Processor is free to do other work
  • No needless waiting
  • Consumes a lot of processor time because every
    word read or written passes through the processor

CPU I/O
Do something else
Read Status of I/O Module
Interrupt
I/O CPU
Error Condition
Check Status
Ready
Read word from I/O Module
I/O CPU
Write word into memory
CPU Memory
No
Done?
Yes
Next Instruction
30
Direct Memory Access
Issue Read block command to I/O module
  • Transfers a block of data directly to or from
    memory
  • An interrupt is sent when the task is complete
  • The processor is only involved at the beginning
    and end of the transfer

CPU DMA
Do something else
Read status of DMA module
Interrupt
DMA CPU
Next Instruction
31
Operating System
  • Making computing power available to users by
    controlling the hardware
  • a program that controls execution of application
    programs
  • an interface between the user and hardware
  • Directs the processor in the use of system
    resources
  • Directs the processor when executing other
    programs

32
Services Provided by the OS
  • Facilities for Program creation
  • editors, compilers, linkers, and debuggers
  • Program execution
  • loading in memory, I/O and file initialization
  • Access to I/O and files
  • deals with the specifics of I/O and file formats
  • System access
  • Protection of access to resources and data
  • Resolves conflicts for resource contention

33
Services Provided by the OS
  • Error Detection
  • internal and external hardware errors
  • memory error
  • device failure
  • software errors
  • arithmetic overflow
  • access forbidden memory locations
  • Inability of OS to grant request of application
  • Error Response
  • simply report error to the application
  • Retry the operation
  • Abort the application

34
Services Provided by the OS
  • Accounting
  • collect statistics on resource usage
  • monitor performance (eg response time)
  • used for system parameter tuning to improve
    performance
  • useful for anticipating future enhancements
  • used for billing users (on multiuser systems)

35
Operating System as a Resource Manager
Computer System
Memory
I/O Controller
Operating System Software
I/O Controller
.
.
Programs and Data
.
I/O Controller
.
.
.
Processor
Processor
OS
Programs
Data
36
Ability to Evolve
  • Must be able to adapt to hardware upgrades and
    new types of hardware. Examples
  • Character vs graphic terminals
  • Introduction of paging hardware
  • Must be able to offer new services, eg internet
    support

37
Major Achievements
  • Processes
  • Memory Management
  • Information protection and security
  • Scheduling and resource management
  • System structure

38
Memory Management
  • Process isolation
  • Automatic allocation and management
  • Support for modular programming
  • Protection and access control
  • Long-term storage

39
Virtual Memory
  • Allows programmers to address memory from a
    logical point of view
  • While program is running portions of the program
    and data are kept in blocks on disk

40
File System
  • Implements long-term store
  • Information stored in named objects called files

41
Categories of Security and Protection
  • Access control
  • regulate user access to the system
  • Information flow control
  • regulate flow of data within the system and its
    delivery to users
  • Certification
  • proving that access and flow control perform
    according to specifications

42
Scheduling and Resource Management
  • Fairness
  • give equal and fair access to all processes
  • Differential responsiveness
  • discriminate between different classes of jobs
  • Efficiency
  • maximize throughput, minimize response time, and
    accommodate as many uses as possible

43
Characteristics of Modern Operating Systems
  • Microkernel architecture
  • assigns only a few essential functions to the
    kernel
  • address space
  • interprocess communication (IPC)
  • basic scheduling

44
Characteristics of Modern Operating Systems
  • Multithreading
  • process
  • is divided into threads that can run
    simultaneously
  • Process is a collection of one or more threads
  • Thread
  • dispatchable unit of work
  • executes sequentially and is interruptable

45
Characteristics of Modern Operating Systems
  • Symmetric multiprocessing
  • there are multiple processors
  • these processors share the same main memory and
    I/O facilities
  • All processors can perform the same functions

46
Characteristics of Modern Operating Systems
  • Distributed operating systems
  • provides the illusion of a single main memory
  • used for distributed file system

47
Characteristics of Modern Operating Systems
  • Object-oriented design
  • used for adding modular extensions to a small
    kernel
  • enables programmers to customize an operating
    system without disrupting system integrity
Write a Comment
User Comments (0)
About PowerShow.com