CS 450 Module R6. Next Week R5 is due next Friday (April 3) No documentation, no source code due R5 is stand-alone, so I will not be checking errors from.

Slides:



Advertisements
Similar presentations
Chapter 3 Basic Input/Output
Advertisements

R4 Dynamically loading processes. Overview R4 is closely related to R3, much of what you have written for R3 applies to R4 In R3, we executed procedures.
CS 450 Module R4. R4 Overview Due on March 11 th along with R3. R4 is a small yet critical part of the MPX system. In this module, you will add the functionality.
CS 450 Module R3. Next Week R2 is due next Friday ▫Make sure to correct all errors with R1 ▫Correct errors in the documentation as well, it will be checked.
CS 450 Module R1. R1 Introduction In Module R1, you will implement a user interface (command handler). There are a couple of options: ▫Command Line: interface.
Module R2 Overview. Process queues As processes enter the system and transition from state to state, they are stored queues. There may be many different.
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.
CS 450 MPX P ROJECT Introduction to MPX. I NTRODUCTION TO MPX The MPX module is divided into six modules Module R1: User Interface Module R2: Process.
Tips for R3: Process Initialization When we create processes to represent our 5 test procedures we must correctly initialize its context by placing values.
EEE 435 Principles of Operating Systems Principles and Structure of I/O Software (Modern Operating Systems 5.2 & 5.3) 5/22/20151Dr Alain Beaulieu.
Process Description and Control Module 1.0. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
1 Computer System Overview OS-1 Course AA
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
CS 450 Module R5. Next Week Reminder: R3 & R4 is due next Friday. Only one member of your group needs to be present at demonstration. If your group would.
Operating System Program 5 I/O System DMA Device Driver.
CS 450 Module R6. Next Week R5 is due Friday after Break ( April 1st ) ▫No documentation, no source code due ▫R5 is stand-alone, so I will not be checking.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
Nachos Phase 1 Code -Hints and Comments
DOS  In the 1980s or early 1990s, the operating system that shipped with most PCs was a version of the Disk Operating System (DOS) created by Microsoft:
Introduction to Processes CS Intoduction to Operating Systems.
FINAL MPX DELIVERABLE Due when you schedule your interview and presentation.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
PROCESSES TANNENBAUM, SECTION 2-1 OPERATING SYSTEMS.
Chapter 4 Processes. Process: what is it? A program in execution A program in execution usually usually Can also have suspended or waiting processes Can.
CS 450 Module R5. Next Week Reminder: R3 & R4 is due next Friday. No documentation due. You do not need to turn in a copy of your source code. Remember.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CE Operating Systems Lecture 11 Windows – Object manager and process management.
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
CS 450 Module R3. Today's Agenda R1 and R2 review Module R3 Introduction Schedule R1 Grading Next Week Module R4 Introduction.
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
Module R3 Process Scheduling. Module R3 involves the creation of a simple “Round Robin” dispatcher. The successful completion of this module will require.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
I/O, Devices & Device Drivers I/O subsystem It is the responsibility of the I/O subsystem of an OS to schedule, manage, & control the interactions between.
ECE 353 Lab 2 Pipeline Simulator Additional Material.
7. IRQ and PIC ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  Interrupts ◦ Section
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Processes and threads.
Process concept.
MICROPROCESSOR BASED SYSTEM DESIGN
Process Management Process Concept Why only the global variables?
PROCESS MANAGEMENT IN MACH
Operating Systems (CS 340 D)
Protection of System Resources
Operating Systems (CS 340 D)
Processor Fundamentals
CS703 - Advanced Operating Systems
Process Description and Control
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Process.
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

CS 450 Module R6

Next Week R5 is due next Friday (April 3) No documentation, no source code due R5 is stand-alone, so I will not be checking errors from previous modules. But in R6- everything needs to work. If you want to demo ahead of time so you don’t have to wait around, I will be available beginning at approx. 2:30 next Friday. me ahead of time or come see me then. I will get as many groups in ahead of time as I can.

