COSC243 Part 2: Operating Systems

Size: px
Start display at page:

Download "COSC243 Part 2: Operating Systems"

Transcription

1 COSC243 Part 2: Operating Systems Lecture 20: Main Memory Management Zhiyi Huang Dept. of Computer Science, University of Otago Zhiyi Huang (Otago) COSC243 Lecture 20 1 / 29

2 O/S/ course overview Introduction (1 lecture): Ch1(1-8) Process Management (5 lectures) System Structure and Processes: Ch2(1-9) Threads and data sharing: Ch4(1-4) Scheduling: Ch5(1-3,7) Synchronisation: Ch6(1-7) Deadlocks: Ch7 Storage Management (2 lectures) Main memory: Ch8(1-6) Virtual memory: Ch9(1-7) File System Interface (1 lecture): Ch10(1-5),Ch11(1-4) I/O Management (2 lectures) I/O systems: Ch13(1-4,7) Mass storage: Ch12(1-4) Zhiyi Huang (Otago) COSC243 Lecture 20 2 / 29

3 COSC243 Part II: Storage Management PRIMARY STORAGE: can be referenced directly by CPU must be loaded into memory before being referenced Cache storage Main memory Secondary storage (hard disk) access speed increases access time decreases cost increases capacity decreases Zhiyi Huang (Otago) COSC243 Lecture 20 3 / 29

4 Overview of today s lecture Background: general concepts Getting programs/data into memory Logical and physical es Memory allocation methods Paging Segmentation Zhiyi Huang (Otago) COSC243 Lecture 20 4 / 29

5 Memory Access in Program Execution The instruction execution cycle: The CPU fetches an instruction from main memory, according to the value of the program counter. The instruction may require other main memory locations to be accessed, for loading or storing contents of registers. The memory unit is responsible for accessing main memory. This unit doesn t know or care about what the data being accessed are actually used for. Zhiyi Huang (Otago) COSC243 Lecture 20 5 / 29

6 Getting a Program into Main Memory Memory management deals with how to get processes into main memory, and the organisation of that memory. This isn t a trivial task. The memory unit accesses es in primary memory. (E.g ) Source code just refers to symbols. (Variables: e.g. count.) (Procedures: e.g. get_next_item.) Symbols need to be converted into es. Technically, we talk of symbols being bound to es. Zhiyi Huang (Otago) COSC243 Lecture 20 6 / 29

7 Address Binding Symbols can be converted into es at several points: Compile time. Compilers can create: absolute code: if it s known where the process will reside in memory. (E.g. MS-DOS.COM programs.) relocatable code: if this is not known. Link time. Programs are often designed as separate modules which are compiled separately, but make reference to each other. These must be linked, so that their variables are correctly bound. Load time. When the process is loaded into main memory. Run time. If a process can be moved during execution from one place in memory to another. Zhiyi Huang (Otago) COSC243 Lecture 20 7 / 29

8 Where can binding occur? source program compiler / assembler compile time other object modules object module linkage editor system library load module load time dynamically loaded system library dynamic linking loader main memory storage run time Zhiyi Huang (Otago) COSC243 Lecture 20 8 / 29

9 Dynamic Linking and Loading When a source program is compiled, the code for the functions provided by the language (e.g. Java libraries) needs to be incorporated into the object program. In static linking, this is done before the program is executed. In dynamic linking, it is only done at run-time. A stub containing a pointer is included in place of the code for each routine. When the stub is referenced, the pointer is initialised: - if the routine is already loaded, use it; - otherwise load the routine. Advantages of dynamic linking? Saving on memory space. (don t need multiple copies of the same routines). Saving on load time. (only need to load a routine once). Ease of updating libraries (e.g. to fix bugs, change versions). Zhiyi Huang (Otago) COSC243 Lecture 20 9 / 29

10 Logical and Physical Addresses Some terminology: A logical is one referred to in a piece of executable code (e.g. to refer to a variable or a location). It is used in a process space. The CPU executes instructions involving logical es. Logical is also called virtual. A physical is the which is actually sent to the memory unit. In compile-time and load-time binding, logical es are used. At run-time, something in the computer has to map between logical and physical es. Zhiyi Huang (Otago) COSC243 Lecture / 29

11 The Memory-Management Unit The logical space of a process runs from 0 to the memory limit of the process. Physical space runs from 0 to the size of main memory. The memory management unit maps between the two. It takes a logical generated by the CPU, and adds a number N to compute the physical. The number is held in a relocation register. relocation register CPU logical N + physical memory Memory management unit To move a process in memory, just change the relocation register. Zhiyi Huang (Otago) COSC243 Lecture / 29

12 Run-Time Binding and Multitasking Run-time binding is useful for saving on memory: Only loading modules if they re needed. Allowing several processes to share one copy of a module. There are also many benefits that relate to a multitasking scenario. Until now, our multitasking scenario has involved switching between processes resident in main memory. But note: while a process is waiting for the CPU, there s no reason for it to be in main memory. Zhiyi Huang (Otago) COSC243 Lecture / 29

