Operating Systems Projects Built on a Simple Hardware Simulator

Size: px
Start display at page:

Download "Operating Systems Projects Built on a Simple Hardware Simulator"

Transcription

1 Operating Systems Projects Built on a Simple Hardware Simulator John Dickinson Department of Computer Science University of Idaho Moscow, ID johnd@cs.uidaho.edu Abstract Effective teaching of operating system concepts requires projects. This paper describes a series of operating system projects all based on a simple hardware simulator that have been used to teach operating system concepts at the undergraduate level. A key feature of this approach is the use of a simple but realistic hardware model upon which an operating system is progressively built. The hardware simulator evolves as the operating system evolves. 1 Introduction Operating systems are the magic that makes all computers perform their miracles. Teaching about operating systems requires that the instructor explain and reveal all the secrets behind the magic. There is no better way to do this than to have the students create their own operating system, thus discovering the secrets for themselves. There are several small operating systems that have been used as test laboratories for operating system classes [1,3,4,5,6,7,9], but most of these involve many, many pages of code. With so much written code the student has a difficult time uncovering details. Often these systems are complete enough to run and so there are few important functions left for the student to write. For example, OSP by Kifer and Smolka [6] involves about 40 code and header files and about 13,000 lines of code. In comparison, version 0 of this project involves 5 code and header files and less than 800 lines of code. Version 6, which includes all of virtual memory management, involves the same number of files and about 3,000 lines of code. The approach described here uses a simple, minimal but realistic hardware simulator upon which the students write an operating system in stages. This implementation was first used in and at that time the instructor and students jointly created the hardware through discussions about which functions could or should be performed by hardware and which functions could or should be performed by software. The author returned to the course in the fall of 1998 and since that time the hardware has become fixed and the operating system functions more permanently defined. It is argued here that this approach is superior when the goal is to teach undergraduate students the fundamental issues involved with operating systems. 2 Hardware Simulator A key to this method of teaching is the use of a simple hardware simulator. This approach has been used to teach computer organization concepts [2]. What exactly does a simple, minimal but realistic hardware simulator, mean? Let us explain by using an example. In order to provide the hardware support for CPU process scheduling only two instructions are needed: a generic compute instruction and a halt instruction. A process can be thought of as a sequence of compute instructions with a terminating a halt instruction. This is often called a CPU burst [8]. The operating system does not care what is being computed, it is only concerned about issues such as which process to schedule next and how long that process will be allowed to run. For this one function of an operating system, there is no need for the hardware to simulate registers or a variety of calculating instructions or any other aspect of real CPU activity. These are all irrelevant to the operating system when it is dealing solely with CPU process scheduling. One of the secrets about operating systems is that they are not constantly watching processes and handling issues as they arise. An operating system is only involved when, for one reason or another, a process can no longer proceed on its own. Thus once a scheduled process begins to execute, the running process has control of the CPU until an event such as an interrupt or exception occurs.

2 To allow the operating system to deal with input/output interrupts a generic input/output instruction is added. This additional instruction forces the operating system to transition processes through Ready, Running, Waiting and Terminated states. Processes can then be constructed as a sequence of compute and I/O instructions ending with a halt instruction. The operating system can now transition processes through all the necessary states as processes execute their instructions. It is not necessary to simulate actual input/output operations, only that there is time between the start of the I/O operation and the interrupt that signals the end of the operation. If a specific device or calculation is used by the operating system to transition processes, then it could be simulated, but since the operating system is only involved with processes during the handling of interrupts or exceptions, the interaction between the hardware and software can be simulated in a simplistic manner. Further additions to the hardware simulator are described below as we discuss the various versions of the operating system. 3 Versions of the operating system Versions of the operating system build upon one another. Each version retains the functionality of the previous version and adds new functionality. The series of versions of the operating system schedule processes, deal with input/output, manage real and virtual memory, interact with file systems, and utilize internationalization. There are nine versions at the present time. Version 0: CPU scheduling and simple state transitions. The hardware simulator includes only two instructions: INST and HALT. All processes are considered to be a single compute burst. This is a common view of processes when algorithms for scheduling processes are being compared [8]. The operating system should include several scheduling algorithms, such as first come first serve, round robin, and shortest job first. This version of the operating system is very short (less than 150 lines of code) and it is sometimes given to the students as a completed system to allow them to become familiar with the components of the hardware simulator and the operating system. The hardware simulator program is about 125 lines of C code and the main program is about 400 lines of C code (most of this code is debugging and display code). Version 1: Simplistic I/O. This version adds input/output operations to processes. One new instruction is added to the hardware simulator: IOINST. The IOINST instruction does a generic input/output operation. Any input/output operation is actually initiated by the operating system and then there is some time that passes while the physical device does the actual operation and then an interrupt occurs that signals the completion of the input/output operation. The essential aspects of this process are built into the hardware simulator. All input/output operations begin with a system call (that is, a call to the operating system) that initiates the input/output operation. The time that the physical device takes is characterized in the hardware simulator by some random time between the start of the I/O and the completion of the I/O (i.e., the interrupt). Specifically, the hardware simulator uses a random number generator to select a time in the future when the device will be finished and schedules an interrupt at that time. The hardware simulator checks for scheduled interrupts every time the system clock is advanced. When the hardware simulator comes to a time when an interrupt is scheduled to occur, it calls the interrupt function. The interrupt function is part of the operating system, a function that the students write. In this version of the operating system, the handling of an interrupt involves no real data, but does involve changing the transition state of the process whose input/output has just finished. This version of the operating system has a full set of transition states: Ready, Running, Waiting and Terminated. [8] Version 2: Realistic I/O and deadlock prevention. This version of the operating system makes the simulation of input/output more realistic. It adds the concepts of devices and classes of devices. So input/output operations are directed at specific devices, specific devices cause interrupts, devices belong to a device class and processes must request devices from a device class. Deadlock is also addressed in this version. The Banker's algorithm [8] is used to prevent deadlock. There are two new instructions and one modified instruction. To request a device a process uses an OPEN instruction. The OPEN instruction asks for a device from a specific device class and if successful assigns the granted device an I/O descriptor or unit number that is used by the process for actual input/output operations. To release a device a process uses a CLOSE instruction. The IOINST is modified so that the input/output operation is performed on a specific device by supplying the I/O descriptor or unit number. An OPEN instruction does not always result in a device being allocated to the process. There may be no available devices in the device class or the Banker's algorithm might detect a potential deadlock condition. Thus all OPEN instructions are function calls to the operating system to request the allocation of a resource. Using deadlock prevention this version can run any collection of processes that could have finished individually. Version 3: Virtual memory, part 1. Virtual memory is complex and confusing for many students, so there are four versions of the operating system that build toward a comprehensive virtual memory system. This first virtual memory version assumes that there is enough real memory so that there is always a free frame available to allocate whenever one is needed. This version could function

