Computer Architecture Chapter (8): Operating System Support

Slides:



Advertisements
Similar presentations
Chapter 8 Virtual Memory
Advertisements

Part IV: Memory Management
Virtual Memory Chapter 8.
Chapter 7 Memory Management
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Memory Management Chapter 4. Memory hierarchy Programmers want a lot of fast, non- volatile memory But, here is what we have:
Memory Design Example. Selecting Memory Chip Selecting SRAM Memory Chip.
Operating System Support Focus on Architecture
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Operating System Support Focus on Architecture
Memory Management 2010.
Chapter 8 Operating System Support (Continued)
Virtual Memory Chapter 8.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Chapter 8 Operating System Support
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Computer Organization and Architecture Operating System Support Chapter 8.
Chapter 3 Memory Management: Virtual Memory
Operating Systems.
Operating Systems.  Operating System Support Operating System Support  OS As User/Computer Interface OS As User/Computer Interface  OS As Resource.
Review of Memory Management, Virtual Memory CS448.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture CSCI 4717/5717 Computer Architecture Topic: Memory Management Reading: Stallings, Sections.
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
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.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
Chapter 9 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
Subject: Operating System.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Chapter 11: Operating System Support Dr Mohamed Menacer Taibah University
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Memory Management – Page 1CSCI 4717 – Computer Architecture CSCI 4717/5717 Computer Architecture Topic: Memory Management *** Modified – look for Reading:
Chapter 7 Memory Management
Chapter 8 Operating System Support
William Stallings Computer Organization and Architecture
Chapter 8 Virtual Memory
Virtual Memory Chapter 8.
Lecture 10: Virtual Memory
William Stallings Computer Organization and Architecture 8th Edition
Operating Systems.
Computer Architecture
CSCI 4717/5717 Computer Architecture
William Stallings Computer Organization and Architecture 8th Edition
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Presentation transcript:

Computer Architecture Chapter (8): Operating System Support Eng. Nader Taleb

Operating System Objectives and Functions “An OS is a program that controls the execution of application programs and acts as an interface between applications and the computer hardware” It can be thought of as having two objectives: Convenience: Makes a computer more convenient to use. Efficiency: Allows the computer system resources to be used in an efficient manner.

OS Services Areas OS as Resource Manager: The OS typically provides services in the following areas: - Program creation. - Program execution. - Access to I/O devices. - Controlled access to files. - Error detection and response. - System access. - Instruction set architecture (ISA). - Accounting. - Application binary interface (ABI). - Application programming interface (API). OS as Resource Manager: A computer is a set of resources for the movement, storage, and processing of data and for the control of these functions. The OS is responsible for managing these resources.

OS as Resource Manager Hints: 1. The OS is a program executed by the processor. 2. The OS frequently leave control and must depend on the processor to allow it to regain control.

Types of Operating System 1. Interactive / Batch. 2. Uni-programming / Multi-programming. In an interactive system, the user/programmer interacts directly with the computer (through a keyboard/display) to request the execution of a job or to perform a transaction. A batch system is the opposite of interactive. The user’s program is batched together with programs from other users and submitted by a computer operator. After the program is completed, results are printed out for the user. Pure batch systems are rare today. However, it will be useful to examine batch systems briefly.

Cont. With multiprogramming, the attempt is made to keep the processor as busy as possible, by having it work on more than one program at a time. In a uni-programming system, only one program is worked at a time. Early Systems: No Operating System. Programs interact directly with hardware. Two main problems: Scheduling: installations used a sign-up sheet to reserve processor time. Setup time: A single program, called a job, involve loading the compiler + the high-level language program.

Simple Batch Systems Simple batch operating systems were called a monitor. Resident Monitor program always still in the main memory. Users submit jobs to operator. Operator batches jobs. Monitor controls sequence of events to process batch. When one job is finished, control returns to Monitor which reads next job. Monitor handles scheduling.

Desirable Hardware Features Memory protection. To protect the Monitor. Timer. To prevent a job from monopolizing the system. Privileged instructions. Only executed by Monitor. e.g. I/O. Interrupts. Allows for relinquishing and regaining control from the user program. Processor time alternates between execution of user programs and execution of the monitor.

Multi-programmed Batch Systems I/O devices very slow. When one program is waiting for I/O, another can use the CPU. Example:

Example A time-sharing system: multiple users simultaneously access the system through terminals, with the OS interleaving the execution.

Cont.

Scheduling Types of Scheduling: The key to multiprogramming is scheduling. The concept of process is more general than job. Many definitions have been given for the term process: A program in execution. The “animated spirit” of a program. That entity to which a processor is assigned. Types of Scheduling: Long term. Medium term. Short term. I/O.