13 Swapping Terminology: processes are swapped in and out of main memory to/from a backing store. O/S swap out swap in P1 P2 main memory backing store Swapping is done by the memory manager, which is a module of the kernel. The memory manager needs to work in synch with the CPU scheduler. Zhiyi Huang (Otago) COSC243 Lecture / 29

14 Memory Allocation and Protection Lecture on data sharing: processes are not allowed to access each other s space (except under special circumstances). Q: How is this rule implemented? A: Each process is associated with a relocation register and also a limit register. logical limit register < yes relocation register + physical CPU no TRAP: ing error main memory Zhiyi Huang (Otago) COSC243 Lecture / 29

15 Allocating Memory for Several Processes How to organise memory allocation for many processes? A simple method: divide memory into a number of fixed-size partitions. Problems? Processes can be different sizes. Presumably the partitions would have to be as big as the biggest process, which would make for huge redundancy. A more complex method: Each free region of memory is termed a hole. When a process arrives, we find a hole big enough to put it into. If the hole is bigger than the process, we keep a record of the new (smaller) hole. Zhiyi Huang (Otago) COSC243 Lecture / 29

16 Algorithms for Choosing a Hole There are different methods First-fit: allocate the first hole you find that s big enough. Best-fit: find the hole that leaves the smallest leftover hole. Worst-fit: find the hole that leaves the biggest leftover hole. Advantages/disadvantages of each? First-fit: quickest (because you don t have to search every hole), but you mightn t allocate the optimal-sized hole. Best-fit: you have to search the whole set of holes each time. A disadvantage is that you end up creating very small holes. Worst-fit: again, you have to do an exhaustive search. You minimise the problem of creating small holes, but you might not use the large holes as effectively as you could; you might put small processes into them which mean that there are no holes large enough for a subsequent large process. Zhiyi Huang (Otago) COSC243 Lecture / 29

17 External Fragmentation If memory is broken into many holes, there might be enough memory in total to fit a particular process, but not all in one place. This situation is called external fragmentation. P1 P0 holes process memory Worst-case external fragmentation: a hole between every pair of processes. Zhiyi Huang (Otago) COSC243 Lecture / 29

18 Internal Fragmentation The operating system has to keep a table of all the currently available holes in memory. Hole Memory region H 1 H 2... There s a large overhead in keeping track of lots of very small holes. P1 new hole? process hole To avoid creating tiny holes, we sometimes allocate a process more memory than it needs. Unused memory within a process is called internal fragmentation. Zhiyi Huang (Otago) COSC243 Lecture / 29

19 Noncontiguous Memory Allocation The allocation methods described so far have all required the memory allocated for a process to be contiguous. Obviously, noncontiguous allocation has advantages. One way of providing noncontiguous allocation is through paging. In paging, a process logical space is broken into fixed-size units called pages, and main memory is broken into units of the same size, called frames. PAGES FRAMES CPU logical memory physical memory Zhiyi Huang (Otago) COSC243 Lecture / 29

20 Paging In a paged memory allocation scheme, the logical es generated by the CPU are broken by special hardware into two components: a page number (identifying a page), and an offset (an within that page). CPU logical p off f page table page P0 P1 P2 P3 frame F1 F4 F3 F6 physical off F0 F1 F2 F3 F4 F5 F6 memory A page table indicates for each page which frame it s stored in. Paging allows a process to be stored noncontigously in memory. Paging is a way of implementing run-time binding. Zhiyi Huang (Otago) COSC243 Lecture / 29

21 An example Consider the following scenario: Pages (and frames) are 10 bytes in size. There are 70 bytes of main memory in total. Process P1 has a logical space of 40 bytes, and a page table which looks like this: page frame Q: What physical es would be accessed by the following stream of logical es? 0, 11, 25, 31 10, 41, 35, 61 Zhiyi Huang (Otago) COSC243 Lecture / 29

22 Memory protection: valid/invalid bits A process takes up a certain number of pages n. But the page table typically has more than n entries. CPU logical p off page P0 P1 P2 P3 frame F1 F4 F3 F6 physical f off F0 F1 F2 F3 F4 F5 F6 memory Zhiyi Huang (Otago) COSC243 Lecture / 29

23 Memory protection: valid/invalid bits A process takes up a certain number of pages n. But the page table typically has more than n entries. CPU logical p off page P0 P1 P2 P3 frame F1 F4 F3 F6 physical f off F0 F1 F2 F3 F4 F5 F6 memory So the page table also stores a valid/invalid bit, which is set to invalid for out-of-range memory references. Zhiyi Huang (Otago) COSC243 Lecture / 29

