OPERATING SYSTEM LESSON 2. INTRODUCTION TO OPERATING SYSTEM Computer Hardware’s complexity Operating Systems (OS) hide this complexity from users OS manages.

Slides:



Advertisements
Similar presentations
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Advertisements

EEE 435 Principles of Operating Systems Principles and Structure of I/O Software (Modern Operating Systems 5.2 & 5.3) 5/22/20151Dr Alain Beaulieu.
Lecture 1: History of Operating System
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
OS Spring’03 Introduction Operating Systems Spring 2003.
1 I/O Devices Controller: physically controls the devices Devices are diverse and complicated Present simpler interface to OS E.g, convert a linear sector.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
1 Introduction Chapter What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
OS Spring’04 Introduction Operating Systems Spring 2004.
1 What is an operating system? CSC330Patricia Van Hise.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
Systems Software Operating Systems.
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
System Calls 1.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
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.
1 CS503: Operating Systems Spring 2014 Dongyan Xu Department of Computer Science Purdue University.
Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed.
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Composition and Evolution of Operating Systems Introduction to Operating Systems: Module 2.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Introduction to Operating Systems Chapter 1. cs431 -cotter2 Lecture Objectives Understand the relationship between computing hardware, operating system,
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.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
2: Computer-System Structures
1 Operating System Overview. 2 Today’s Objectives Explain the main purpose of operating systems and describe milestones of OS evolution Explain fundamental.
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.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 E-Main: Phone:
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.
CE Operating Systems Lecture 3 Overview of OS functions and 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.
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.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
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.
IT3002 Computer Architecture
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Chapter 1 Introduction  What is an operating system  History of operating systems  The operating system zoo  Computer hardware review  Operating system.
بسم الله الرحمن الرحيم MEMORY AND I/O.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
I/O Software CS 537 – Introduction to Operating Systems.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Operating Systems: History, Hardware & Concepts Ch 1.4 & 1.5 Thursday, January 18, 2007.
Introduction to Operating Systems Concepts
Computer Architecture
Operating Systems Chapter 5: Input/Output Management
Today’s agenda Hardware architecture and runtime system
Process Description and Control
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Chapter 5 Input/Output Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Presentation transcript:

OPERATING SYSTEM LESSON 2

INTRODUCTION TO OPERATING SYSTEM Computer Hardware’s complexity Operating Systems (OS) hide this complexity from users OS manages all hardware devices and provide user programs with a simpler interface to the hardware. 2

L AYERS OF A C OMPTUTER S YSTEMS 3

S YSTEM P ROGRAMS System programs consist of operating system and the rest of the system software. Command interpreter, compilers, database managament systems, editors are called SHELL. The operating system is the system software that runs in kernel mode or supervisor mode. Compilers and editors are the system software that run in user mode. 4

W HAT D OES O PERATING S YSTEM D O ? Operating systems perform two basically unrelated functions: Extending the machine Managing resources 5

E XTENDING M ACHINE Generally programmer does not want to get too deeply involved with the programming of disks or other hardware devices. Instead, the programmer wants is a simple, high- level abstraction to deal with. A typical abstraction of a disk would be that it contains a collection of named files. OS hides the details of the hardware from the programmer and presents a nice, simple view of named files that can be read and written. OS also conceals a lot of unpleasant business concerning interrupts, timers, memory management, and other low-level features. 6

M ANAGING R ESOURCES Computers consist of processors, memories, timers, disks, mouses, network interfaces, printers, and a wide variety of other devices. The job of the operating system is to provide an orderly and controlled allocation of the processors, memories, and I/O devices among the various programs competing for them. 7

M ANAGING R ESOURCES Printer Example:Imagine what would happen if three programs running on some computer all tried to print their output simultaneously on the same printer. The first few lines of printout might be from program 1, the next few from program 2, then some from program 3, and so forth. The result would be chaos. The operating system can bring order to the potential chaos by buffering all the output destined for the printer on the disk. When one program is finished, the operating system can then copy its output from the disk file where it has been stored to the printer. 8

M ANAGING R ESOURCES Managing and protecting memory in a multi-user system OS keeps track of who is using which resource, to grant resource requests and to prevent conflicting requests from different programs and users. Resource management includes multiplexing (sharing) resources in two ways: in time and in space. CPU usage as the way of time multiplexing Main memory or disk usage as the way of space multiplexing 9

COMPUTER HARWARE REVIEW An operating system is intimately (closely) tied to the hardware of the computer it runs on. It makes easy the usage of the computer’s instruction set and manages its resources. OS must know a great deal about the hardware 10