2. Medium Term Scheduling 1. Long Term Scheduling Determines which programs are submitted for processing. It controls the degree of multi-programming. Once submitted, a job becomes a process for the short term scheduler. Or it becomes a swapped out job for the medium term scheduler. 2. Medium Term Scheduling Part of the swapping function. Usually based on the need to manage multi-programming. If no virtual memory, memory management is also an issue.

3. Short Term Scheduler Process State: Dispatcher. Fine grained decisions of which job to execute next. i.e. which job actually gets to use the processor in the next time slot. Process State:

Process Control Block. For each process in the system, the OS must maintain information indicating the state of the process and other information necessary for process execution. For this purpose, each process is represented in the OS by a process control block. When the scheduler accepts a new job or user request for execution, it creates a blank process control block.

Example

Elements of O/S The major elements of the OS involved in the multiprogramming and scheduling of processes.

Process Scheduling The long-term queue is a list of jobs waiting to use the system. The short-term queue consists of all processes in the ready state An I/O queue means that all processes waiting to use each device are lined up in that device’s queue.

“The task of subdivision is carried out dynamically by the OS”. Memory Management Uni-program. Memory split into two. One for operating System (monitor) and the other for currently executing program. Multi-program. “User” part is sub-divided and shared among active processes. “The task of subdivision is carried out dynamically by the OS”.

Swapping Problem: I/O is so slow compared with CPU that even in multi-programming system, CPU can be idle most of the time. Solutions: Increase main memory. Expensive. Leads to larger programs. Swapping. Long term queue of processes stored on disk. Processes “swapped” in as space becomes available. As a process completes it is moved out of main memory.

Cont. If none of processes in memory are ready ( all I/O blocked). Swap out a blocked process to intermediate queue. Swap in a ready process or a new process. Swapping is an I/O process.

Partitioning “Splitting memory into sections to allocate to processes (including Operating System)”. Fixed-sized partitions. May not be equal size. Process is fitted into smallest hole that will take it (best fit). Some wasted memory. Leads to variable sized partitions.

Variable-Size Partitions When a process is brought into memory, it is allocated exactly as much memory as it requires and no more. This leads to a hole at the end of memory, too small to use. - Only one small hole - less waste. When all processes are blocked, swap out a process and bring in another. New process may be smaller than swapped out process. (hole) Eventually have lots of holes (fragmentation). Solutions: Compaction: From time to time go through memory and move all hole into one free block (disk de-fragmentation).

Effect of Dynamic Partitioning Loaded in M.M empty Hole

Relocation When compaction is used, a process may be shifted while in main memory. Instructions contain addresses of two types: - Locations of data. - Addresses for instructions To solve this problem, a distinction is made between logical addresses and physical addresses. Logical address: relative to beginning of program. Physical address: actual location in main memory. When the processor executes a process, automatic conversion is done by adding the current starting location of the process, (base address), to each logical address.

Paging Split memory into equal sized, small chunks (page frames). Split programs (processes) into equal sized small chunks (pages). Allocate the required number page frames to a process. Operating System maintains list of free frames. A process does not require contiguous page frames. Use page table to keep track. The page table shows the frame location for each page of the process.

Allocation of Free Frames

Logical and Physical Addresses - Paging

Virtual Memory Demand paging. Do not require all pages of a process in memory, so bring in pages as required. Page fault happens when the required page is not in memory. Operating System must swap in required page. May need to swap out a page to make space (page replacement). Thrashing: the processor spends most of its time swapping pages rather than executing instructions. A programmer or user perceives a much larger memory which is allocated on the disk (Virtual memory). Virtual memory allows for very effective multiprogramming and relieves the user of unnecessarily tight constraint of M.M.

Translation Lookaside Buffer Every virtual memory reference causes two physical memory access. Fetch page table entry. Fetch data. Virtual memory scheme would have the effect of doubling the memory access time. To overcome this problem, most virtual memory schemes make use of a special cache for page table entries, usually called a translation lookaside buffer (TLB). This cache functions in the same way as a memory cache and contains those page table entries that have been most recently used.

Segmentation Paging is not (usually) visible to the programmer and provide the programmer with a larger address space. Segmentation is visible to the programmer and is provided as a convenience for organizing programs and data. Usually different segments allocated to program. Advantages of Segmentation Simplifies handling of growing data structures. Allows programs to be altered and recompiled independently, without relinking and reloading. Lends itself to sharing among processes. Lends itself to protection.

Thank you