3 adequately without any new instructions but one new instruction is added. The LOAD instruction, which loads the contents of a memory location into an accumulator, is added so that virtual pages might be brought into RAM in an order that is not strictly sequential. Frames in RAM are loaded from a simulated disk using a DMA operation. The DMA operation uses a device in the resource class specifically designated as the device class to be used for DMA operations. The primary issues in this version deal with the creation of page tables and the allocation of RAM. There are also some memory management issues, such as frames in RAM need to be locked while the DMA operation loads the data into the frame. Version 4: Virtual memory, part 2. This version uses limited primary memory. Therefore, frames in memory must be reused. An algorithm such as FIFO or LRU [8] is used to select victim frames in RAM. No new instructions are added in this version. The primary issues in this version deal with the reuse of frames in RAM. With limited primary memory, free frames are used up quickly and so further memory allocation is accomplished by selecting a victim frame currently used by another process, updating the relevant page tables and using DMA to load the data into the selected victim frame in primary memory. In order to support a wide variety of page replacement algorithms, the hardware simulation keeps track of many parameters associated with each frame used in primary memory, such as time frame loaded, time frame last referenced, number of frame references, a reference bit, etc. Page replacement algorithms can use any of this information in an effort to minimize page faults. Version 5: Virtual memory, part 3. This version allows frames in memory to be modified. Thus when selecting a victim frame it might be necessary to write the frame out to disk before reading the new frame from the disk. A new instruction required for this version is STORE, which writes the contents of the accumulator to a memory address. The primary issues in this version involve saving modified frames to disk. The hardware simulation keeps track of a modify bit that the system must use to prevent the loss of data. Version 6: Virtual memory, part 4. The previous versions that deal with virtual memory can find themselves thrashing, where paging activities become the dominant activity for the system. This version monitors and prevents thrashing. There are many methods that can be used to prevent thrashing and the students are allowed to select the method they prefer. Essentially, the operating system needs to monitor CPU utilization, the page fault rate or some other measure of memory management efficiency. This version is able to handle any set of processes as long as the amount of primary memory is greater than the minimum required to process the most complex single instruction. For example, one can lower the amount of primary memory to just six frames and any set of processes can still be run to completion by the system. For this case, there is a great deal of memory contention, but the operating system is able to decrease and increase the level of multiprocessing to eventually get all processes to complete. One of the advantages of this simulation is that is can focus the attention of students on single issues. For example, when dealing with virtual memory management, the amount of primary memory can be severely constrained to emphasis the role of the memory manager. Simulations for version 6 often have only 32 bytes of primary memory arranged into 8 frames of 4 bytes each. Version 7: File system. This version introduces a file system. All interacts with files or data in previous versions used the program or process file. This version allows a process to read or write to an existing file or to create a new file. Several new instructions are needed: FILEOPEN, FILECLOSE, READ and WRITE. The file system created for this version is a simple, flat structure. There is only a single top-level directory. The issues in this version concentrate on the management of files on the simulated disk, rather than on the complexity or efficiency of the file structure. Certainly a further version could be added to make the file structure more realistic. Version 8: Internationalization. This version internationalizes the operating system. During the initialization process for the operating system, a language is selected. Once the language is selected, then all the messages from the operating system are given in that language. Also all data is reported according to the language selected. This effects dates, decimal points and other formatting issues. Each student is required to provide data files for at least two languages. If a student only knows a single language, then they are asked to use something like pig latin as their second language. This version could have been done at any stage in the progression of versions. It was placed at the end only because the topic is generally discussed near the end of the class. It would have been an easier project if it had been done earlier and then utilized through the project series. 4 Organization of the projects in class Each version of the operating system is created as a set of three C code files and two header files. The three C code files are the hardware simulator, the main program that initializes the operating system and the operating system functions produced by the students. Header files are provided for the hardware simulator and the main program.