R6 Due Dead Week at the time of your group’s oral exam Documentation- due at the oral exam: Programmer’s Manual User’s Manual (but not the temporary commands manual) A complete copy of your source code I will check that you have included the comments that are required and you will lose points if they are missing (check the R2 power point to see the required comments) Turn these documents- bound in some fashion- either a three ring binder or whatever method you want, but do not just staple them, for this module they must be bound. Also, you must turn in a CD with all of your source code (including help files), as well as your programmer’s manual and user’s manual. Also, please include a README file with the following information on the CD: Group number and group member names and semester Compiler and version number you used Operating System Used for development If you used a dos emulator (DosBox) or not Any other information that might be needed to run your MPX project You will need to use the serial port emulator, or two computers physically connected, to demonstrate R6- just like R5.

Oral Exams Oral exams will take place during dead week. On Friday April 24, we will schedule the oral exams- make sure one group member comes so you can schedule your oral exam. If no one from your group shows up on April 24 to schedule, your group’s oral exam takes place on the first available day during dead week, no exceptions. All group members must attend the Oral Exam- if you do not attend, you will FAIL the class. The oral exam will last approximately one hour and will be comprised of R6 demonstration and questions from Dr. Mooney and myself regarding the MPX project- you are expected to know everything about every portion of the project, including how you implemented specific things, and why specific functions are needed- even if you didn’t work on that particular part of MPX. You will find it VERY useful to bring a complete copy of your source code for each group member to the oral exam. It is also helpful if you include a table of contents and tabs for each module so you can find specific functions quickly to answer questions.

R6: Overview We need to implement “continuous dispatch” Comhan will be loaded as a process. An IDLE process will be introduced, so there is always something in the ready queue and ready to dispatch. We will also need to provide more support for I/O Requests An I/O scheduler and completion handler will be added to handle I/O events. Support for the terminal driver provided in the support software will be added.

Commands At this point, only the permanent commands should be in your system- all temporary commands should be disabled! Commands that are temporary and should be removed: Block Unblock Loading the R3 test processes Dispatch Create-PCB Delete-PCB Commands that should be available in R6 Set/get date Display MPX files Help Load Quit/Exit Suspend* Resume* Terminate* Set Priority* Show all/blocked/ready/specific PCB Version Any commands relating to extra credit *Do not allow users to suspend, resume, terminate, or change the priority of SYSTEM processes.

Comhan and IDLE In order to obtain “continuous” dispatch- we will need to load comhan and an idle process into the ready queue when MPX starts. Comhan Whatever your procedure name is that handles your commands (the one that prompts the user for a command and receives it) needs to be installed as a process in MAIN. Do this the same way you loaded the test processes in R3 Give Comhan the highest priority, place it in the ready, not suspended state, insert it into the ready queue. You may find it necessary to give Comhan a larger stack space than other processes- minimum recommended stack size for Comhan is 4K. When comhan gets the “exit” command- it should remove all processes from the queues, including IDLE and itself, so that when dispatch is run again, it detects an empty ready queue and returns to main. IDLE- available on my website Load idle- use your “load” function from R4 Give IDLE the LOWEST priority Make sure IDLE is designated a SYSTEM process Resume it and put it in the ready queue IDLE doesn’t do anything, it just ensures there is always a process in the ready queue and thus dispatcher won’t quit until we want it to.

I/O Event Handling The basic idea here is this: while an I/O device is carrying out an I/O request and a process is waiting on the I/O request, another process should be allowed to execute (have control of the CPU). We will need to add functionality that allows us to queue I/O requests, by device, and start an I/O operation and run another process. We will also need to implement a way to handle the completion of an I/O operation.

Handling I/O Events Devices Com Port- driver written by you in R5 Terminal- driver supplied on my website Data Structures IO Control Block (IOCB)- holds information about an I/O device IO Request Descriptor (IOD)- holds information about and I/O request I/O Scheduler Processes I/O requests, either by processing immediately if the device is free or by placing it on the device’s waiting queue if the device is busy. It is most convenient to put your I/O scheduler and all related data structures in your R3 files. Sys_call Each time sys_call is invoked, it will check to see if any I/O events have been completed- if so: COP must be switched from the blocked to ready state and moved from the blocked to ready queue Active IOCB (device) must be cleared to signal that no request is active for the device Search the waiting queue for another process waiting to use the device that was just freed. If one is found, the I/O scheduler is called to start the I/O.