24 Memory protection: valid/invalid bits A process takes up a certain number of pages n. But the page table typically has more than n entries. CPU logical p off page P0 P1 P2 P3 frame F1 F4 F3 F6 physical v v v v i i i f off F0 F1 F2 F3 F4 F5 F6 memory So the page table also stores a valid/invalid bit, which is set to invalid for out-of-range memory references. Zhiyi Huang (Otago) COSC243 Lecture / 29

25 An example of paging with valid/invalid bits Consider the following scenario: Pages (and frames) are 10 bytes in size. There are 70 bytes of main memory in total. Process P1 has a logical space of 40 bytes, and a page table which looks like this: page frame valid/invalid bit 0 1 v 1 4 v 2 3 v 3 6 v 4 i... i What happens if the CPU requests logical 48? invalid-memory-access, segmentation fault Zhiyi Huang (Otago) COSC243 Lecture / 29

26 Paging: some questions What happens to external fragmentation in a paging scheme? A: this scheme eliminates it. What happens to internal fragmentation? A: each process has to be allocated a discrete number of pages. So there s going to be internal fragmentation when a process doesn t fit exactly. It ll be on average half a page per process, assuming process size is independent of page size. So how big should pages be? A: small, but not so small that the disk I/O and housekeeping become too great. How many page tables do we need? A: one for each process. How does the O/S keep track of a process page table? A: It keeps a copy in its PCB. (Remember I said that the PCB contains memory management information...) Zhiyi Huang (Otago) COSC243 Lecture / 29

27 Implementing Paging The fastest/most expensive way of implementing pages is to store the page table in a set of special-purpose registers. But this isn t feasible if the page table is big (as it normally is). The alternative is to store the page table in main memory. But this could slow things down hugely: to access an in memory, we now need two or more memory accesses. The solution is to keep a cache of page table entries that have been used recently, in a special set of parallel-access registers called associative registers, aka. Translation Look-aside Buffer (TLB). Zhiyi Huang (Otago) COSC243 Lecture / 29

28 Segmentation In the paging scheme above, it s the hardware that partitions a CPU-generated into pages. But there are some reasons for allowing a process to partition its own space. subroutine SQRT stack main program symbol table logical space A segmentation allocation scheme supports this view of memory. Zhiyi Huang (Otago) COSC243 Lecture / 29

29 Implementing Segmentation In a segmentation scheme, a logical is a pair of < segment_number, offset >. These are mapped onto physical es by the segmentation hardware, using a segment table. Each entry in the table has a segment base (the starting physical ) and a segment limit (the size of the segment). Segments can be stored noncontiguously. Like the page table, the segment table can either be put into fast registers or main memory. Zhiyi Huang (Otago) COSC243 Lecture / 29

30 Advantages / disadvantages of segmentation? Advantages: makes protection and sharing easy to deal with (as items in a segment have the same protection status). You just need one protection bit per segment. it just makes it easier to write machine code. (And thus to write compilers.) Disadvantages: external fragmentation is back. But with less of a vengeance. NB: clever schemes (e.g. MULTICS) use paging and segmentation. The idea is that a memory reference is a segment base plus segment offset, where the segment offset is itself broken into two components: a page number and a page offset. There is a question about the MULTICS scheme in Tutorial 11B Zhiyi Huang (Otago) COSC243 Lecture / 29

31 Reading For this lecture, you should have read Chapter 8 (Sections 1 6) of Silberschatz et al. For next lecture, you should read Chapter 9 (Sections 1 7). Zhiyi Huang (Otago) COSC243 Lecture / 29

Memory management basics (1) Requirements (1) Objectives. Operating Systems Part of E1.9 - Principles of Computers and Software Engineering

Memory management basics (1) Requirements (1) Objectives. Operating Systems Part of E1.9 - Principles of Computers and Software Engineering Memory management basics (1) Requirements (1) Operating Systems Part of E1.9 - Principles of Computers and Software Engineering Lecture 7: Memory Management I Memory management intends to satisfy the following

More information

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging Memory Management Outline Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging 1 Background Memory is a large array of bytes memory and registers are only storage CPU can

More information

OPERATING SYSTEM - MEMORY MANAGEMENT

OPERATING SYSTEM - MEMORY MANAGEMENT OPERATING SYSTEM - MEMORY MANAGEMENT http://www.tutorialspoint.com/operating_system/os_memory_management.htm Copyright tutorialspoint.com Memory management is the functionality of an operating system which

More information

The Deadlock Problem. Deadlocks. Deadlocks. Bridge Crossing Example

The Deadlock Problem. Deadlocks. Deadlocks. Bridge Crossing Example The Deadlock Problem Deadlocks A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example System has 2 tape drives. P 1 and P 2 each

More information

Memory unit sees only the addresses, and not how they are generated (instruction counter, indexing, direct)

Memory unit sees only the addresses, and not how they are generated (instruction counter, indexing, direct) Memory Management 55 Memory Management Multitasking without memory management is like having a party in a closet. Charles Petzold. Programming Windows 3.1 Programs expand to fill the memory that holds

