CS 423 - Fall 2011 CS 423 – Operating Systems Design Lecture 2 – Concepts Review Klara Nahrstedt Fall 2011.

Slides:



Advertisements
Similar presentations
Khaled A. Al-Utaibi  Computers are Every Where  What is Computer Engineering?  Design Levels  Computer Engineering Fields  What.
Advertisements

CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
Computer System Overview
COS318 Lec 21 Operating System Structures Vivek Pai Princeton University.
3: OS Structures 1 OPERATING SYSTEM STRUCTURES PROCESS MANAGEMENT A process is a program in execution: (A program is passive, a process active.) A process.
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
OPERATING SYSTEM LESSON 2. INTRODUCTION TO OPERATING SYSTEM Computer Hardware’s complexity Operating Systems (OS) hide this complexity from users OS manages.
COS318 Lec 21 Operating System Structures Vivek Pai Princeton University.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
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.
1 CS 333 Introduction to Operating Systems Class 2 – OS-Related Hardware & Software The Process Concept Jonathan Walpole Computer Science Portland State.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
2: OS Structures 1 Jerry Breecher OPERATING SYSTEMS STRUCTURES.
Operating Systems Concepts Professor Rick Han Department of Computer Science University of Colorado at Boulder.
Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()
OS Spring’03 Introduction Operating Systems Spring 2003.
Computer System Organization S H Srinivasan
Figure 1.1 Interaction between applications and the operating system.
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.
Chapter 6 Implementing Processes, Threads, and Resources.
Lecture 1: Introduction CS170 Spring 2015 Chapter 1, the text book. T. Yang.
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
OS Spring’04 Introduction Operating Systems Spring 2004.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
Chapter 2: Computer-System Structures
Chapter 2 The OS, the Computer, and User Programs Copyright © 2008.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
Computer Organization
CS 6560 Operating System Design Lecture 1. Overview 1.1 What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4.
System Calls 1.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: System Structures.
1 CS503: Operating Systems Spring 2014 Dongyan Xu Department of Computer Science Purdue University.
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,
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
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.
Chapter 1 Introduction 1.1 What is an operating system
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 E-Main: Phone:
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Operating Systems Lecture November 2015© Copyright Virtual University of Pakistan 2 Agenda for Today Review of previous lecture Hardware (I/O, memory,
Copyright ©: University of Illinois CS 241 Staff1 Operating Systems Orientation.
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.
1.4 Hardware Review. CPU  Fetch-decode-execute cycle 1. Fetch 2. Bump PC 3. Decode 4. Determine operand addr (if necessary) 5. Fetch operand from memory.
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.
Lecture on Central Process Unit (CPU)
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Operating System Overview Tarek Abdelzaher Lawrence Angrave Vikram Adve.
Chapter 1 Introduction  What is an operating system  History of operating systems  The operating system zoo  Computer hardware review  Operating system.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Operating Systems: History, Hardware & Concepts Ch 1.4 & 1.5 Thursday, January 18, 2007.
Introduction to Operating Systems Concepts
Operating System Overview
Jonathan Walpole Computer Science Portland State University
Operating Systems: A Modern Perspective, Chapter 6
OS Virtualization.
Today’s agenda Hardware architecture and runtime system
Lecture Topics: 11/1 General Operating System Concepts Processes
Today’s agenda Hardware architecture and runtime system
Operating Systems Lecture 3.
Implementing Processes, Threads, and Resources
CS510 Operating System Foundations
OPERATING SYSTEMS STRUCTURES
Outline Process Management Process manager Hardware process
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Chapter 1: Introduction CSS503 Systems Programming
Introduction and Overview
Presentation transcript:

CS Fall 2011 CS 423 – Operating Systems Design Lecture 2 – Concepts Review Klara Nahrstedt Fall 2011

CS Fall 2011 Overview Administrative Issues System Concepts Review (cs231, cs232, cs241) Read Tanenbaum textbook  Chapter Sections:

CS Fall 2011 Administrative Issues MPs  Find MP partner (s) and submit form from compass about the groups today 8/24  MP1 will be posted on Monday 8/29 (not graded, but very strongly recommended) Proficiency Exam  Student will do MP4 and final exam  Student needs to get VMware server account and should contact TAs to arrange for the environment ahead of MP4 posting time Review cs231/232/241 concepts

CS Fall 2011 Typical Computer System Operating System Software Programs and data Memory CPU OS Apps Data Network

CS Fall 2011 OS Major Components Resource management  CPU Process and Thread Management  Memory Memory Management  Device I/O Management (Disk, Network, Camera, Microphone, Timers, Power) File system Bootstrapping

CS Fall 2011 Processors Each CPU has a specific set of instructions All CPUs contain  General registers inside to hold key variables and temporary results  Special registers visible to the programmer Program counter contains the memory address of the next instruction to be fetched Stack pointer points to the top of the current stack in memory PSW (Program Status Word) contains the condition code bits which are set by comparison instructions, the CPU priority, the mode (user or kernel) and various other control bits.

CS Fall 2011 How Processors Work Execute instructions  CPU cycles Fetch (from mem)  decode  execute Program counter (PC)  When is PC changed? Pipeline: fetch n+2 while decode n+1 while execute n  Two modes of CPU (why?) User mode (a subset of instructions) Privileged mode (all instruction)  Trap (special instruction)

CS Fall 2011 Processor (CPU) Management Goals  Time sharing  Multiple CPU allocations Issues  Do not waste CPU resources  Synchronization and mutual exclusion  Fairness  Deadlock free Analogy: Video Games

CS Fall 2011 Memory Access Memory read:  Assert address on address lines  Wait till data appear on data line  Much slower than CPU! How many memory access for one instruction?  Fetch instruction  Fetch operand (0, 1 or 2)  Write results (0 or 1) How to speed up instruction execution?

CS Fall 2011 CPU Cache Cache hit:  no need to access memory Cache miss:  data obtained from memory, possibly update cache

Source: Magnetic Tape GB 100 sec access time Magnetic Disk GB 10 msec access time Registers < 1KB capacity 1 nsec access time Cache 4 MB capacity 2 nsec access time Main Memory MB 10 nsec access time

CS Fall 2011 Memory Management How to protect programs from each other? How to handle relocation ? Base register Limit register Check and Mapping of Addresses  Virtual Address - Physical Address  Memory Management Unit (MMU – located on CPU chip or close to it Performance effects on memory system  Cache  Context switch

CS Fall 2011 Memory Management Goals  Support programs to run  Allocation and management  Transfers from and to secondary storage Issues  Efficiency & convenience  Fairness  Protection Tape 100Mx Disk 10Mx Memory 200x L2 10x Register

CS Fall 2011 I/O Device Management Goals  Interactions between devices and applications  Ability to plug in new devices Issues  Efficiency  Fairness  Protection and sharing User 1User n... Library support I/O device I/O device... Driver

CS Fall 2011 I/O Devices Controller  Example: Disk Controller  Controllers are complex converting OS request into device parameters  Controllers often contain small embedded computers Device  Fairly simple interfaces and standardized  IDE (Integrated Drive Electronics) – standard disk type on Pentiums and other computers

CS Fall 2011 I/O Devices Device Driver  Needed since each type of controller may be different.  Software that talks to a controller, giving it comments and accepting responses  Each controller manufacturer supplies a driver for each OS it supports (e.g., drivers for Windows 7, UNIX)

CS Fall 2011 Methods for I/O How device driver talks to controller  Busy wait  Interrupt  DMA

CS Fall 2011 File System Example File system for a university department

CS Fall 2011 File System A typical file system  Open a file with authentication  Read/write data in files  Close a file Can the services be moved to user level? User 1User n... File system services File...

CS Fall 2011 Bootstrapping Power up a computer Processor reset  Set to known state  Jump to ROM code Load in the boot loader from stable storage Jump to the boot loader Load the rest of the operating system Initialize and run Boot loader OS sector 1 OS sector 2 OS sector n Boot loader

CS Fall 2011 From Lecture 1: What is OS Code that:  Sits between programs & hardware  Sits between different programs  Sits betweens different users Job of OS:  Manage hardware resources Allocation, protection, reclamation, virtualization  Provide services to app. How? -- System Call Abstraction, simplification, standardization Application OS Hardware

CS Fall 2011 A peek into Unix/Linux Application Portable OS Layer Libraries Machine-dependent layer User space/level Kernel space/level User/kernel modes are supported by hardware Some systems do not have clear user-kernel boundary

CS Fall 2011 Unix: Application Application (E.g., emacs) Portable OS Layer Libraries Machine-dependent layer Written by programmer Compiled by programmer Uses function calls

CS Fall 2011 Unix: Libraries Application Portable OS Layer Libraries (e.g., stdio.h) Machine-dependent layer Provided pre-compiled Defined in headers Input to linker (compiler) Invoked like functions May be “resolved” when program is loaded

CS Fall 2011 Typical Unix OS Structure Application Portable OS Layer Libraries Machine-dependent layer system calls (read, open..) All “high-level” code

CS Fall 2011 Typical Unix OS Structure Application Portable OS Layer Libraries Machine-dependent layer Bootstrap System initialization Interrupt and exception I/O device driver Memory management Kernel/user mode switching Processor management

CS Fall 2011 Steps in Making a System Call Example: read (fd, buffer,nbytes)

CS Fall 2011 System Calls (POSIX) System calls for process management Example of fork used in simplified shell program #define TRUE 1 while(TRUE) { type_prompt(); read_command(command, parameters); if (fork()!=0) { /* some code*/ waitpid(-1,&status, 0);} else { /* some code*/ execve(command, parameters,0); }

CS Fall 2011 System Calls (POSIX) System calls for file/directory management  fd=open(file,how,….)  n=wride(fd,buffer,nbytes)  s=rmdir(name) Miscellaneous  s=kill(pid,signal)  s=chmod(name,mode)

CS Fall 2011 System Calls (Windows Win32 API) Process Management  CreateProcess- new process (combined work of fork and execve in UNIX) In Windows – no process hierarchy, event concept implemented  WaitForSingleObject – wait for an event (can wait for process to exit) File Management  CreateFile, CloseHandle, CreateDirectory, …  Windows does not have signals, links to files, …, but has a large number of system calls for managing GUI

CS Fall 2011 OS Service Examples Services that need to be provided at kernel level  System calls: file open, close, read and write  Control the CPU so that users won’t stuck by running while ( 1 ) ;  Protection: Keep user programs from crashing OS Keep user programs from crashing each other Services that can be provided at user level  Read time of the day

CS Fall 2011 You Live in Interesting Times… Processors speed used to double in 18 months (Moore’s Law), but we are reaching the upper bound (due to thermal problems) and need to go towards multi-core processors, i.e., parallelism to increase the processing power Disk doubling every 12 months Global bandwidth every 6 month What will the future OS be?