4 The hardware simulator and main program files (and their header files) are provided for each version of the operating system at an ftp site through a web page. The hardware simulator contains all the functions of the hardware and is purposefully ignorant of any notion of a process or any other operating system function. The main program initiates the entire simulation, reads in a parameter file, creates processes from files and has all of the debug print routines for the simulation. The header files contain function prototypes, constant definitions and major data structure declarations. A parameter file is used by each version to allow the student to modify a wide variety of hardware and software parameters and to set/clear various debug option flags. Some examples of hardware parameters would be memory size or the number of devices in a resource class. Some examples of software parameters are the CPU scheduling algorithm or the page replacement algorithm. Some examples of actions allowed by the debug option flags are printing instructions or printing the process control blocks. The debug print routines are located in the main program and they can be used to print out at appropriate moments a wide variety of the information generated by the hardware and software during the simulation. These allow the student to follow a trace of a wide variety of activities within the operating system. The usefulness of the parameter file is that it allows each version to serve as an experimental laboratory for additional projects. One can modify the amount of real memory to see how the overhead for virtual memory changes. One can run the same job stream using several different CPU scheduling algorithms or several different page replacement algorithms. 5 Some Lessons Learned The primary lesson learned it that small simple systems can be used to effectively teach operating system concepts. This approach allows the student to concentrate on the operating system issues in detail. At the same time, this approach allows the student to experiment with their implementation of an operating system by modifying a wide range of hardware and software parameters. As the projects build upon each other, the entire code becomes larger and larger. At some point students are faced with a version of the system that is not working correctly and often this causes them considerable amount of debugging time. While every effort has been made to keep the overall complexity of the system small, the project gets larger simply because the progression of operating systems are doing more and more tasks. Larger projects require more planning and design. The students that are able to plan and design their code are more successful. Software engineering approaches to these projects have worked very well. The first class that used this project approach attempted to do fewer but larger projects. For example, all of virtual memory management was done as a single project, all of devices and input/output was done as a single project. The students were not able to plan adequately for those larger projects. The complexity of the details prevented them from advancing as far as seemed reasonable during a semester. This is why the projects now include stages of some elements such as memory management. Some concepts are easier to learn than others. Process scheduling is an example of an easy concept and virtual memory is an example of a concept that appears to be easy but is not. But it is safe to say that every student who completed a project learned the concepts involved with that project. Students learn from both their successes and failures. They understand the complexity involved in a modern commercial operating system but they more sympathetic to the commercial operating systems that they use. In the end, the students have an appreciation for and a clear understanding of an operating system. Students learn from doing. No student who has complete these projects has left the course with any unexplained mystery about how an operating system works. 6 Availability of the Projects Descriptions of the projects and code for the projects can be found on the following web page (or by writing to the author). References [1] Toby S. Berk, "A Simple Student Environment for Lightweight Process Concurrent Programming under SunOs," SIGCSE Bulletin, March 1996, pp [2] Robert A. Campbell, "Introducing Computer Concepts by Simulating a Simple Computer," SIGCSE Bulletin, September 1996, pp [3] Joel W. Carissimo, "XINU - An Easy to Use Prototype for an Operating System Course," SIGCSE Bulletin, December 1995, pp [4] Douglas Comer and Timothy Fossum, Operating System Design, Vol. I: The Xinu Approach, Prentice- Hall, [5] Charles Crowley, Operating Systems, A Design- Oriented Approach, Irwin, 1997.

5 [6] Michael Kifer and Scott A. Smolka, OSP, An Environment for Operating System Projects, Addison- Wesley, [7] Mauro Morsiani and Renzo Davoli, "Learning Operating Systems Structure and Implementation through the MPS Computer System Simulator," SIGCSE Bulletin, March 1999, pp [8] Abraham Silberschatz and Peter Baer Galvin, Operating System Concepts (Fifth Edition), Addison- Wesley, [9] Andrew S. Tanenbaum and Albert S. Woodhull, Operating Systems, Design and Implementation (Second Edition), Prentice-Hall, 1996.

Operating System Courses

Operating System Courses A Reformed Scheme of Teaching Memory Management in Operating System Courses Jing Meng Department of Computer Science and Engineering Renmin University of China, Beijing, China, 100872 mengjing@mail.ruc.edu.cn

More information

Course Description: This course includes the basic concepts of operating system

Course Description: This course includes the basic concepts of operating system Operating Systems Course Title: Operating Systems Full Marks:60+ 20+20 Course No: CSC259 Pass Marks: 24+8+8 Nature of the Course: Theory + Lab Credit Hrs: 3 Course Description: This course includes the

More information

COMP 3361: Operating Systems 1 Midterm Winter 2009

COMP 3361: Operating Systems 1 Midterm Winter 2009 COMP 3361: Operating Systems 1 Midterm Winter 2009 Name: Instructions This is an open book exam. The exam is worth 100 points, and each question indicates how many points it is worth. Read the exam from

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013 Operating Systems Comprehensive Exam Spring 2013 Student ID # 3/20/2013 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [MEMORY MANAGEMENT] Matrices in Banker s algorithm Max, need, allocated Shrideep Pallickara Computer Science Colorado