1.P ROCESSORS The “brain” of the computer is the CPU. It fetches instructions from memory and executes them. To improve performance, many modern CPUs have facilities for executing more than one instruction at the same time. For example, a CPU might have separate fetch, decode, and execute units, so that while it was executing instruction n, it could also be decoding instruction n + 1 and fetching instruction n + 2. Such an organization is called a pipeline. 11

Every CPU type has a specific intruction sets. A Pentium CPU cannot execute SPARC CPU programs and a SPARC CPU cannot execute PentiumCPU programs. Accesing memory takes too much time. Thus CPU has registers which are very fast memory units in CPU. Instruction sets have instructions to load data from memory to register or store data from register to memory. 12

Most computers have several special registers that are visible to the programmer. Program Counter, which contains the memory address of the next instruction to be fetched. Stack pointer, which points to the top of the current stack in memory. The stack contains one frame for each procedure that has been entered but not yet exited. PSW (Program Status Word) register contains the condition code bits, the CPU priority, the mode (user or kernel), and various other control bits. User programs may normally read the entire PSW but typically may write only some of its fields. 13

Most CPUs have two modes, kernel mode and user mode. Usually a bit in the PSW controls the mode. When running in kernel mode, the CPU can execute every instruction in its instruction set and use every feature of the hardware. The operating system runs in kernel mode and access to the complete hardware. In contrast, user programs run in user mode, which permits only a subset of the instructions to be executed and a subset of the features to be accessed. Generally, all instructions involving I/O and memory protection are disallowed in user mode. To obtain services from the operating system, a user program must make a system call, which traps into the kernel and invokes the operating system. The TRAP instruction switches from user mode to kernel mode and starts the operating system. 14

2.M EMORY The memory system is constructed as a hierarchy of layers. 15

Metal platters Cylinders Tracks Sectors D ISK STRUCTURE 16

M AIN MEMORY If one program is blocked waiting for a disk read to complete, another program can use the CPU, giving a better CPU utilization. However, with two or more programs in main memory at once, two problems must be solved: How to protect the programs from one another and the kernel from them all. How to handle reallocation. 17

When a program is compiled and linked, the compiler and linker do not know where the program will be loaded in physical memory. They usually assume it will start at address 0, and just put the first instruction there. Suppose that the first instruction fetches a word from memory address 10,000. Now suppose that the entire program and data are loaded starting at address 50,000. When the first instruction executes, it will fail because it will reference the word at 10,000, instead of the word at 60,000. MMU (Memory Management Unit) converts virtual adresses to phisical adresses. P HISICAL AND VIRTUAL ADRESSES 18

Main memory equipped with two special registers, the base register and the limit register. 19

I/O Devices are also resource that the operating system must manage. I/O devices generally consist of two parts: a controller and the device itself. The controller is a chip or a set of chips on a plug-in board that physically controls the device. It accepts commands from the operating system, for example, to read data from the device, and carries them out. 3. I/O D EVICES 20

Different software is needed to control each controller because each type of controller is different. The software that talks to a controller, giving it commands and accepting responses, is called a device driver. Each controller manufacturer has to supply a driver for each operating system it supports. Thus a scanner may come with drivers for Windows XP, Windows 7, and UNIX, for example. D EVICE D RIVERS 21

I NPUT O UTPUT O PERATION T YPES Input and output can be done in three different ways: 1. In the simplest method, a user program issues a system call, then kernel translates it into a procedure call to the appropriate driver. The driver then starts the I/O and continuously (in a loop) checks the device to see if it is done (usually there is some bit that indicates that the device is still busy). When the I/O has completed, the driver returns the data to operating system then returns control to the caller. This method is called busy waiting and has the disadvantage of tying up the CPU checking the device until it is finished. 22

I NPUT O UTPUT O PERATION T YPES 2. The second method is that driver starts the device and wants an interrupt when the data transfer is finished. Until driver returns, the operating system blocks the caller and looks for other work to do. When the controller detects the end of the transfer, it generates an interrupt to signal completion. 23

I NPUT O UTPUT O PERATION T YPES 3. The third method for doing I/O makes use of a special DMA (Direct Memory Access) chip that can control the flow of bits between memory and some controller without constant CPU intervention. The CPU sets up the DMA chip telling it how many bytes to transfer, the device and memory addresses involved, and the direction, and lets it go. When the DMA chip is done, it sends an interrupt. 24

BUSES 25

QUESTIONS ??? 26