SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 2 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 3 – Process Concepts Outline 3.1 Introduction 3.1.1Definition of Process 3.2Process States:
Embedded System Presentation Nguyễn Trần Quang Nguyễn Công Vũ 1µC/OS-II.
Department of Mathematics and Computer Science μC/OS-II 2IN60: Real-time Architectures (for automotive systems)
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
Big Picture Lab 4 Operating Systems Csaba Andras Moritz.
A. Frank - P. Weisberg Operating Systems Process Scheduling and Switching.
Input-output and Communication Prof. Sin-Min Lee Department of Computer Science.
Process Description and Control
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Processes 1 CS502 Spring 2006 Processes Week 2 – CS 502.
OS Spring’03 Introduction Operating Systems Spring 2003.
Chapter 11 Operating Systems
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
1 When to Switch Processes 3 triggers –System call, Interrupt and Trap System call –when a user program invokes a system call. e.g., a system call that.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
MicroC/OS-II Embedded Systems Design and Implementation.
OS Spring’04 Introduction Operating Systems Spring 2004.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Performance Evaluation of Real-Time Operating Systems
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Introduction to Embedded Systems
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
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.
Real-Time Systems Design1 Priority Inversion When a low-priority task blocks a higher-priority one, a priority inversion is said to occur Assume that priorities:
SOC Consortium Course Material Real-time OS Speaker: 沈文中 April. 9, 2003 National Taiwan University Adopted from National Chiao- Tung University SOC Course.
Getting Started with the µC/OS-III Real Time Kernel Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
2-1 The critical section –A piece of code which cannot be interrupted during execution Cases of critical sections –Modifying a block of memory shared by.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
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,
Real Time Operating Systems
Real-time OS Hao-yuan Chin Feb. 18, Institute of Electronics, National Chiao Tung University Real-time OS 1 Outline Introduction to RTOS Introduction.
Scheduling Lecture 6. What is Scheduling? An O/S often has many pending tasks. –Threads, async callbacks, device input. The order may matter. –Policy,
Chapter 2 Processes Processes Topics Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Real Time Operating Systems Mutual Exclusion, Synchronization & Intertask Communication Course originally developed by Maj Ron Smith.
MicroC/OS-II S O T R.  MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2.  It.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Chapter 3 RTOS Concepts And Definitions Department of Computer Science Hsu Hao Chen Professor Hsung-Pin Chang.
SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 1 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Chapter 7: Semaphore Management Seulki Lee 1. Semaphore?  A protocol mechanism offered by most multitasking kernels  Control access to a shared resource.
2-1 Chapter 2 Real-Time Systems Concepts. 2-2 Foreground/Background Systems BackgroundForeground ISR Time Code execution application consists of an infinite.
Real Time Operating Systems Johan Dams
Big Picture Lab 4 Operating Systems C Andras Moritz
Chapter 1: Getting Started with μC/OS-II 1. kernel Introduction 2 LinuxμC/OS-II Task (process) kernel Device driver User mode (0-3G) (Kernel mode) 3G-4G.
Outlines  Introduction  Kernel Structure  Porting.
Chapter 2: Operating System Concepts 1. Objectives To know essential topics on the design of (embedded) operating systems 2 1.Task & resources 2.Kernel.
Processes and threads.
Process concept.
OPERATING SYSTEMS CS3502 Fall 2017
Scheduler activations
Chapter 3 – Process Concepts
Intro to Processes CSSE 332 Operating Systems
IS310 Hardware & Network Infrastructure Ronny L
Processor Fundamentals
Threads Chapter 4.
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Presentation transcript:

SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 2 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department of Computer Science National Tsing Hua University

SOC Consortium Course Material Real-time OS SoC Design Laboratory 1 Outline  Introduction to μC/OS-II – uC/OS-II Kernel – Context switch – Resource management using Semaphore – Memory management – Interrupt

SOC Consortium Course Material Real-time OS SoC Design Laboratory 2 uC/OS-II Kernel  Basic jobs of uC/OS-II kernel Task management Interrupt handling Inter-process communication

SOC Consortium Course Material Real-time OS SoC Design Laboratory 3 Kernel API  Service routines provided by uC/OS-II Kernel Task management APIs Time management APIs Memory management APIs Inter-process communication APIs Synchronization APIs  To make a System Call means to call Kernel API

SOC Consortium Course Material Real-time OS SoC Design Laboratory 4 Context Switching  Context Switching The process of swap in/out the context of tasks when scheduler choose a new task to run.  Context Usually means values in registers used by the task.  Switching Steps 1.Save registers of current task to stack (curr) 2.Load new task’s SP into CPU 3.Restore registers of new task from stack (new) 4.Resume execution of new task

SOC Consortium Course Material Real-time OS SoC Design Laboratory 5 Context Switching Time ISR Low-priority Task High-priority Task ISR makes the high-priority task ready Context Switching Context Switching high-priority task Relinquishes the CPU