I/O Request Descriptors (IOD) We need to keep track of certain information for every active or pending I/O request Two options for where to put the IOD’s An MPX process can only have 1 pending I/O request at a time, so it is possible to embed an IOD in each PCB. However, this is not very convenient when it comes time to find the next I/O operation to be run. Create a “waiting queue” of IOD’s for each device- much more convenient, and I will assume you use this option in the remaining slides. Suggested information to keep track of: Name of the process (PCB) requesting the I/O operation (char[]) Pointer to the PCB requesting the I/O operation Request type: what kind of I/O request (i.e. IDLE, READ, WRITE, CLEAR) (int) Location of the transfer buffer (char*) Pointer to the count variable of the buffer (int*) Pointer to the next IOD in the waiting queue Note that the request type, transfer buffer, and count variable refer to the op_code, buffer_address, and count_address in the parameter* you use in R3

I/O Control Block (IOCB) Each device needs a control structure which will keep track of the waiting queue and current status Suggested information you need to keep track of in the IOCB: event_flag: int- will hold the current event_flag for the device count: int- number of IOD’s in the queue head: iod*- pointer to the first IOD in the waiting queue tail: iod*- pointer to the last IOD in the waiting queue You will maintain the waiting queues in first in, first out order.

I/O Operations You will need to download and link with your project “TRMDRIVE.C” and “TRMDRIVE.H”- these are the functions for the TERMINAL driver. You can open the files to see the parameters the functions take. Make sure to include TRMDRIVE.H and link TRMDRIVE.C. They will be available on my website. The following table illustrates what functions to call for which I/O operations- the COM_PORT functions come from your R5, check TRMDRIVE.C and.H for more specifics on the TERMINAL functions DeviceOPENCLOSEREADWRITECLEAR GOTOXY COM_PORTcom_opencom_closecom_readcom_writeN/A TERMINALtrm_opentrm_closetrm_readtrm_writetrm_cleartrm_gotoxy

Processing an I/O Request In both sys_call and the I/O Scheduler, it will be necessary to process an I/O Request. Here is the basic outline of how you would do that: Decode the request (from the IOD->request) for the operation at the head of the queue, it will either be READ, WRITE, CLEAR, GOTOXY You will now need to call the appropriate function to handle the request: The parameters are the same if you are calling a read or write (trm_read, for example): IO_FUNCTION(com_iocb.head->buf_addr, com_iocb.head->count_addr) Call the appropriate operation, using the syntax above, to handle the request. Check the chart on the I/O operations slide for information on which function to call. Note that CLEAR and GOTOXY for the TERMINAL device require different parameters than those listed above.

I/O Scheduler The I/O scheduler is a function you will write that will process a new I/O request. You will recall that in R3 you used a pointer to “parameters” that were pushed on the stack when an interrupt was generated- we will need to access those parameters again. Because of this, it makes your coding very convenient if you place the I/O Scheduler in your R3.C file, and place the IOD and IOCB structs in R3.H It also makes it very convenient if you make your parameter* (that you used in R3) global, if you haven’t already. If you make the parameter* global, you will not need to pass any parameters to your IO Scheduler. In short, the I/O scheduler will create a new IOD for the I/O request, and either run it if the device is ready, or place it in the waiting queue to be run later.

I/O Scheduler: Outline Check which device is being requested (stored in the device_id of the parameters) Create an IOD for the new request (allocate space using sys_alloc_mem) Set the PCB* in the IOD to COP, and set the name-> The COP is the process making the I/O request, so you need to save that in the IOD Set the buffer address to the parameter* buf_addr, and count address to the parameter* count_addr, and the request to the parameter* op_code If the waiting queue for that device is empty (count = 0) Insert the new IOD into the waiting queue as the head and tail, set count = 1. Process the request immediately- refer to the slide on processing I/O requests on how to do this If waiting queue for that device is not empty Insert the new IOD into the waiting queue at the tail Block the process and return.

I/O Completion Every time sys_call is invoked, it will need to check if any I/O operations have been completed. Sys_call will do this by checking the event flags in each IOCB- if it is set, some “completion” steps need to be performed

