Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 7.1 Operating System Concepts Operating Systems Lecture 26 CPU Simulator II.

Slides:



Advertisements
Similar presentations
Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
Advertisements

CS 11 C track: lecture 7 Last week: structs, typedef, linked lists This week: hash tables more on the C preprocessor extern const.
Silberschatz, Galvin, and Gagne Applied Operating System Concepts Module 13: Secondary-Storage Chapter 14 – Silberschatz – 6 th ed. Disk Structure.
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 36 Virtual Memory Read.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 27 CPU Simulator III.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 38 Frame Allocation Read.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 17 Scheduling III.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 16 Scheduling II.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 19 Scheduling IV.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 30 Handling Deadlock.
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 16: Classes and Objects.
02/19/2010CSCI 315 Operating Systems Design1 Process Synchronization Notice: The slides for this lecture have been largely based on those accompanying.
CS1061: C Programming Lecture 23: Review; Examination Details A. O’Riordan, 2005.
1/27/2010CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying an earlier version.
1/23/2008CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
BASE CLASSES AND INHERITANCE CHAPTER 4. Engineer Class.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 346, Royden, Operating System Concepts Operating Systems Lecture 24 Paging.
1 Operating Systems Lecture 3 Shell Scripts. 2 Shell Programming 1.Shell scripts must be marked as executable: chmod a+x myScript 2. Use # to start a.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 32 Paging Read Ch. 9.4.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 1 Introduction Read:
Nachos Phase 1 Code -Hints and Comments
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 23 Classic Synchronization.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 34 Paging Implementation.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 6 System Calls OS System.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 7 OS System Structure.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 11 Structured Data.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 13 Threads Read Ch 5.1.
CPS120: Introduction to Computer Science Lecture 14 Functions.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 15 Scheduling Read Ch.
CLIP Command Line InterPreter for a subset of C++.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 5: Process Synchronization.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11: Structured Data.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
CS Class 08 Today  Exercises  Nested loops  for statement  Built-in functions Announcements  Homework #3, group solution to in-class.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 28 Handling Deadlock.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 18 Midterm Review.
4.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Project1: Unix Shell with History Feature Goals Descriptions Methodology Submission.
Copyright © 2012 Pearson Education, Inc. Chapter 11: Structured Data.
CS 261 – Data Structures Introduction to C Programming.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 10 Processes II Read.
Silberschatz, Galvin and Gagne  Operating System Concepts UNIT II Operating System Services.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 14 Threads 2 Read Ch.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 11: Synchronization (Chapter 6, cont)
1 One Dimensional Arrays Chapter 11 2 "All students to receive arrays!" reports Dr. Austin. Declaring arrays scores :
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 25 CPU Simulator.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 24 Critical Regions.
Linked List (II) CGS 3460, Lecture 37 Apr 12, 2006 Hen-I Yang.
1 For Loops l From Chapter 9 l A shorthand way of coding count loops.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 31 Memory Management.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 11: Structured Data.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 22 Semaphores Classic.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Types of shedulars Process.
1 1  Lecture 11 – Structured Data FTMK, UTeM – Sem /2014.
Lecture 01d: C++ review Topics: functions scope / lifetime preprocessor directives header files C structures ("simple classes")
Chapter Structured Data 11. Combining Data into Structures 11.2.
Tarik Booker CS 242. What we will cover…  Functions  Function Syntax  Local Variables  Global Variables  The Scope of Variables  Making Functions.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 8 Processes II Read Ch.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 33 Paging Read Ch. 9.4.
Introduction to the C programming language
Text Illustrations in PPT Chapter 5 CPU Scheduling
Introduction to Computing Lecture 09: Functions (Part II)
Presentation transcript:

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 26 CPU Simulator II

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts The event loop NextEventSimulator eventQ; initialize_event_queue(eventQ, otherData); Event *theEvent; theEvent = eventQ.nextEvent( ); while (theEvent != NULL) { handleEvent(theEvent, otherData); theEvent = eventQ.nextEvent( ); }

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Handling events We will write this code in class.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Keeping Track of Variables It's a good idea to make lists of variables that you will need to update and keep track of in your program. We will start a list now, and add to it as needed while we design our functions. Process variablesSimulation variables

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Helpful Hint Use a class or struct to keep all your process variables together. Use a class or struct to keep all your simulation variables together. This makes parameter passing easier. (You will lose points for relying on global variables!) Use enums to make lists of integers more readable (e.g. process states, CPU states, etc.)

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts handle_new_ready( ) We will determine what needs to be done for this function in class.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts handle_ready_run( ) We will determine what needs to be done for this function in class.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts handle_run_term( ) We will determine what needs to be done for this function in class.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts handle_run_block( ) We will determine what needs to be done for this function in class.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts handle_block_ready( ) We will determine what needs to be done for this function in class.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Files, etc. Place all the code for the fcfs simulation in the file"fcfs.cc" In driver.cc, you should have an include line:  #include "fcfs.cc" To compile, you can type:  g++ driver.cc -o sim Place all struct definitions and enums in a file "sim.h" Include "sim.h" in both driver.cc and fcfs.cc  You will need to use #ifndef SIM_H, etc. to make sure the linker doesn't complain. Use the following include lines in sim.h:  #include "nextEvent.h"  #include "list.h" Do not include nextEvent.h or list.h in driver.cc or fcfs.cc

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Developing your code Write your functions one at a time. Debug each function before you start working on the next. Example: Make sure your function to initialize the Event queue inserts all the appropriate events based on the process arrival times before you try to right any of the event handlers. Use cout statements and the display( ) function (part of the NextEventSimulator and the list classes) to make sure your function is doing the right thing.