Real Time Operating Systems Memory Management & Device Control.

Slides:



Advertisements
Similar presentations
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Advertisements

CS-334: Computer Architecture
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Lecture Objectives: 1)Explain the limitations of flash memory. 2)Define wear leveling. 3)Define the term IO Transaction 4)Define the terms synchronous.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
Basic Input/Output Operations
Chapter 11 Operating Systems
Computer-System Structures
Chapter 7 Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats.
CHAPTER 9: Input / Output
Presented By Chandra Shekar Reddy.Y 11/5/20081Computer Architecture & Design.
Chapter 17 Microprocessor Fundamentals William Kleitz Digital Electronics with VHDL, Quartus® II Version Copyright ©2006 by Pearson Education, Inc. Upper.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Input and Output Computer Organization and Assembly Language: Module 9.
Interrupts and DMA CSCI The Role of the Operating System in Performing I/O Two main jobs of a computer are: –Processing –Performing I/O manage and.
2.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 2: Computer-System Structures Computer System Operation I/O Structure.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Chapter 2: Computer-System Structures
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
Operating Systems Lecture 2 Processes and Threads Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CE-321: Computer.
I/O Computer Organization II 1 Interconnecting Components Need interconnections between – CPU, memory, I/O controllers Bus: shared communication channel.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Modes of transfer in computer
CH10 Input/Output DDDData Transfer EEEExternal Devices IIII/O Modules PPPProgrammed I/O IIIInterrupt-Driven I/O DDDDirect Memory.
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.
L/O/G/O Input Output Chapter 4 CS.216 Computer Architecture and Organization.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
Review of Computer System Organization. Computer Startup For a computer to start running when it is first powered up, it needs to execute an initial program.
IT3002 Computer Architecture
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
بسم الله الرحمن الرحيم MEMORY AND I/O.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
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.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
CSCI 315 Operating Systems Design
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 13: I/O Systems.
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:

Real Time Operating Systems Memory Management & Device Control

4-Jun-16 Major RW Smith Memory Management & Device Control- 2 Outline  Memory Management  Classic Memory Problems  Processes, Threads & Partitions  Memory Management in  C/OS-II  Device Control  Device (Hardware) Input / Output Mechanisms  Status Driven Device Control  Interrupt Driven Device Control  An Example: the Bytronic IBM PPI Card

4-Jun-16 Major RW Smith Memory Management & Device Control- 3 “Classic” Memory Problems  What memory issues / errors are common to programs written in low-level languages like C?  How do languages like Java address many of these issues?  Why is that solution not suitable for most real-time systems?

4-Jun-16 Major RW Smith Memory Management & Device Control- 4 Memory Leaks  Putting the power of direct dynamic memory allocation in the hands of the developer can often lead to memory leaks  for example, malloc( ) and free( ) in ANSI C  A memory leak occurs when allocated memory is not returned to free memory after it is no longer needed  An accumulation of the leak, usually over a long period of continuous execution, can lead to a catastrophic system failure Why are so many real-time systems susceptible to this problem?

4-Jun-16 Major RW Smith Memory Management & Device Control- 5 Memory Fragmentation  Even if a program is free of memory leaks, the use of functions such as malloc( ) and free( ) over long periods of execution can often lead to memory fragmentation  Fragmentation occurs as free memory gets segmented into smaller and smaller blocks of contiguous memory  Besides introducing fragmentation issues, malloc( ) and free( ) also exhibit non-deterministic execution times, particularly due to the increasing difficulty of finding contiguous memory as fragmentation grows

4-Jun-16 Major RW Smith Memory Management & Device Control- 6 Processes, Threads & Partitions  A process is a heavy-weight unit of concurrency that executes within its own protected memory space  A thread is a light-weight unit of concurrency that executes within the same memory space as other threads  A memory partition is a contiguous region of memory made up of an integer number of fixed size blocks  accessible by any thread within the process

4-Jun-16 Major RW Smith Memory Management & Device Control- 7 Memory Management in  C/OS-II   C/OS-II provides a memory management module in support of memory partitions  Developers are encouraged to use these services instead of the dynamic memory allocation C functions malloc( ) & free( )  The system calls that make up the memory management services are all deterministic; they run in constant time {O(1)} Careful and consistent use of these services is still required if memory problems are to be avoided!

4-Jun-16 Major RW Smith Memory Management & Device Control- 8  C/OS-II OSMem services  OSMemCreate( ) 1  OSMemGet( ) 2  OSMemPut( ) 3  OSMemQuery( ) 1.Each memory partition has its own memory control block to keep track of its status. 2.The application must not use more memory than that specified by the block size. 3.Returned blocks must be put back into the correct partition. null OSMemAddr

4-Jun-16 Major RW Smith Memory Management & Device Control- 9 Example  See handout on use of memory partitions in  C/OS-II

4-Jun-16 Major RW Smith Memory Management & Device Control- 10 How does a real-time system interact with the real world?  Recall that one the main characteristics of a real-time system is to interact with its environment. In order for it to do so, software must interface to hardware via special purpose input / output devices.  Interfaces to these devices and techniques to control them vary widely because:  of different computer architectures  of different control interfaces  of different device requirements

4-Jun-16 Major RW Smith Memory Management & Device Control- 11 Device Input / Output Mechanisms  Separate bus architecture  access to a device is typically through a set of registers  logically separate bus for memory and device I/O  two sets of assembly instructions  example Intel x86 architectures CPU MemoryDeviceA DeviceBDeviceC

4-Jun-16 Major RW Smith Memory Management & Device Control- 12 Device Input / Output Mechanisms  Memory-mapped architecture  devices still typically accessed through registers  addresses divided among memory and devices  a single set of assembly instructions  example Motorola architecture CPU Memory DeviceADeviceB

4-Jun-16 Major RW Smith Memory Management & Device Control- 13 Status Driven Device Control  In this mechanism, a controlling program explicitly checks (polls) the status of a device through its register(s)  Typical hardware instructions include:  test operations which allow the program to determine the status of a device  control operations which allow the program to send device-dependent action commands to a device  input/output operations which allow the program to transfer data to/from a device

4-Jun-16 Major RW Smith Memory Management & Device Control- 14 Interrupt Driven Device Control  In this mechanism, the device itself generates an interrupt which must then be handled by the controlling program  Allows I/O to be performed asynchronously, thus avoiding the busy waiting or constant polling of pure status controlled systems  However this requires support for:  context switching  interrupt device & handler identification  interrupt control

4-Jun-16 Major RW Smith Memory Management & Device Control- 15 An Example: the Bytronic IBM PPI Card  See handouts for example showing how to control a robotic arm  The arm consists of two pulse-width modulated stepper motors which control the azimuth and elevation movement of the arm  The position of the motors is fed back via two potentiometers

4-Jun-16 Major RW Smith Memory Management & Device Control- 16 References [1] Labrosse, J.J., “MicroC/OS-II” 1 st and 2 nd Editions (1999, 2002). [2] Burns, A. and Wellings, A., “Real-Time Systems and Programming Languages”, Chapter 15, Addison Wesley, [3] Bytronic handbook, “The Bytronic IBM Internal and External Interfaces MPIBM1 and MPIBM2”, Version No 2.2.