Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. E-Mail: dickens@umcs.maine.edu Phone: 581-3967.

Slides:



Advertisements
Similar presentations
Computer-System Structures Er.Harsimran Singh
Advertisements

Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
OS Spring’03 Introduction Operating Systems Spring 2003.
Abhinav Kamra Computer Science, Columbia University 2.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 2: Computer-System Structures.
Computer-System Structures
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures 1/31/03 Computer System Operation I/O Structure.
A. Frank - P. Weisberg Operating Systems Functional View of Operating System.
1/21/2010CSCI 315 Operating Systems Design1 Computer System Structures Notice: The slides for this lecture have been largely based on those accompanying.
Chapter 2: Computer-System Structures
What do operating systems do? manage processes manage memory and computer resources provide security features execute user programs make solving user.
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 1: Introduction.
Chapter 1. Introduction What is an Operating System? Mainframe Systems
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
2.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 2: Computer-System Structures Computer System Operation I/O Structure.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures
Thanks to Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2 Computer-System Structures n Computer System Operation n I/O Structure.
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 E-Main: Phone:
Chapter 2: Computer-System Structures 2.1 Computer System Operation 2.5 Hardware Protection 2.6 Network Structure.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Chapter 1: Introduction. 1.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 1: Introduction What Operating Systems Do Computer-System.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Review of Computer System Organization. Computer Startup For a computer to start running when it is first powered up, it needs to execute an initial program.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures(Hardware) or Architecture or Organization Computer System Operation I/O Structure Storage Structure Storage Hierarchy.
Chapter 2. Computer-System Structure Device controllers: synchronize and manage access to devices.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 1: Introduction.
1.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 1: Introduction What Operating Systems Do √ Computer-System Organization.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Introduction to Operating Systems Concepts
Chapter 2: Computer-System Structures(Hardware)
Applied Operating System Concepts
Chapter 2: Computer-System Structures
Protection of System Resources
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer System Overview
Computer-System Architecture
Module 2: Computer-System Structures
Operating Systems.
Process Description and Control
Architectural Support for OS
Operating Systems Lecture 3.
Module 2: Computer-System Structures
Architectural Support for OS
CS 143A Principles of Operating Systems
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Presentation transcript:

Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. E-Mail: dickens@umcs.maine.edu Phone: 581-3967 Textbook: Operating System Concepts, 7th edition, Silberschatz, Galvin, and Gagne. URL: http://umcs.maine.edu/~dickens/COS431/COS431.html

Components of a Computer System A computer system consists of hardware system programs application programs

System Components Hardware: Physical Devices: Memory, CPU, I/O devices…. Micro-architecture: Executes machine-level instructions. Hardware or firmware (microcode). Machine language: Hardware and instructions visible to an assembly language program.

Components of a Computer System Operating System: Hides complexity of hardware and provides simplified set of instructions (API, Application Program Interface).

Components of a Computer System System programs: Generally execute in user mode. (Why?) Command interpreter (shell), compilers, editors, …..

So What is an Operating System? It is an extended machine Hides the messy details. Presents user with a virtual machine, easier to use Don’t want to program I/O devices, handle interrupts, etc. It is a resource manager (and scheduler) Each program (process or thread) gets time with the resource E.g., CPU, I/O devices, memory Each program gets space on the resource E.g., Disk space.

So What is an Operating System? Control Program Manages the execution of user applications to prevent errors and improper use of system. Program A should not be able to access memory of an unaffiliated program B. No one user should be able to starve OS and/or other users of system resources (e.g., CPU). No user should be able to trash I/O devices (deliberately or by error).

Computer Hardware Review Monitor Bus Components of a simple personal computer

Special registers: Program counter. Stack pointer. Process Status Word (PSW).

CPU and other devices can run concurrently. When device needs attention, it issues an interrupt. Character transferred from keyboard to system buffer. Disk read/write completed. Page fault. User programs generate interrupts when making system calls. Trap instruction. Generally termed software interrupt.

Interrupts Operating systems are interrupt-driven. Perform action, such as executing a process, then wait until receives an interrupt. Makes developing an operating system a very complex task. When an interrupt is generated the CPU stops what it is doing and execution is transferred to the appropriate interrupt handler. Addresses of interrupt handlers are found in the interrupt vector. Table of addresses Each device has a particular offset within the table.

Interrupts The state of the interrupted computation must be saved before interrupt can be processed. This state is restored when the OS returns from the interrupt handler. Termed a context switch.

I/O Devices Each type of device has its own controller that accepts and carries out commands from the operating system. Because each controller is different, manufacturer provides device driver for each operating system it supports. OS talks to device driver.