More information

OPERATING SYSTEMS MEMORY MANAGEMENT

OPERATING SYSTEMS MEMORY MANAGEMENT OPERATING SYSTEMS MEMORY MANAGEMENT Jerry Breecher 8: Memory Management 1 OPERATING SYSTEM Memory Management What Is In This Chapter? Just as processes share the CPU, they also share physical memory. This

More information

Chapter 7 Memory Management

Chapter 7 Memory Management Operating Systems: Internals and Design Principles Chapter 7 Memory Management Eighth Edition William Stallings Frame Page Segment A fixed-length block of main memory. A fixed-length block of data that

More information

Virtual vs Physical Addresses

Virtual vs Physical Addresses Virtual vs Physical Addresses Physical addresses refer to hardware addresses of physical memory. Virtual addresses refer to the virtual store viewed by the process. virtual addresses might be the same

More information

Operating Systems, 6 th ed. Test Bank Chapter 7

Operating Systems, 6 th ed. Test Bank Chapter 7 True / False Questions: Chapter 7 Memory Management 1. T / F In a multiprogramming system, main memory is divided into multiple sections: one for the operating system (resident monitor, kernel) and one

More information

Chapter 7 Memory Management

Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 7 Memory Management Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall Memory Management Subdividing

More information

Memory Management 1. Memory Management. Multitasking without memory management is like having a party in a closet.

Memory Management 1. Memory Management. Multitasking without memory management is like having a party in a closet. Memory Management 1 Memory Management Multitasking without memory management is like having a party in a closet. Charles Petzold. Programming Windows 3.1 Programs expand to fill the memory that holds them.

More information

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems Lecture Outline Operating Systems Objectives Describe the functions and layers of an operating system List the resources allocated by the operating system and describe the allocation process Explain how

More information

COS 318: Operating Systems. Virtual Memory and Address Translation

COS 318: Operating Systems. Virtual Memory and Address Translation COS 318: Operating Systems Virtual Memory and Address Translation Today s Topics Midterm Results Virtual Memory Virtualization Protection Address Translation Base and bound Segmentation Paging Translation

More information

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management. Overview Concepts of Mobile Operating Systems Lecture 11 Concepts of Mobile Operating Systems Mobile Business I (WS 2007/08) Prof Dr Kai Rannenberg Chair of Mobile Business and Multilateral Security Johann

More information

Lecture 17: Virtual Memory II. Goals of virtual memory

Lecture 17: Virtual Memory II. Goals of virtual memory Lecture 17: Virtual Memory II Last Lecture: Introduction to virtual memory Today Review and continue virtual memory discussion Lecture 17 1 Goals of virtual memory Make it appear as if each process has:

More information

CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont.

CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont. CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont. Instructors: Vladimir Stojanovic & Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/ 1 Bare 5-Stage Pipeline Physical Address PC Inst.

More information

CS5460: Operating Systems

CS5460: Operating Systems CS5460: Operating Systems Lecture 13: Memory Management (Chapter 8) Where are we? Basic OS structure, HW/SW interface, interrupts, scheduling Concurrency Memory management Storage management Other topics

More information

Operating System Tutorial

Operating System Tutorial Operating System Tutorial OPERATING SYSTEM TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Operating System Tutorial An operating system (OS) is a collection

More information

OPERATING SYSTEM - VIRTUAL MEMORY

OPERATING SYSTEM - VIRTUAL MEMORY OPERATING SYSTEM - VIRTUAL MEMORY http://www.tutorialspoint.com/operating_system/os_virtual_memory.htm Copyright tutorialspoint.com A computer can address more memory than the amount physically installed

More information

Segmentation. 16.1 Segmentation: Generalized Base/Bounds

Segmentation. 16.1 Segmentation: Generalized Base/Bounds 16 Segmentation So far we have been putting the entire address space of each process in memory. With the base and bounds registers, the OS can easily relocate processes to different parts of physical memory.

More information

How To Write A Page Table

How To Write A Page Table 12 Paging: Introduction Remember our goal: to virtualize memory. Segmentation (a generalization of dynamic relocation) helped us do this, but has some problems; in particular, managing free space becomes

More information

Chapter 12. Paging an Virtual Memory Systems

Chapter 12. Paging an Virtual Memory Systems Chapter 12 Paging an Virtual Memory Systems Paging & Virtual Memory Virtual Memory - giving the illusion of more physical memory than there really is (via demand paging) Pure Paging - The total program

More information

Operating Systems 4 th Class

Operating Systems 4 th Class Operating Systems 4 th Class Lecture 1 Operating Systems Operating systems are essential part of any computer system. Therefore, a course in operating systems is an essential part of any computer science

More information

Chapter 11 I/O Management and Disk Scheduling