Sys_call modifications Call trm_getc()- this will flush the DOS keyboard buffer into the MPX buffer For each I/O device (COM_PORT and TERMINAL): Check if the event_flag is set (=1) If the flag is set Clear the IOCB’s event_flag (set = 0) Remove the IOD at the head of the IOCB’s waiting queue and free the IOD’s memory Unblock the process who had requested the IOD you just freed, this should put it in the ready queue. The process that requested the IOD is maintained as a field in the IOD Process the next I/O request for that device Suggested to perform these steps after you switch to the system (temporary) stack, and before you reset COP’s stack top pointer. At the end of sys_call, where you currently check the op_code to see if it is IDLE or EXIT, you need to add checks for READ, WRITE, CLEAR, GOTOXY- if the op_code is any of these values, call your IO Scheduler to handle the interrupt.

I/O Initialization You need to create and initialize the IOCB’s for the terminal and com_port devices You need to open the terminal and com_port devices trm_open(POINTER TO THE IOCB EVENT FLAG); com_open(POINTER TO THE IOCB EVENT FLAG, baud_rate); Set the baud rate = 1200 By passing a pointer to the event_flag, this allows the terminal and com interrupt handlers to directly modify the event_flag.

I/O Cleanup When MPX is terminated Close the devices by calling trm_close and com_close Clear the waiting queues, free the memory of any IOD’s in the queue Free the memory for the IOCB for each device

Main Your main should do the following now- 1. sys_init(MODULE_F) 2. Call Init functions- you might have already written init functions in R2 and R3 that do the following: sys_set_vec needs called initialize DCBs, IOCBs initialize PCB ready/blocked queues 3. Open device drivers 4. Install command handler as a process 5. Load IDLE 6. Call dispatcher- this should run your comhan 7. Close device drivers 8. Other cleanup- you might have cleanup functions in R2 and R3 to call Make sure the queues get cleared and all allocated memory is de-allocated 9. sys_exit()

Test Processes Available on my website Load these using your load function to test your project. CPUTERM. A process which repeatedly displays a message line on the display screen. This process is CPU bound; it waits for a while in a loop between messages, consuming processor time. It runs continuously until terminated. CPUCOM. Similar to CPUTERM, but this process outputs its messages to the communication port. We assume that a standard terminal, or a separate PC or workstation running terminal emulation software, is connected to this port. IOTERM. Similar to CPUTERM, but this process includes no delay loop. It attempts to continuously output messages, making a new request as soon as the last one has been completed. IOCOM. Similar to IOTERM, but this process outputs its messages to the communications port. IOTRM25. Similar to IOTERM; however, this process displays its normal message exactly 25 times, then requests termination. A special message is displayed before the termination request. If the process is dispatched after its termination request, an error message is displayed, and the process restarts. IOCOM25. Similar to IOTRM25, but this process outputs all of its messages to the serial port. IOMULTI: Takes input from the com port and prints it to the screen.

Preliminary Code On Friday April 17, you must turn in “preliminary” code for R6. I want to see that you have written a majority of the code- you have coded the section where Comhan gets loaded as a process and you have made substantial progress towards the I/O scheduler- a majority of it must be written, but it does not have to work. My intention is to force you to start working on R6 early and get the code written so you have 2 weeks to dedicate just to debugging. Code is due at the beginning of the project session on 4/17. You may print out the appropriate sections of code and hand it in or me a copy of your source code. If you turn in the preliminary code on: Friday 4/17 you lose no points Monday 4/20 you lose 1 point Tuesday 4/21 you lose 2 points If you fail to turn in by Tuesday 4/21, you lose 3 points.

Tips You cannot use any I/O device before you call trm_open and com_open- this includes using printf. Once you change sys_init to MODULE_F, MPX will only work if your I/O scheduler works! Remember that you have up to three extra credit points available to you- some of these are very simple to implement. Change prompt, history, aliasing, accepting commands from a script/batch file Your programmer’s manual should have documentation for every function in your code and every structure in your code Your user’s manual should have documentation for all permanent commands Documentation will be graded more thoroughly than previous attempts All functionality of MPX will be tested again- so make sure everything works! Make sure to thoroughly test your project- crashes in particular will reflect poorly in your grade. Make sure you have descriptive error messages displayed anytime there is an error. Make sure that help is there for all permanent commands. Make sure you implement paging for help, show, and anywhere else it is appropriate. The R6 project manual will be available on my website- as always, reading it will make this module easier to complete For Module R6, do not use anything from Dr. Mooney’s site- it is not in sync with the R6 you are doing this semester.