Embedded Real-Time Systems

Slides:



Advertisements
Similar presentations
Process management Information maintained by OS for process management  process context  process control block OS virtualization of CPU for each process.
Advertisements

CPS3340 COMPUTER ARCHITECTURE Fall Semester, /17/2013 Lecture 12: Procedures Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL.
Memory Management Questions answered in this lecture: How do processes share memory? What is static relocation? What is dynamic relocation? What is segmentation?
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
Processes CSCI 444/544 Operating Systems Fall 2008.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Multiprocessing Memory Management
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
OS Spring’03 Introduction Operating Systems Spring 2003.
Operating Systems Lecture # 3. Recap Hardware Operating System Application System Call Trap Hardware Trap Processor.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
OS Spring’04 Introduction Operating Systems Spring 2004.
Chapter 2 The OS, the Computer, and User Programs Copyright © 2008.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Threads and Processes.
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.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 13 Threads Read Ch 5.1.
Process by Dr. Amin Danial Asham. References Operating System Concepts ABRAHAM SILBERSCHATZ, PETER BAER GALVIN, and GREG GAGNE.
Chapter 4 Memory Management Virtual Memory.
CS333 Intro to Operating Systems Jonathan Walpole.
CPS110: Implementing threads Landon Cox. Recap and looking ahead Hardware OS Applications Where we’ve been Where we’re going.
Lecture 5: Threads process as a unit of scheduling and a unit of resource allocation processes vs. threads what to program with threads why use threads.
Department of Computer Science and Software Engineering
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Memory Management Overview.
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
CPS110: Implementing threads on a uni-processor Landon Cox January 29, 2008.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Scheduler activations Landon Cox March 23, What is a process? Informal A program in execution Running code + things it can read/write Process ≠
Introduction to Operating Systems Concepts
Processes and threads.
Process concept.
Operating Systems CMPSC 473
Chapter 8: Main Memory.
Process Management Process Concept Why only the global variables?
Chapter 1: A Tour of Computer Systems
CS 6560: Operating Systems Design
Lecture Topics: 11/1 Processes Process Management
Modeling Page Replacement Algorithms
CS399 New Beginnings Jonathan Walpole.
Process Management Presented By Aditya Gupta Assistant Professor
Chapter 3: Processes.
Process Realization In OS
Intro to Processes CSSE 332 Operating Systems
Instructors: Haryadi Gunawi
Threads & multithreading
Lecture 28: Virtual Memory-Address Translation
More examples How many processes does this piece of code create?
Main Memory Background Swapping Contiguous Allocation Paging
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Modeling Page Replacement Algorithms
PROCESS MANAGEMENT Information maintained by OS for process management
Memory Management Overview
Lecture Topics: 11/1 General Operating System Concepts Processes
Threads and Concurrency
CSE 451: Operating Systems Autumn 2005 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Operating System Introduction.
Chapter 3: Processes.
Operating Systems: A Modern Perspective, Chapter 6
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CS510 Operating System Foundations
CSE 153 Design of Operating Systems Winter 2019
Threads CSE 2431: Introduction to Operating Systems
CS Introduction to Operating Systems
Presentation transcript:

Embedded Real-Time Systems Memory management Lecturer Department University

Outline Memory types and virtual memory Separate vs common memory spaces Memory management in RTOS

Same code, but what about the data??? Tasks and data Task is not code Two tasks can be executing the same code simultaneously Think of it as an execution thread running through the code Task 1 Task 2 int x; int Func() { int y; y = y + 1; x = x + 1; ... } Same code, but what about the data???

Recall from computer architecture… CPU registers Program counter (address of the currently executing instruction) Data and address registers Main memory. Depending on the usage, usually subdivided into code (read only) data (read/write) stack (function returns + variables) heap (dynamically allocated data) int x; int Func() { int y; int* buf = malloc(…); y = y + 1; x = x + 1; ... } *buf

Stack memory Stack memory – LIFO CPU Function return addresses Local function variables CPU Stack pointer int FuncB() { int Y; ... return; } B allocates memory for Y B is called Y int FuncA() { int X; ... FuncB(); return; } ret.addr. for B X A allocates memory for X ret.addr. for A A is called

More memories… Virtual memory: CPU hardware provides mapping between virtual and physical addresses Virtual memory Physical memory 1000: 2000: 3000: ... 9000: 1000: 2000: 3000: ... 9000: Address translation External storage (hard disk)

Memory spaces Memory mapping defines memory space Memory mapping 1 Having different memory spaces for different tasks can be used to isolate tasks from each other Virtual memory space 1 Virtual memory space 2 Physical memory 1000: 2000: 3000: ... 9000: 1000: 2000: 3000: ... 20000: 1000: 2000: 3000: ... 9000: Memory mapping 1 Memory mapping 2

Memory spaces (contd.) Memory protection can also be used to isolate tasks even when they use the same memory mapping Virtual memory space 1 Virtual memory space 2 Physical memory 1000: 2000: 3000: ... 9000: 1000: 2000: 3000: ... 20000: 1000: 2000: 3000: ... 9000: Memory mapping Memory mapping

Task context Each task has its own CPU environment – context state of the CPU (registers) state of memory management unit (address translation and protection table) – if virtual memory is used Task context saved in a task control block (TCB) OS-specific data: I/O assignments for standard input/output/error stack – where task stores its dynamic variables and function calls ...

Memory management in RTOS RTP 3 Process heap Process code Task ... Real-time processes OS kernel RTP 2 Process heap Process code Task ... RTP 1 Process heap Process code Task ... RTOS kernel environment ... App. code App. code Task ... Task Tasks in each RTP run in a memory space separate from tasks in other RTPs and from kernel tasks RTOS code Kernel heap Board support package

Same vs separate memory spaces Unix/Windows/RTOS RTPs Process 1 mem. space Process 2 mem. space data: data: global vars: x stack: y global vars: x stack: y code: code: int x; int Func() { int y; y = y + 1; x = x + 1; ... } int x; int Func() { int y; y = y + 1; x = x + 1; ... } Task 1 Task 2 PC1 PC2

Same vs separate memory spaces Common mem. space RTOS kernel TCB1: TCB2: stack: y stack: y data: global vars: x What about y? code: int x; int Func() { int y; y = y + 1; x = x + 1; ... } Task 1 Task 2 PC1 PC2

Comparing memory models Inter-task communications Task switching overheads Concurrent code execution Hardware support Software debugging and testing System stability

RTOS vs Windows/Unix Same Different Real time process = Windows/Unix process Task in RTP = Thread in Windows/Unix Different RTOS schedules tasks across RTPs Deterministic real-time behaviour Windows/Unix shares CPU between processes Threads are scheduled within each process separately RTOS does not use address translation and loads whole processes into memory before execution Fast task switching Compatible with CPUs without MMU (no memory protection though!) Deterministic memory access time

Summary Virtual memory and task context Comparison of separate and common memory models Comparison of RTOS and Windows/Unix memory management