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.

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.
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.
Chapter 8 Operating System Support
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
1 Operating Systems Ch An Overview. Architecture of Computer Hardware and Systems Software Irv Englander, John Wiley, Bare Bones Computer.
A. Frank - P. Weisberg Operating Systems Functional View of Operating System.
Silberschatz, Galvin and Gagne  Operating System Concepts Bare Machine (early 1950s) Structure  Large machines run from console  Single user.
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.
Chapter 3 Operating Systems Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Objectives To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization.
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
Chapter 1. Introduction What is an Operating System? Mainframe Systems
Operating Systems.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
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 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
Operating Systems Lecture November 2015© Copyright Virtual University of Pakistan 2 Agenda for Today Review of previous lecture Hardware (I/O, memory,
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
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.
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.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
1.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 1: Introduction What Operating Systems Do √ Computer-System Organization.
CSCE451/851 Introduction to Operating Systems
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
Introduction to Operating System (OS)
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 1: Intro (excerpt)
More examples How many processes does this piece of code create?
Computer-System Architecture
Module 2: Computer-System Structures
Operating Systems Lecture 3.
Module 2: Computer-System Structures
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Module 2: Computer-System Structures
Presentation transcript:

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 between implementations. Will use programming to enhance our understanding of basic concepts.

Today’s Topics High level view of Operating System Interrupts Context Switches Multiprogramming Timesharing Protection of system resources.

Components of a Computer System System and Application Programs Operating System Hardware (CPU, memory, I/O devices). System and application Programs User Web Browsing Text Editor Database Compiler Operating System Hardware

Components of a Computer System System and Application Programs Operating System Hardware (CPU, memory, I/O devices) System and application Programs App1App2App3App4 Web Browsing Text Editor Database iTunes Operating System Hardware

System programs make our lives easier but are not part of the Operating System. Compilers, editors, linkers, loaders, shells……. Operating System performs two functions: Allocates, schedules, manages, and protects system resources. Provides a convenient interface to system resources. Don’t want to have to write device driver to store files on disk.

Interrupts Operating systems are interrupt-driven. Perform action, such as giving control of the CPU to an application, then does not regain control of CPU until an interrupt occurs.

CPU and other devices can run concurrently. Can start I/O operation and start application executing. When requested operation completed, device generates hardware interrupt. User programs generate interrupts when making system calls (requesting service from OS) TRAP instruction. Generally termed software interrupt.

Interrupts 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 (and TRAP) has a particular offset within the table

Interrupt Vector I/O Device 1 1 I/O Device 2 2 NIC 3 TRAP

Interrupts Consider some Joe_Program (nickname is JP or Joe) executing and a device issues an interrupt. Need to jump to interrupt handler, but ……

Interrupts Consider some Joe_Program executing and a device issues an interrupt. Need to jump to interrupt handler, but …… What do we do with Joe?

Interrupts Consider some Joe_Program executing and a device issues an interrupt. Need to jump to interrupt handler, but …… What do we do with Joe? What is the minimal information to save to be able to restart his execution?

Interrupts Consider some Joe_Program executing and a device issues an interrupt. What do we do with Joe? What is the minimal information to save to be able to restart his execution? Address of the next instruction.

What if interrupt processing routine needs to use all of the CPU registers?

Better save a copy of the state of all of the registers PJ is using.

Once interrupt routine completed, how do we get JP restarted?

Restore state of registers Set the Instruction Pointer to the next instruction JP was going to execute. It should appear to JP as if its execution was never interrupted.

Saving and restoring application state is termed a context switch.

Operating System Structure A key concept of operating systems is multiprogramming (or multitasking). Technique developed because CPU and I/O device time were very expensive. Basic idea: 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. First developed for batch systems in the 60s. No interactions between user and programs.

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

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. Each user is executing a shell program. Takes user command and executes it. Waits for the next command.

Time-Sharing Systems–Interactive Computing 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 Files

Protection of System Resources Based on dual-mode execution: kernel mode and user mode. Privileged instructions can be issued only in kernel mode. Mode bit in PSW, checked on every instruction.

User process executing System Call Trap, mode bit = 0 Execute System Call Return. Mode bit = 1 Continue Execution Mode Bit=1

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

Memory Protection 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?