More information

Operating Systems. Lecture 09: Input/Output Management. Elvis C. Foster

Operating Systems. Lecture 09: Input/Output Management. Elvis C. Foster Operating Systems 141 Lecture 09: Input/Output Management Despite all the considerations that have discussed so far, the work of an operating system can be summarized in two main activities input/output

More information

Main Points of the Computer Organization and System Software Module

Main Points of the Computer Organization and System Software Module Main Points of the Computer Organization and System Software Module You can find below the topics we have covered during the COSS module. Reading the relevant parts of the textbooks is essential for a

More information

Frequently asked questions from the previous class survey

Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [THREADS] Shrideep Pallickara Computer Science Colorado State University L7.1 Frequently asked questions from the previous class survey When a process is waiting, does it get

More information

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory Virtual Memory Virtual Memory CSCI Operating Systems Design Department of Computer Science Virtual memory separation of user logical memory from physical memory. Only part of the program needs to be in

More information

GENERAL I ARTICLE. Operating Systems. 1. Objectives and Evolution. operating systems, and then we trace the evolution of operating

GENERAL I ARTICLE. Operating Systems. 1. Objectives and Evolution. operating systems, and then we trace the evolution of operating Operating Systems 1. Objectives and Evolution M Suresh Babu In this article we examine the objectives and fun.ctions of operating systems, and then we trace the evolution of operating systems from the

More information

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture were based on those Operating Systems Concepts, 9th ed., by Silberschatz, Galvin, and

More information

UNIVERSITY OF NEBRASKA AT OMAHA COURSE SYLLABUS/DESCRIPTION

UNIVERSITY OF NEBRASKA AT OMAHA COURSE SYLLABUS/DESCRIPTION UNIVERSITY OF NEBRASKA AT OMAHA COURSE SYLLABUS/DESCRIPTION Department and Course Number CSCI 4500 Course Title Operating Systems Course Coordinator Stanley Wileman Total Credits 3 Repeat for Credit? No

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006 Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select

More information

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):

More information

Frequently asked questions from the previous class survey

Frequently asked questions from the previous class survey CS : OPERATING SYSTEMS [VIRTUAL MEMORY] Shrideep Pallickara Computer Science Colorado State University L. Frequently asked questions from the previous class survey Contents of page table entries in multilevel

More information

CSC 280 Operating System Principles

CSC 280 Operating System Principles Computer Science Department cs.salemstate.edu CSC 280 Operating System Principles 3 cr. Instructor: TBA Office: location Phone: (978) 542-extension email: TBA@salemstate.edu Office Hours: days and times

More information

OPERATING SYSTEMS. Prescribed Text Book. Operating System Principles, Seventh Edition. Abraham Silberschatz, Peter Baer Galvin and Greg Gagne

OPERATING SYSTEMS. Prescribed Text Book. Operating System Principles, Seventh Edition. Abraham Silberschatz, Peter Baer Galvin and Greg Gagne OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne 1 DEADLOCKS In a multi programming environment, several processes

More information

I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall

I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall I/O Device Controllers I/O Systems CS 256/456 Dept. of Computer Science, University of Rochester 10/20/2010 CSC 2/456 1 I/O devices have both mechanical component & electronic component The electronic

More information

Chapter 8 Virtual Memory

Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Chapter 8 Virtual Memory Seventh Edition William Stallings Modified by Rana Forsati for CSE 410 Outline Principle of locality Paging - Effect of page

More information

UNOS Operating System Simulator

UNOS Operating System Simulator UNOS Operating System Simulator Proceedings of the 15 th Annual NACCQ, Hamilton New Zealand July, 2002 www.naccq.ac.nz ABSTRACT Zhong Tang UNITEC Institute of Technology Auckland, New Zealand ztang@unitec.ac.nz

More information

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it to be run Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester Mono-programming

More information

Module 9: Virtual Memory

Module 9: Virtual Memory Module 9: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing Other Considerations Demand Segmentation Operating

More information

I/O Systems and Storage Devices

I/O Systems and Storage Devices CSC 256/456: Operating Systems I/O Systems and Storage Devices John Criswell! University of Rochester 1 I/O Device Controllers I/O devices have both mechanical component & electronic component! The electronic

More information

3 rd Year V Semester

3 rd Year V Semester MAULANA ABUL KALAM AZAD UNIVERSITY OF TECHNOLOGY, WEST BENGAL INFORMATION TECHNOLOGY 3 rd Year V Semester Course Structure: Code Paper Contact Periods Per Week L T P Total Contact Hours Credit IT503 Operating

More information

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013 Operating Systems Comprehensive Exam Fall 2013 Student ID # 10/31/2013 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Basic Memory Management

Basic Memory Management Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester 10/15/14 CSC 2/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it

More information

Operating System Design

Operating System Design Module 6: Operating System Design Stage 1 Semester 2 Module Title Module Number/Reference 6 Module Status (Mandatory/Elective) Module ECTS credit 5 Module NFQ level (only if applicable) Pre-requisite Module

More information

Operating Systems. Lecture 07: Resource allocation and Deadlock Management. Elvis C. Foster

Operating Systems. Lecture 07: Resource allocation and Deadlock Management. Elvis C. Foster Operating Systems Lecture 7: Resource allocation and Deadlock Management Lecture 3 started the discussion of process management, with the emphasis on CPU scheduling. This lecture continues that discussion