SOC Consortium Course Material Real-time OS SoC Design Laboratory 6 Critical Region Code need to be treated indivisibly  Code have to be executed without interrupt creating task…etc  Non-reentrant code accessing shared variable…etc

SOC Consortium Course Material Real-time OS SoC Design Laboratory 7 Critical Region  Protecting critical region OS_ENTER_CRITICAL( ) temporarily disable interrupt OS_EXIT_CRITICAL( ) re-enable interrupt

SOC Consortium Course Material Real-time OS SoC Design Laboratory 8 Events  A way for Synchronization and Communication Pend(Wait for an event) Post(Signal an event)  Events in uC/OS-II Semaphore Counting Semaphore Message Mailbox Message Queues

SOC Consortium Course Material Real-time OS SoC Design Laboratory 9 Semaphore  Semaphore serves as a key to the resource  A flag represent the status of the resource  Prevent re-entering Critical Region  Can extend to counting Semaphore Task 1 Task 2 RS-232 Send data via RS232 Semaphore Request/Release

SOC Consortium Course Material Real-time OS SoC Design Laboratory 10 Semaphore Using Semaphore in uC/OS-II  OSSemCreate()  OSSemPend()  OSSemPost()  OSSemQuery()  OSSemAccept()

SOC Consortium Course Material Real-time OS SoC Design Laboratory 11 Message Mailbox  Used for Inter-Process Communication (IPC)  A pointer in MailBox points to the transmitted message Task ISR Task “message” Mail Box Post Pend

SOC Consortium Course Material Real-time OS SoC Design Laboratory 12 Message Queues  Array of MailBox  FIFO & FILO configuration Task ISR Task “message” Mail Queues Post Pend

SOC Consortium Course Material Real-time OS SoC Design Laboratory 13 MailBox & Queues Using MailBox in uC/OS-II  OSMboxCreate()  OSMboxPend()  OSMboxPost()  OSMboxQuery()  OSMboxAccept() Using Queue in uC/OS-II  OSQCreate()  OSQPend()  OSQPost()  OSQPostFront()  OSQQuery()  OSQAccept()  OSQFlush()

SOC Consortium Course Material Real-time OS SoC Design Laboratory 14 Memory Management  Semi-dynamic memory allocation  Allocate statically and dispatch dynamically  Explore memory requirements at design time Task 1 Task 2 Task 3 allocate statically partition into memory blocks dispatch dynamically OS InitializingOS running

SOC Consortium Course Material Real-time OS SoC Design Laboratory 15 Memory Management Using Memory in uC/OS-II  OSMemCreate()  OSMemGet()  OSMemPut()  OSMemQuery()

SOC Consortium Course Material Real-time OS SoC Design Laboratory 16 Interrupt  Interrupt Controller A device that accepts up to 22 interrupt sources from other pheripherals and signals ARM processor  Interrupt Handler A routine executed whenever an interrupt occurs. It determines the interrupt source and calls corresponding ISR. Usually provided by OS.  Interrupt Service Routine (ISR) Service routines specific to each interrupt source. This is usually provided by hardware manufacturer.

SOC Consortium Course Material Real-time OS SoC Design Laboratory 17 Interrupt  Peripheral sends interrupt request to interrupt controller  Interrupt controller sends masked request to ARM  ARM executes interrupt handler to determine int. source Peripheral B Interrupt Controller Interrupt Controller Peripheral A ARM Processor ARM Processor bus

SOC Consortium Course Material Real-time OS SoC Design Laboratory 18 Interrupt  Default interrupt handler: uHALr_TrapIRQ() 1.Save all registers in APCS-compliant manner 2.Call StartIRQ(), if defined 3.Determine interrupt source, call the corresponding interrupt service routine (ISR) 4.Call FinishIRQ(), if defined 5.Return from interrupt

SOC Consortium Course Material Real-time OS SoC Design Laboratory 19 Interrupt  When an interrupt occurs, no further interrupt accepted  To achieve real-time, the period of interrupt disabled should be as short as possible  Do only necessary jobs in ISR, leave other jobs in a deferred Task

SOC Consortium Course Material Real-time OS SoC Design Laboratory 20 Lab 7:Real-time OS - 2  Goal – A guide to use RTOS and port programs to it  Principles – Basic concepts and capabilities of RTOS Context switch Resource management using Semaphore Memory management – Coding guideline for a program running on the embedded RTOS  Guidance  Steps – Context switch example – Using Inter-Process Communication (IPC)  Requirements and Exercises – Write an embedded software for ID checking engine and a front-end interface  Discussion – Explain and describe executing process of eg2 (context switch example)

SOC Consortium Course Material Real-time OS SoC Design Laboratory 21 References [1] AFS_Reference_Guide.pdf