I/O Operation Program makes I/O request (e.g., read/write to/from a file). OS loads appropriate control registers. Controller reads registers and determines the operation requested. Starts data transfer from the device to its local buffer. When completed, generates an interrupt. State of currently executing program is saved. Interrupt handled by the device driver. Device driver returns control to the OS. OS restarts suspended program.

(a) Steps in starting an I/O device and getting interrupt (b) (a) Steps in starting an I/O device and getting interrupt (b) How the CPU is interrupted

Three I/O Methods Synchronous Asynchronous DMA (Direct Memory Access).

Three I/O Methods Synchronous After I/O starts, control returns to user program only upon I/O completion. Wait instruction idles the CPU until the next interrupt Wait loop (contention for memory access). Generally a bad idea.

I/O Methods Asynchronous I/O completion signaled by an interrupt. After I/O starts, control returns to user program without waiting for I/O completion. I/O completion signaled by an interrupt. More complicated than synchronous I/O.

Two of the I/O Methods Synchronous Asynchronous

I/O Methods DMA Used for high-speed I/O devices able to transmit information at close to memory speeds. Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention. Only one interrupt is generated per block, rather than the one interrupt per byte.

I/O Methods Asynchronous I/O requires the ability to handle multiple I/O commands concurrently. Uses device status table. Queue waiting requests.

Device-Status Table

Storage Hierarchy Storage systems organized in hierarchy. Speed Cost Capacity

Storage-Device Hierarchy

Caching Idea is to hold heavily used data in the memory cache to avoid going to main memory on each access (up to 500 times faster). Typical instruction cycle: Fetch instruction from memory Fetch operands from memory Execute instruction. Many machines have instruction and data caches. On each memory access, the hardware checks the cache to see if required data is already is there.

Caching If in cache, use it. If not in cache, retrieve from main memory and keep copy in the cache. On many machines, main memory is used to cache frequently used disk blocks. Caching works well when the application exhibits “locality of reference” i.e., data used in the recent past will be used again in the near future.

Performance of Various Levels of Storage

Operating System Structure A key concept of operating systems is multiprogramming. Keep multiple jobs in memory. When one job blocks on I/O, the CPU immediately switches to another job. This keeps CPU and I/O devices fully utilized. Without multiprogramming, CPU would be idle during I/O operations. Developed in the 60s when most computers were batch systems. Several jobs were batched together and executed. No interactions between user and job.

Multiprogramming Batch Systems Problem: CPU and I/O very expensive. Solution: Multiplex CPU between multiple jobs.

OS Features Needed for Multiprogramming Use of disk space to hold jobs not in system. Job scheduling: Choose jobs to bring into memory. Memory management – the system must allocate the memory to several jobs. CPU scheduling – the system must choose among several jobs ready to run. Allocation of devices.

Time-Sharing Systems–Interactive Computing Logical extension of multiprogramming. The CPU is multiplexed among several jobs that are kept in memory and on disk (the CPU is allocated to a job only if the job is in memory). A job swapped in and out of memory to the disk. On-line communication between the user and the system is provided; when the operating system finishes the execution of one command, it seeks the next “control statement” from the user’s keyboard. i.e., the shell Goal is to give the illusion that each user has own machine. Response time is a priority.

Protection of System Resources I/O Devices Memory CPU Based on different modes of operation: kernel mode and user mode. Privileged instructions can be issued only in kernel mode. Mode bit in PSW, checked on every instruction.

Protection of I/O Devices All I/O instructions are privileged instructions. Only accessed through system calls.

Memory Protection Memory outside the defined range is protected. Must provide memory protection for the interrupt vector, interrupt service routines, and other applications address space. Two registers that determine the range of legal addresses a program may access: Base register – holds the smallest legal physical memory address. Limit register – contains the size of the range Memory outside the defined range is protected.

Use of A Base and Limit Register

Hardware Address Protection

CPU (and OS) Protection Keep user from monopolizing CPU. Ensure OS regains control of CPU.

CPU Protection Timer – interrupts computer after specified period to ensure operating system maintains control. Timer is decremented every clock tick. When timer reaches the value 0, an interrupt occurs. Timer commonly used to implement time sharing.

Privileged Instructions Load base and limit registers?

Privileged Instructions Load base and limit registers? Set the system timer?

Privileged Instructions Load base and limit registers? Set the system timer? Read the system clock?

Privileged Instructions Set the system timer? Read the system clock? Load base and limit registers? Open a file?

Privileged Instructions Load base and limit registers? Set the system timer? Read the system clock? Open a file? Compile a program and create executable?

Privileged Instructions Load base and limit registers? Set the system timer? Read the system clock? Open a file? Compile a program and create executable? Enable/disable interrupts?