Lecture03 - Friday, April 3 Project #1 Due before midnight...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Friday, April 3 Project #1 Due before midnight Sunday. Good discussions on the mailing list Contribute to the student wiki Evaluation criteria list is posted Questions/comments? See the archives Good questions are as valuable as good answers More formalized instructions, etc. "Opensource" contribution credit Beaver BarCamp Starts at 10:00 am tomorrow Sign up at http://beaverbarcamp.org registration page Presenters: document your presentation Attendees: hand in hardcopy of a summary of sessions attended Contribution credit for ... Today's topics More system view of OS Processes Intro to CPU scheduling OS services/responsibilities System view Briefly ... OS provides instructions for: System startup System calls Process management Interrupt handling Memory management / virtual memory I/O and communications management File systems management Caching Protection/Error handling ... and possibly (much) more System startup Bootstrap program is loaded at powerup or reboot OS responsibilities: Typically stored in ROM or EEPROM, generally known as firmware Initializate all aspects of system Load operating system kernel and start execution System calls OS responsibilities: Provide a "library" (implemented in hardware and/or software) for handling interrupts I/O operations memory allocation exception handling process management/synchronization file systems etc. More later ... OS responsibilities: Process Management Create processes Load, link, execute, terminate programs Suspend / resume processes Manage parallel processes and multi processes Multiple processors / simulation Parent / child processes Synchronization Communication among processes Handling deadlocks More soon ... Interrupt Handling Device, system call, error, etc. generates an interrupt OS responsibilities: All modern operating systems are interruptdriven. More later ... Preserve state of CPU Determine which type of interrupt has occurred Pass control to appropriate interrupt handler OS responsibilities: Memory Management Keep track of which parts of memory are currently being used and by which users / processes Decide which processes / data to move into and out of memory More later ... Allocate and deallocate memory space as needed Implement virtual memory and direct memory access Instructions must be in memory to be executed I/O management A major purpose of an OS is to hide peculiarities of hardware from the user OS responsibilities: I/O usually is the most "peculiar" Memory management of I/O including buffering caching spooling More later ... General devicedriver interface Drivers for specific hardware devices I/O scheduling Filesystem management OS responsibilities: Create, manipulate, and delete files / directories Map files onto secondary storage Organize files into directories, etc. Enforce access control Virtual File System provides common interface for various "real" file systems More later ... Etc. determines who can access what for what purpose OS responsibilities MassStorage Management Freespace management Storage allocation Disk scheduling Interaction with file system and virtual memory Speed of entire computer operation depends on disk subsystem and its algorithms Proper management is critical More later ... Caching Information being used is copied from slower to faster storage temporarily Performed at many levels in a computer (hardware, operating system, software) More later ... E.G., main memory can be viewed as a cache for secondary storage. Protection/Error handling OS responsibilities More later ... File Protection Memory Protection OS Protection Exception handling Error recovery Etc. CPU Scheduling and Process Management Process Management Many definitions of "process" For now, a process is a program in execution. Process needs resources to accomplish its task a unit of work within the system program is a passive entity process is an active entity CPU, memory, I/O, files Initialization data Etc. OS must reclaim any reusable resources at process termination Instruction Execution Cycle 1. 2. 3. 4. Fetch instruction at Instruction Pointer (IP) into Instruction Register (IR). Increment IP to point to next instruction. Decode instruction in IR If instruction requires memory access, A. B. 5. 6. Execute instruction Go to step 1. Determine memory address. Fetch operand from memory into a CPU register, or send operand from a CPU register to memory. Why is it important to increment the IP before executing the instruction? I.E., why not ... ? 1. 2. 3. Fetch instruction at IP into IR. Decode instruction in IR If instruction requires memory access, A. B. 4. 5. 6. Instruction prefetch into cache Execution of instruction might change the IP (branch) Function/procedure calls need return address Execute instruction Increment IP to point to next instruction. Go to step 1. Determine memory address. Fetch operand from memory into a CPU register, or send operand from a CPU register to memory. Singlethreaded process has one program counter Process Management Multithreaded process has one program counter per thread Typically, system has many processes running concurrently on one or more CPUs Specifies location of next instruction to execute Process executes instructions sequentially, one at a time, until completion Concurrency is implemented by multiplexing the CPUs among the processes / threads User processes OS processes Process Management Multiprogramming needed for efficiency Multiprogramming organizes jobs (code and data) for efficient use of CPU time. Single "user" cannot keep CPU and I/O devices busy at all times A subset of all jobs in system is kept in memory When job has to wait (e.g., for I/O), OS switches to another job If several jobs are ready to run at the same time, OS provides CPU scheduling Process Management Timesharing (multitasking, multiplexing) CPU switches jobs frequently so that users can interact with each job while it is running logical extension of multiprogramming Response time should be "unnoticeable" If CPU scheduler switches jobs too frequently, "thrashing" may occur Multiplexing No matter how many CPUs are present, there will be times when there are more processes than CPUs Switching the CPU from one process to another is called a context switch Requires CPU scheduling for each CPU OS must keep track of all process information and resources Linux note "Threads" are sometimes called "light weight processes" Linux does not differentiate Treats threads as processes. More soon ... Questions? Read Love Chapter 3 ...
View Full Document

This note was uploaded on 06/28/2009 for the course CS 411 taught by Professor Staff during the Spring '08 term at Oregon State.

Ask a homework question - tutors are online