More information

A CPU Scheduling Algorithm Simulator

A CPU Scheduling Algorithm Simulator A CPU Scheduling Algorithm Simulator Sukanya Suranauwarat School of Applied Statistics, National Institute of Development Administration, 118 Seri Thai Rd., Bangkapi, Bangkok 10240, Thailand sukanya@as.nida.ac.th

More information

e-pg Pathshala Subject: Computer Science Paper: Operating Systems Module 29: Allocation of Frames, Thrashing Module No: CS/OS/29 Quadrant 1 e-text

e-pg Pathshala Subject: Computer Science Paper: Operating Systems Module 29: Allocation of Frames, Thrashing Module No: CS/OS/29 Quadrant 1 e-text 29.1 Introduction e-pg Pathshala Subject: Computer Science Paper: Operating Systems Module 29: Allocation of Frames, Thrashing Module No: CS/OS/29 Quadrant 1 e-text In an earlier module, we learnt what

More information

Chapter 9: Virtual-Memory Management. Operating System Concepts 8 th Edition,

Chapter 9: Virtual-Memory Management. Operating System Concepts 8 th Edition, Chapter 9: Virtual-Memory Management, Silberschatz, Galvin and Gagne 2009 Chapter 9: Virtual-Memory Management Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped

More information

POLYTECHNICS MINISTRY OF EDUCATION MODULE F2007 OPERATING SYSTEM

POLYTECHNICS MINISTRY OF EDUCATION MODULE F2007 OPERATING SYSTEM MALAYSIA POLYTECHNICS MINISTRY OF EDUCATION i MODULE F2007 OPERATING SYSTEM ANITA AJANG (PKS) ADLIN YUSNITA BINTI ILYAS (PKS) ii BIODATA OF MODULE WRITERS F2007 OPERATING SYSTEM Name : Anita Ajang Address

More information

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - XIV Virtual Memory - I. Louisiana State University.

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - XIV Virtual Memory - I. Louisiana State University. CSC 40 - Operating Systems Spring 008 Lecture - XIV Virtual Memory - I Tevfik Ko!ar Louisiana State University March th, 008 Roadmap Virtual Memory page replacement algorithms Background Virtual memory

More information

Operating Systems Prof. Allan Gottlieb Practice Final Exam Page 1 Name

Operating Systems Prof. Allan Gottlieb Practice Final Exam Page 1 Name Operating Systems Prof. Allan Gottlieb Practice Final Exam Page 1 Name PLEASE WRITE YOUR NAME ON ALL SHEETS. Please start your answer for each question on the sheet where the question appears. You may

More information

CSC Operating Systems Spring Lecture - XIV Virtual Memory - II. Tevfik Ko!ar. Louisiana State University. March 27 th, 2008.

CSC Operating Systems Spring Lecture - XIV Virtual Memory - II. Tevfik Ko!ar. Louisiana State University. March 27 th, 2008. CSC 0 - Operating Systems Spring 008 Lecture - XIV Virtual Memory - II Tevfik Ko!ar Louisiana State University March 7 th, 008 Background Virtual memory separation of user logical memory from physical