Chapter 11 I/O Management and Disk Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 11 I/O Management and Disk Scheduling Dave Bremer Otago Polytechnic, NZ 2008, Prentice Hall I/O Devices Roadmap Organization

More information

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines Operating System Concepts 3.1 Common System Components

More information

Chapter 3 Operating-System Structures

Chapter 3 Operating-System Structures Contents 1. Introduction 2. Computer-System Structures 3. Operating-System Structures 4. Processes 5. Threads 6. CPU Scheduling 7. Process Synchronization 8. Deadlocks 9. Memory Management 10. Virtual

More information

Computer-System Architecture

Computer-System Architecture Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection General System Architecture 2.1 Computer-System Architecture 2.2 Computer-System

More information

Stack Allocation. Run-Time Data Structures. Static Structures

Stack Allocation. Run-Time Data Structures. Static Structures Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,

More information

Outline: Operating Systems

Outline: Operating Systems Outline: Operating Systems What is an OS OS Functions Multitasking Virtual Memory File Systems Window systems PC Operating System Wars: Windows vs. Linux 1 Operating System provides a way to boot (start)

More information

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont. Objectives To describe the services an operating system provides to users, processes, and other systems To discuss the various ways of structuring an operating system Chapter 2: Operating-System Structures

More information

& Data Processing 2. Exercise 3: Memory Management. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen

& Data Processing 2. Exercise 3: Memory Management. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen Folie a: Name & Data Processing 2 3: Memory Management Dipl.-Ing. Bogdan Marin Fakultät für Ingenieurwissenschaften Abteilung Elektro-und Informationstechnik -Technische Informatik- Objectives Memory Management

More information

Operating System Overview. Otto J. Anshus

Operating System Overview. Otto J. Anshus Operating System Overview Otto J. Anshus A Typical Computer CPU... CPU Memory Chipset I/O bus ROM Keyboard Network A Typical Computer System CPU. CPU Memory Application(s) Operating System ROM OS Apps

More information

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts

More information

A3 Computer Architecture

A3 Computer Architecture A3 Computer Architecture Engineering Science 3rd year A3 Lectures Prof David Murray david.murray@eng.ox.ac.uk www.robots.ox.ac.uk/ dwm/courses/3co Michaelmas 2000 1 / 1 6. Stacks, Subroutines, and Memory

More information

Board Notes on Virtual Memory

Board Notes on Virtual Memory Board Notes on Virtual Memory Part A: Why Virtual Memory? - Letʼs user program size exceed the size of the physical address space - Supports protection o Donʼt know which program might share memory at

More information

Traditional IBM Mainframe Operating Principles

Traditional IBM Mainframe Operating Principles C H A P T E R 1 7 Traditional IBM Mainframe Operating Principles WHEN YOU FINISH READING THIS CHAPTER YOU SHOULD BE ABLE TO: Distinguish between an absolute address and a relative address. Briefly explain

More information

CS3600 SYSTEMS AND NETWORKS

CS3600 SYSTEMS AND NETWORKS CS3600 SYSTEMS AND NETWORKS NORTHEASTERN UNIVERSITY Lecture 2: Operating System Structures Prof. Alan Mislove (amislove@ccs.neu.edu) Operating System Services Operating systems provide an environment for

More information

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts

More information

Linux Process Scheduling Policy

Linux Process Scheduling Policy Lecture Overview Introduction to Linux process scheduling Policy versus algorithm Linux overall process scheduling objectives Timesharing Dynamic priority Favor I/O-bound process Linux scheduling algorithm

More information

Chapter 12 File Management

Chapter 12 File Management Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 12 File Management Dave Bremer Otago Polytechnic, N.Z. 2008, Prentice Hall Roadmap Overview File organisation and Access

More information

1. Computer System Structure and Components

1. Computer System Structure and Components 1 Computer System Structure and Components Computer System Layers Various Computer Programs OS System Calls (eg, fork, execv, write, etc) KERNEL/Behavior or CPU Device Drivers Device Controllers Devices

More information

Chapter 12 File Management. Roadmap

Chapter 12 File Management. Roadmap Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 12 File Management Dave Bremer Otago Polytechnic, N.Z. 2008, Prentice Hall Overview Roadmap File organisation and Access

More information

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation Dynamic Storage Allocation CS 44 Operating Systems Fall 5 Presented By Vibha Prasad Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need

More information

Memory Management CS 217. Two programs can t control all of memory simultaneously

Memory Management CS 217. Two programs can t control all of memory simultaneously Memory Management CS 217 Memory Management Problem 1: Two programs can t control all of memory simultaneously Problem 2: One program shouldn t be allowed to access/change the memory of another program

More information

Convenience: An OS makes a computer more convenient to use. Efficiency: An OS allows the computer system resources to be used in an efficient manner.

Convenience: An OS makes a computer more convenient to use. Efficiency: An OS allows the computer system resources to be used in an efficient manner. Introduction to Operating System PCSC-301 (For UG students) (Class notes and reference books are required to complete this study) Release Date: 27.12.2014 Operating System Objectives and Functions An OS

More information

An Implementation Of Multiprocessor Linux

An Implementation Of Multiprocessor Linux An Implementation Of Multiprocessor Linux This document describes the implementation of a simple SMP Linux kernel extension and how to use this to develop SMP Linux kernels for architectures other than

More information

Operating Systems. Virtual Memory

Operating Systems. Virtual Memory Operating Systems Virtual Memory Virtual Memory Topics. Memory Hierarchy. Why Virtual Memory. Virtual Memory Issues. Virtual Memory Solutions. Locality of Reference. Virtual Memory with Segmentation. Page

More information

W4118: segmentation and paging. Instructor: Junfeng Yang

W4118: segmentation and paging. Instructor: Junfeng Yang W4118: segmentation and paging Instructor: Junfeng Yang Outline Memory management goals Segmentation Paging TLB 1 Uni- v.s. multi-programming Simple uniprogramming with a single segment per process Uniprogramming

More information

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization Lesson Objectives To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization AE3B33OSD Lesson 1 / Page 2 What is an Operating System? A

More information

ELEC 377. Operating Systems. Week 1 Class 3

ELEC 377. Operating Systems. Week 1 Class 3 Operating Systems Week 1 Class 3 Last Class! Computer System Structure, Controllers! Interrupts & Traps! I/O structure and device queues.! Storage Structure & Caching! Hardware Protection! Dual Mode Operation

More information

This tutorial will take you through step by step approach while learning Operating System concepts.

This tutorial will take you through step by step approach while learning Operating System concepts. About the Tutorial An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs. The operating system is a vital component

More information

Chapter 2: OS Overview

Chapter 2: OS Overview Chapter 2: OS Overview CmSc 335 Operating Systems 1. Operating system objectives and functions Operating systems control and support the usage of computer systems. a. usage users of a computer system:

More information

An Introduction to Computer Science and Computer Organization Comp 150 Fall 2008

An Introduction to Computer Science and Computer Organization Comp 150 Fall 2008 An Introduction to Computer Science and Computer Organization Comp 150 Fall 2008 Computer Science the study of algorithms, including Their formal and mathematical properties Their hardware realizations

More information

Example of Standard API

Example of Standard API 16 Example of Standard API System Call Implementation Typically, a number associated with each system call System call interface maintains a table indexed according to these numbers The system call interface

More information

Operating System Structures

Operating System Structures COP 4610: Introduction to Operating Systems (Spring 2015) Operating System Structures Zhi Wang Florida State University Content Operating system services User interface System calls System programs Operating

More information

Memory management. Chapter 4: Memory Management. Memory hierarchy. In an ideal world. Basic memory management. Fixed partitions: multiple programs

Memory management. Chapter 4: Memory Management. Memory hierarchy. In an ideal world. Basic memory management. Fixed partitions: multiple programs Memory management Chater : Memory Management Part : Mechanisms for Managing Memory asic management Swaing Virtual Page relacement algorithms Modeling age relacement algorithms Design issues for aging systems

More information

CSC 2405: Computer Systems II

CSC 2405: Computer Systems II CSC 2405: Computer Systems II Spring 2013 (TR 8:30-9:45 in G86) Mirela Damian http://www.csc.villanova.edu/~mdamian/csc2405/ Introductions Mirela Damian Room 167A in the Mendel Science Building mirela.damian@villanova.edu

More information

361 Computer Architecture Lecture 14: Cache Memory

361 Computer Architecture Lecture 14: Cache Memory 1 361 Computer Architecture Lecture 14 Memory cache.1 The Motivation for s Memory System Processor DRAM Motivation Large memories (DRAM) are slow Small memories (SRAM) are fast Make the average access

More information

Computer Science 4302 Operating Systems. Student Learning Outcomes

Computer Science 4302 Operating Systems. Student Learning Outcomes Computer Science 4302 Operating Systems Student Learning Outcomes 1. The student will learn what operating systems are, what they do, and how they are designed and constructed. The student will be introduced

More information

Virtual Memory. Virtual Memory. Paging. CSE 380 Computer Operating Systems. Paging (1)

Virtual Memory. Virtual Memory. Paging. CSE 380 Computer Operating Systems. Paging (1) Virtual Memory CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania Fall 2003 Lecture Note: Virtual Memory (revised version) 1 Recall: memory allocation with variable partitions

More information

Operating Systems CSE 410, Spring 2004. File Management. Stephen Wagner Michigan State University

Operating Systems CSE 410, Spring 2004. File Management. Stephen Wagner Michigan State University Operating Systems CSE 410, Spring 2004 File Management Stephen Wagner Michigan State University File Management File management system has traditionally been considered part of the operating system. Applications