More information

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: SYSTEM ARCHITECTURE & SOFTWARE [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University OpenMP compiler directives

More information

Background. Demand Paging. valid-invalid bit. Tevfik Koşar. CSC Operating Systems Spring 2007

Background. Demand Paging. valid-invalid bit. Tevfik Koşar. CSC Operating Systems Spring 2007 CSC 0 - Operating Systems Spring 007 Lecture - XIII Virtual Memory Tevfik Koşar Background Virtual memory separation of user logical memory from physical memory. Only part of the program needs to be in

More information

CSc33200: Operating Systems, CS-CCNY, Fall 2003 Jinzhong Niu December 10, Review

CSc33200: Operating Systems, CS-CCNY, Fall 2003 Jinzhong Niu December 10, Review CSc33200: Operating Systems, CS-CCNY, Fall 2003 Jinzhong Niu December 10, 2003 Review 1 Overview 1.1 The definition, objectives and evolution of operating system An operating system exploits and manages

More information

Chapter 9: Virtual-Memory

Chapter 9: Virtual-Memory Chapter 9: Virtual-Memory Management Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation of Frames Thrashing Other Considerations Silberschatz, Galvin and Gagne 2013

More information

Lecture 17. Edited from slides for Operating System Concepts by Silberschatz, Galvin, Gagne

Lecture 17. Edited from slides for Operating System Concepts by Silberschatz, Galvin, Gagne Lecture 17 Edited from slides for Operating System Concepts by Silberschatz, Galvin, Gagne Page Replacement Algorithms Last Lecture: FIFO Optimal Page Replacement LRU LRU Approximation Additional-Reference-Bits

More information

Basic Page Replacement

Basic Page Replacement Basic Page Replacement 1. Find the location of the desired page on disk 2. Find a free frame: - If there is a free frame, use it - If there is no free frame, use a page replacement algorithm to select

More information

REAL-TIME MULTITASKING KERNEL FOR IBM-BASED MICROCOMPUTERS

REAL-TIME MULTITASKING KERNEL FOR IBM-BASED MICROCOMPUTERS Malaysian Journal of Computer Science, Vol. 9 No. 1, June 1996, pp. 12-17 REAL-TIME MULTITASKING KERNEL FOR IBM-BASED MICROCOMPUTERS Mohammed Samaka School of Computer Science Universiti Sains Malaysia

More information

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory. Demand Paging

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory. Demand Paging TDDB68 Concurrent programming and operating systems Overview: Virtual Memory Virtual Memory [SGG7/8] Chapter 9 Background Demand Paging Page Replacement Allocation of Frames Thrashing and Data Access Locality

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 23 Virtual memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Is a page replaces when

More information

Chapter 9: Virtual Memory. Chapter 9: Virtual Memory. Objectives. Background. Virtual-address address Space

Chapter 9: Virtual Memory. Chapter 9: Virtual Memory. Objectives. Background. Virtual-address address Space Chapter 9: Virtual Memory Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations

More information

Process size is independent of the main memory present in the system.

Process size is independent of the main memory present in the system. Hardware control structure Two characteristics are key to paging and segmentation: 1. All memory references are logical addresses within a process which are dynamically converted into physical at run time.

More information

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations

More information

Frequently asked questions from the previous class survey

Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University L15.1 Frequently asked questions from the previous class survey Could we record burst times in

More information

Design Issues 1 / 36. Local versus Global Allocation. Choosing

Design Issues 1 / 36. Local versus Global Allocation. Choosing Design Issues 1 / 36 Local versus Global Allocation When process A has a page fault, where does the new page frame come from? More precisely, is one of A s pages reclaimed, or can a page frame be taken

More information

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture have been largely based on those from an earlier edition of the course text Operating

More information

Virtual Memory. Chapter 8

Virtual Memory. Chapter 8 Virtual Memory 1 Chapter 8 Characteristics of Paging and Segmentation Memory references are dynamically translated into physical addresses at run time E.g., process may be swapped in and out of main memory

More information

Fig Bridge crossing - deadlock

Fig Bridge crossing - deadlock e-pg Pathshala Subject: Computer Science Paper: Operating Systems Module 16: Deadlocks Introduction Module No: CS/OS/16 Quadrant 1 e-text 16.1 Introduction Any system has many processes and a number of

More information

(b) External fragmentation can happen in a virtual memory paging system.

(b) External fragmentation can happen in a virtual memory paging system. Alexandria University Faculty of Engineering Electrical Engineering - Communications Spring 2015 Final Exam CS333: Operating Systems Wednesday, June 17, 2015 Allowed Time: 3 Hours Maximum: 75 points Note:

More information

David Strite and Linda Null Computer Science Department Penn State Harrisburg Middletown, PA and

David Strite and Linda Null Computer Science Department Penn State Harrisburg Middletown, PA and $#% &'$7))'4 7 &'$7))' (1 6* $#% 5;56'/ David Strite and Linda Null Computer Science Department Penn State Harrisburg Middletown, PA 17057 djs352@psu.edu and lnull@psu.edu Abstract Due to the increasing

More information

Frequently asked questions from the previous class survey

Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University L14.1 Frequently asked questions from the previous class survey Turnstiles: Queue for threads blocked

More information

Process- Concept &Process Scheduling OPERATING SYSTEMS

Process- Concept &Process Scheduling OPERATING SYSTEMS OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne PROCESS MANAGEMENT Current day computer systems allow multiple

More information

Readings and References. Virtual Memory. Virtual Memory. Virtual Memory VPN. Reading. CSE Computer Systems December 5, 2001.

Readings and References. Virtual Memory. Virtual Memory. Virtual Memory VPN. Reading. CSE Computer Systems December 5, 2001. Readings and References Virtual Memory Reading Chapter through.., Operating System Concepts, Silberschatz, Galvin, and Gagne CSE - Computer Systems December, Other References Chapter, Inside Microsoft

More information

Background. Virtual Memory (2/2) Demand Paging Example. First-In-First-Out (FIFO) Algorithm. Page Replacement Algorithms. Performance of Demand Paging

Background. Virtual Memory (2/2) Demand Paging Example. First-In-First-Out (FIFO) Algorithm. Page Replacement Algorithms. Performance of Demand Paging Virtual Memory (/) Background Page Replacement Allocation of Frames Thrashing Background Virtual memory separation of user logical memory from physical memory. Only part of the program needs to be in memory

More information

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS : OPERATNG SYSTEMS [VRTUAL MEMORY] Shrideep Pallickara Computer Science Colorado State University Multi-level paging: How many levels deep?

More information

SIR C.R.REDDY COLLEGE OF ENGINEERING, ELURU DEPARTMENT OF INFORMATION TECHNOLOGY LESSON PLAN

SIR C.R.REDDY COLLEGE OF ENGINEERING, ELURU DEPARTMENT OF INFORMATION TECHNOLOGY LESSON PLAN SIR C.R.REDDY COLLEGE OF ENGINEERING, ELURU DEPARTMENT OF INFORMATION TECHNOLOGY LESSON PLAN SUBJECT: (IT 4.1.3) ADVANCED OPERATING SYSTEM CLASS: 4/4 B.Tech. I SEMESTER, A.Y.2017-18 INSTRUCTOR: CHALLA

More information

Module 3: Operating-System Structures

Module 3: Operating-System Structures Module 3: Operating-System Structures System Components Operating-System Services System Calls System Programs System Structure Virtual Machines System Design and Implementation System Generation Operating

More information

Memory. Objectives. Introduction. 6.2 Types of Memory

Memory. Objectives. Introduction. 6.2 Types of Memory Memory Objectives Master the concepts of hierarchical memory organization. Understand how each level of memory contributes to system performance, and how the performance is measured. Master the concepts

More information

Operating System Concepts

Operating System Concepts Chapter 9: Virtual-Memory Management 9.1 Silberschatz, Galvin and Gagne 2005 Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped

More information

Operating Systems (1DT020 & 1TT802)

Operating Systems (1DT020 & 1TT802) Uppsala University Department of Information Technology Name: Perso. no: Operating Systems (1DT020 & 1TT802) 2009-05-27 This is a closed book exam. Calculators are not allowed. Answers should be written

More information

Chapters 9 & 10: Memory Management and Virtual Memory

Chapters 9 & 10: Memory Management and Virtual Memory Chapters 9 & 10: Memory Management and Virtual Memory Important concepts (for final, projects, papers) addressing: physical/absolute, logical/relative/virtual overlays swapping and paging memory protection

More information

More on Synchronization and Deadlock

More on Synchronization and Deadlock Examples of OS Kernel Synchronization More on Synchronization and Deadlock Two processes making system calls to read/write on the same file, leading to possible race condition on the file system data structures

More information

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions: Techno India Batanagar Department of Computer Science & Engineering Model Questions Subject Name: Operating System Multiple Choice Questions: Subject Code: CS603 1) Shell is the exclusive feature of a)