More information

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 412, University of Maryland. Guest lecturer: David Hovemeyer.

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 412, University of Maryland. Guest lecturer: David Hovemeyer. Guest lecturer: David Hovemeyer November 15, 2004 The memory hierarchy Red = Level Access time Capacity Features Registers nanoseconds 100s of bytes fixed Cache nanoseconds 1-2 MB fixed RAM nanoseconds

More information

Introduction. What is an Operating System?

Introduction. What is an Operating System? Introduction What is an Operating System? 1 What is an Operating System? 2 Why is an Operating System Needed? 3 How Did They Develop? Historical Approach Affect of Architecture 4 Efficient Utilization

More information

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing. CS143 Handout 18 Summer 2008 30 July, 2008 Processor Architectures Handout written by Maggie Johnson and revised by Julie Zelenski. Architecture Vocabulary Let s review a few relevant hardware definitions:

More information

Filing Systems. Filing Systems

Filing Systems. Filing Systems Filing Systems At the outset we identified long-term storage as desirable characteristic of an OS. EG: On-line storage for an MIS. Convenience of not having to re-write programs. Sharing of data in an

More information

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study CS 377: Operating Systems Lecture 25 - Linux Case Study Guest Lecturer: Tim Wood Outline Linux History Design Principles System Overview Process Scheduling Memory Management File Systems A review of what

More information

Chapter 6, The Operating System Machine Level

Chapter 6, The Operating System Machine Level Chapter 6, The Operating System Machine Level 6.1 Virtual Memory 6.2 Virtual I/O Instructions 6.3 Virtual Instructions For Parallel Processing 6.4 Example Operating Systems 6.5 Summary Virtual Memory General

More information

CS161: Operating Systems

CS161: Operating Systems CS161: Operating Systems Matt Welsh mdw@eecs.harvard.edu Lecture 2: OS Structure and System Calls February 6, 2007 1 Lecture Overview Protection Boundaries and Privilege Levels What makes the kernel different

More information

Operating Systems. Lecture 03. February 11, 2013

Operating Systems. Lecture 03. February 11, 2013 Operating Systems Lecture 03 February 11, 2013 Goals for Today Interrupts, traps and signals Hardware Protection System Calls Interrupts, Traps, and Signals The occurrence of an event is usually signaled

More information

Operating System Structures

Operating System Structures Operating System Structures Meelis ROOS mroos@ut.ee Institute of Computer Science Tartu University fall 2009 Literature A. S. Tanenbaum. Modern Operating Systems. 2nd ed. Prentice Hall. 2001. G. Nutt.

More information

System Structures. Services Interface Structure

System Structures. Services Interface Structure System Structures Services Interface Structure Operating system services (1) Operating system services (2) Functions that are helpful to the user User interface Command line interpreter Batch interface

More information

Performance Comparison of RTOS

Performance Comparison of RTOS Performance Comparison of RTOS Shahmil Merchant, Kalpen Dedhia Dept Of Computer Science. Columbia University Abstract: Embedded systems are becoming an integral part of commercial products today. Mobile

More information

Disk Space Management Methods

Disk Space Management Methods Volume 1, Issue 1, June 2013 International Journal of Advance Research in Computer Science and Management Studies Research Paper Available online at: www.ijarcsms.com Disk Space Management Methods Ramakrishna

More information

Introduction to Embedded Systems. Software Update Problem

Introduction to Embedded Systems. Software Update Problem Introduction to Embedded Systems CS/ECE 6780/5780 Al Davis logistics minor Today s topics: more software development issues 1 CS 5780 Software Update Problem Lab machines work let us know if they don t

More information

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture Review from last time CS 537 Lecture 3 OS Structure What HW structures are used by the OS? What is a system call? Michael Swift Remzi Arpaci-Dussea, Michael Swift 1 Remzi Arpaci-Dussea, Michael Swift 2

More information

The Design of the Inferno Virtual Machine. Introduction

The Design of the Inferno Virtual Machine. Introduction The Design of the Inferno Virtual Machine Phil Winterbottom Rob Pike Bell Labs, Lucent Technologies {philw, rob}@plan9.bell-labs.com http://www.lucent.com/inferno Introduction Virtual Machine are topical

More information

Operating system Dr. Shroouq J.

Operating system Dr. Shroouq J. 3 OPERATING SYSTEM STRUCTURES An operating system provides the environment within which programs are executed. The design of a new operating system is a major task. The goals of the system must be well

More information

Chapter 1 Computer System Overview

Chapter 1 Computer System Overview Operating Systems: Internals and Design Principles Chapter 1 Computer System Overview Eighth Edition By William Stallings Operating System Exploits the hardware resources of one or more processors Provides

More information

Multi-core Programming System Overview

Multi-core Programming System Overview Multi-core Programming System Overview Based on slides from Intel Software College and Multi-Core Programming increasing performance through software multi-threading by Shameem Akhter and Jason Roberts,

More information