More information

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011 Operating Systems Comprehensive Exam Spring 2011 Student ID # 2/17/2011 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Concurrent & Distributed 7Systems Safety & Liveness. Uwe R. Zimmer - The Australian National University

Concurrent & Distributed 7Systems Safety & Liveness. Uwe R. Zimmer - The Australian National University Concurrent & Distributed 7Systems 2017 Safety & Liveness Uwe R. Zimmer - The Australian National University References for this chapter [ Ben2006 ] Ben-Ari, M Principles of Concurrent and Distributed Programming

More information

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory TDIU Operating systems Overview: Virtual Memory Virtual Memory Background Demand Paging Page Replacement Allocation of Frames Thrashing and Data Access Locality [SGG7/8/9] Chapter 9 Copyright Notice: The

More information

CS 470G Introduction to Operating Systems

CS 470G Introduction to Operating Systems CS 470G Introduction to Operating Systems Course Information Meeting Times University of Kentucky Department of Computer Science Spring 2011 Tues/Thur 2:00 pm - 3:15 pm, Room RMB 323 Instructor Jim Griffioen,

More information

FCM 710: Architecture of Secure Operating Systems

FCM 710: Architecture of Secure Operating Systems FCM 710: Architecture of Secure Operating Systems Practice Exam, Spring 2010 Email your answer to ssengupta@jjay.cuny.edu March 16, 2010 Instructor: Shamik Sengupta Multiple-Choice 1. operating systems

More information

CS420: Operating Systems

CS420: Operating Systems Virtual Memory James Moscola Department of Physical Sciences York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Background Code needs to be in memory

More information

Per-Thread Batch Queues For Multithreaded Programs

Per-Thread Batch Queues For Multithreaded Programs Per-Thread Batch Queues For Multithreaded Programs Tri Nguyen, M.S. Robert Chun, Ph.D. Computer Science Department San Jose State University San Jose, California 95192 Abstract Sharing resources leads

More information

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University CS 370: SYSTEM ARCHITECTURE & SOFTWARE [MASS STORAGE] Frequently asked questions from the previous class survey Shrideep Pallickara Computer Science Colorado State University L29.1 L29.2 Topics covered

More information

CTP203 Operating Systems Syllabus

CTP203 Operating Systems Syllabus Course Details Department of Computer Technology & Programming CTP203 Operating Systems Syllabus Course Name: Course Credits: 4 ECTS Credits: 6 Prerequisite: CTP102 (Elementary Data Structures) Semester:

More information

B. V. Patel Institute of Business Management, Computer and Information Technology, UTU

B. V. Patel Institute of Business Management, Computer and Information Technology, UTU Integrated MCA 3 rd Semester Course: 060060308 CC9 Fundamentals of Operating System LESSON PLAN Objective: To provide a comprehensive knowledge of Operating System and its services. Course Outcomes: Upon

More information

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University CS 555: DISTRIBUTED SYSTEMS [THREADS] Shrideep Pallickara Computer Science Colorado State University Frequently asked questions from the previous class survey Shuffle less/shuffle better Which actions?

More information

Chapter 8: Virtual Memory. Operating System Concepts

Chapter 8: Virtual Memory. Operating System Concepts Chapter 8: Virtual Memory Silberschatz, Galvin and Gagne 2009 Chapter 8: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating

More information

Department of Computer applications. [Part I: Medium Answer Type Questions]

Department of Computer applications. [Part I: Medium Answer Type Questions] Department of Computer applications BBDNITM, Lucknow MCA 311: OPERATING SYSTEM [Part I: Medium Answer Type Questions] UNIT 1 Q1. What do you mean by an Operating System? What are the main functions of

More information

MEMORY MANAGEMENT/1 CS 409, FALL 2013