find model parameters, to validate models, and to develop inputs for models. c 1994 Raj Jain 7.1

find model parameters, to validate models, and to develop inputs for models. c 1994 Raj Jain 7.1 Monitors Monitor: A tool used to observe the activities on a system. Usage: A system programmer may use a monitor to improve software performance. Find frequently used segments of the software. A systems

More information

Computer Architecture

Computer Architecture Computer Architecture Slide Sets WS 2013/2014 Prof. Dr. Uwe Brinkschulte M.Sc. Benjamin Betting Part 11 Memory Management Computer Architecture Part 11 page 1 of 44 Prof. Dr. Uwe Brinkschulte, M.Sc. Benjamin

More information

Building Applications Using Micro Focus COBOL

Building Applications Using Micro Focus COBOL Building Applications Using Micro Focus COBOL Abstract If you look through the Micro Focus COBOL documentation, you will see many different executable file types referenced: int, gnt, exe, dll and others.

More information

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Chapter 2 Basic Structure of Computers Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Outline Functional Units Basic Operational Concepts Bus Structures Software

More information

Chapter 2 System Structures

Chapter 2 System Structures Chapter 2 System Structures Operating-System Structures Goals: Provide a way to understand an operating systems Services Interface System Components The type of system desired is the basis for choices

More information

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

CHAPTER 17: File Management

CHAPTER 17: File Management CHAPTER 17: File Management The Architecture of Computer Hardware, Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint slides

More information

Operating Systems Lecture #6: Process Management

Operating Systems Lecture #6: Process Management Lecture #6: Process Written by based on the lecture series of Dr. Dayou Li and the book Understanding 4th ed. by I.M.Flynn and A.McIver McHoes (2006) Department of Computer Science and Technology,., 2013

More information

Windows Server Performance Monitoring

Windows Server Performance Monitoring Spot server problems before they are noticed The system s really slow today! How often have you heard that? Finding the solution isn t so easy. The obvious questions to ask are why is it running slowly

More information

Unit 4.3 - Storage Structures 1. Storage Structures. Unit 4.3

Unit 4.3 - Storage Structures 1. Storage Structures. Unit 4.3 Storage Structures Unit 4.3 Unit 4.3 - Storage Structures 1 The Physical Store Storage Capacity Medium Transfer Rate Seek Time Main Memory 800 MB/s 500 MB Instant Hard Drive 10 MB/s 120 GB 10 ms CD-ROM

More information

Process Description and Control. 2004-2008 william stallings, maurizio pizzonia - sistemi operativi

Process Description and Control. 2004-2008 william stallings, maurizio pizzonia - sistemi operativi Process Description and Control 1 Process A program in execution (running) on a computer The entity that can be assigned to and executed on a processor A unit of activity characterized by a at least one

More information

File Management. Chapter 12

File Management. Chapter 12 Chapter 12 File Management File is the basic element of most of the applications, since the input to an application, as well as its output, is usually a file. They also typically outlive the execution

More information

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2 Lecture Handout Computer Architecture Lecture No. 2 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2,Chapter3 Computer Systems Design and Architecture 2.1, 2.2, 3.2 Summary 1) A taxonomy of

More information

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Processes and Non-Preemptive Scheduling. Otto J. Anshus Processes and Non-Preemptive Scheduling Otto J. Anshus 1 Concurrency and Process Challenge: Physical reality is Concurrent Smart to do concurrent software instead of sequential? At least we want to have

More information

Chapter 13 File and Database Systems

Chapter 13 File and Database Systems Chapter 13 File and Database Systems Outline 13.1 Introduction 13.2 Data Hierarchy 13.3 Files 13.4 File Systems 13.4.1 Directories 13.4. Metadata 13.4. Mounting 13.5 File Organization 13.6 File Allocation

More information

Chapter 13 File and Database Systems

Chapter 13 File and Database Systems Chapter 13 File and Database Systems Outline 13.1 Introduction 13.2 Data Hierarchy 13.3 Files 13.4 File Systems 13.4.1 Directories 13.4. Metadata 13.4. Mounting 13.5 File Organization 13.6 File Allocation

More information

File Management. Chapter 12

File Management. Chapter 12 File Management Chapter 12 File Management File management system is considered part of the operating system Input to applications is by means of a file Output is saved in a file for long-term storage

More information

COS 318: Operating Systems. Virtual Machine Monitors

COS 318: Operating Systems. Virtual Machine Monitors COS 318: Operating Systems Virtual Machine Monitors Andy Bavier Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall10/cos318/ Introduction Have been around

More information

Operating System: Scheduling

Operating System: Scheduling Process Management Operating System: Scheduling OS maintains a data structure for each process called Process Control Block (PCB) Information associated with each PCB: Process state: e.g. ready, or waiting

More information

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management COMP 242 Class Notes Section 6: File Management 1 File Management We shall now examine how an operating system provides file management. We shall define a file to be a collection of permanent data with

More information