MEMORY MANAGEMENT/1 CS 409, FALL 2013 MEMORY MANAGEMENT Requirements: Relocation (to different memory areas) Protection (run time, usually implemented together with relocation) Sharing (and also protection) Logical organization Physical organization

More information

ECE519 Advanced Operating Systems

ECE519 Advanced Operating Systems IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (8 th Week) (Advanced) Operating Systems 8. Virtual Memory 8. Outline Hardware and Control Structures Operating

More information

Xinu on the Transputer

Xinu on the Transputer Purdue University Purdue e-pubs Department of Computer Science Technical Reports Department of Computer Science 1990 Xinu on the Transputer Douglas E. Comer Purdue University, comer@cs.purdue.edu Victor

More information

Safety & Liveness Towards synchronization. Safety & Liveness. where X Q means that Q does always hold. Revisiting

Safety & Liveness Towards synchronization. Safety & Liveness. where X Q means that Q does always hold. Revisiting 459 Concurrent & Distributed 7 Systems 2017 Uwe R. Zimmer - The Australian National University 462 Repetition Correctness concepts in concurrent systems Liveness properties: ( P ( I )/ Processes ( I, S

More information

a process may be swapped in and out of main memory such that it occupies different regions

a process may be swapped in and out of main memory such that it occupies different regions Virtual Memory Characteristics of Paging and Segmentation A process may be broken up into pieces (pages or segments) that do not need to be located contiguously in main memory Memory references are dynamically

More information

Fall COMP3511 Review

Fall COMP3511 Review Outline Fall 2015 - COMP3511 Review Monitor Deadlock and Banker Algorithm Paging and Segmentation Page Replacement Algorithms and Working-set Model File Allocation Disk Scheduling Review.2 Monitors Condition

More information

Model answer of AS-4159 Operating System B.tech fifth Semester Information technology

Model answer of AS-4159 Operating System B.tech fifth Semester Information technology Q.no I Ii Iii Iv V Vi Vii viii ix x Model answer of AS-4159 Operating System B.tech fifth Semester Information technology Q.1 Objective type Answer d(321) C(Execute more jobs in the same time) Three/three

More information

Virtual Memory - I. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - XV. University at Buffalo.

Virtual Memory - I. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - XV. University at Buffalo. CSE /5 - Operating Systems Fall 0 Lecture - XV Virtual Memory - I Tevfik Koşar University at Buffalo October rd, 0 Roadmap Virtual Memory Demand Paging Page Faults Page Replacement Page Replacement Algorithms

More information

Operating System Review Part

Operating System Review Part Operating System Review Part CMSC 602 Operating Systems Ju Wang, 2003 Fall Virginia Commonwealth University Review Outline Definition Memory Management Objective Paging Scheme Virtual Memory System and

More information

CMPS 111 Spring 2003 Midterm Exam May 8, Name: ID:

CMPS 111 Spring 2003 Midterm Exam May 8, Name: ID: CMPS 111 Spring 2003 Midterm Exam May 8, 2003 Name: ID: This is a closed note, closed book exam. There are 20 multiple choice questions and 5 short answer questions. Plan your time accordingly. Part I:

More information

Frequently asked questions from the previous class survey

Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [DEADLOCKS] Shrideep Pallickara Computer Science Colorado State University L16.1 Frequently asked questions from the previous class survey Exponential Moving Average Is the α

More information

Teaching and Examination Scheme: PAPER HRS TH TU PR TH PR OR TW TOTAL

Teaching and Examination Scheme: PAPER HRS TH TU PR TH PR OR TW TOTAL Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Fifth for CO/CM/CW/IF and Sixth for CD Subject Title : Operating System Subject Code : 17512 Teaching and Examination Scheme:

More information

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: SYSTEM ARCHITECTURE & SOFTWARE [FILE SYSTEMS] Interpretation of metdata from different file systems Error Correction on hard disks? Shrideep

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2016 Lecture 32 Virtual Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Questions for you What is

More information

Lecture 14 Page Replacement Policies

Lecture 14 Page Replacement Policies CS 423 Operating Systems Design Lecture 14 Page Replacement Policies Klara Nahrstedt Fall 2011 Based on slides by YY Zhou and Andrew S. Tanenbaum Overview Administrative Issues Page Replacement Policies

More information

Deadlocks. Operating System Concepts - 7 th Edition, Feb 14, 2005

Deadlocks. Operating System Concepts - 7 th Edition, Feb 14, 2005 Deadlocks Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 7.2 Silberschatz,

More information

Module 1. Introduction:

Module 1. Introduction: Module 1 Introduction: Operating system is the most fundamental of all the system programs. It is a layer of software on top of the hardware which constitutes the system and manages all parts of the system.

More information

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn 3. CPU Scheduling Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn S P O I L E R operating system CPU Scheduling 3 operating system CPU Scheduling 4 Long-short-medium Scheduler

More information

Following are a few basic questions that cover the essentials of OS:

Following are a few basic questions that cover the essentials of OS: Operating Systems Following are a few basic questions that cover the essentials of OS: 1. Explain the concept of Reentrancy. It is a useful, memory-saving technique for multiprogrammed timesharing systems.

More information

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [DEADLOCKS] Shrideep Pallickara Computer Science Colorado State University Do most applications have some possibility

More information