Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.

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

Threads, SMP, and Microkernels
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
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.
Chapter 3 Process Description and Control
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.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
Operating System Support Focus on Architecture
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
INTRODUCTION OS/2 was initially designed to extend the capabilities of DOS by IBM and Microsoft Corporations. To create a single industry-standard operating.
Introduction to Kernel
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
OS Spring’03 Introduction Operating Systems Spring 2003.
Figure 1.1 Interaction between applications and the operating system.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
1Lecture 5 Lecture 5: Linux for Hardware Developers ECE 412: Microcomputer Laboratory.
Operating Systems Lab. (#2) University of Tehran – ECE Dept. Fall 2005 Reza Shokri
Chapter 3 Operating Systems Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
Chapter 1. Introduction What is an Operating System? Mainframe Systems
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
Chapter 3 Process Description and Control
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.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Background: Operating Systems Brad Karp UCL Computer Science CS GZ03 / M th November, 2008.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
Mid Term review CSC345.
What Every Developer Should Know about the Kernel Dr. Michael L. Collard 1.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
UNIX Unit 1- Architecture of Unix - By Pratima.
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.
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Chapter 3 Operating Systems. © 2005 Pearson Addison-Wesley. All rights reserved 3-2 Chapter 3 Operating Systems 3.1 The Evolution of Operating Systems.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
OSes: 2. Structs 1 Operating Systems v Objective –to give a (selective) overview of computer system architectures Certificate Program in Software Development.
What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator –Control program.
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.
What is a Process ? A program in execution.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
Concepts and Structures. Main difficulties with OS design synchronization ensure a program waiting for an I/O device receives the signal mutual exclusion.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
S ALVATORE DI G IROLAMO (TA) Networks and Operating Systems: Exercise Session 1.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
CSCE451/851 Introduction to Operating Systems
Introduction to Operating Systems Concepts
Input/Output (I/O) Important OS function – control I/O
Introduction to Kernel
Process Management Process Concept Why only the global variables?
Protection of System Resources
Intro to Processes CSSE 332 Operating Systems
Structure of Processes
Chapter 3: Windows7 Part 2.
Chapter 3: Windows7 Part 2.
Mid Term review CSC345.
Lecture Topics: 11/1 General Operating System Concepts Processes
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
CS510 Operating System Foundations
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Presentation transcript:

Embedded Real-time Systems The Linux kernel

The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services Controls and mediates access to hardware Implements and supports fundamental abstractions: –Process, file (file system, devices, interprocess communication) Schedules / allocates system resources: –CPU, memory, disk, devices, etc. Enforces security and protection Event driven: –Responds to user requests for service (system calls) –Attends interrupts and exceptions –Context switch at quantum time expiration

What is required? Applications need an execution environment: –Portability, standard interfaces –File and device controlled access –Preemptive multitasking –Virtual memory (protected memory, paging) –Shared libraries –Shared copy-on-write executables –TCP/IP networking –SMP support Hardware developers need to integrate new devices –Standard framework to write device drivers –Layered architecture dependent and independent code –Extensibility, dynamic kernel modules

Linux Execution Environment Program Libraries Kernel subsyste ms

Linux Execution Environment Execution paths

Linux source code

Linux source code layout Linux/arch –Architecture dependent code. –Highly-optimized common utility routines such as memcpy Linux/drivers –Largest amount of code –Device, bus, platform and general directories –Character and block devices, network, video –Buses – pci, agp, usb, pcmcia, scsi, etc Linux/fs –Virtual file system (VFS) framework. –Actual file systems: Disk format: ext2, ext3, fat, RAID, journaling, etc But also in-memory file systems: RAM, Flash, ROM

Linux source code layout Linux/include –Architecture-dependent include subdirectories. –Need to be included to compile your driver code: gcc … -I/ /include … –Kernel-only portions are guarded by #ifdefs #ifdef __KERNEL__ /* kernel stuff */ #endif –Specific directories: asm, math-emu, net, pcmcia, scsi, video.

Process and System Calls Process: program in execution. Unique “pid”. Hierarchy. User address space vs. kernel address space Application requests OS services through TRAP mechanism –x86: syscall number in eax register, exception (int $0x80) –result = read (file descriptor, user buffer, amount in bytes) –Read returns real amount of bytes transferred or error code (<0) Kernel has access to kernel address space (code, data, and device ports and memory), and to user address space, but only to the process that is currently running “Current” process descriptor. “current  pid” points to current pid Two stacks per process: user stack and kernel stack Special instructions to copy parameters / results between user and kernel space

Scheduling processes Process scheduling is done at the following events: –1. the running process switches to the waiting state, –2. the running process switches to the ready state, –3. a waiting process switches to the ready state (the woke up process may have higher priority than the previously running process), or –4. a process terminates. If scheduling occurs only at 1 and 4, we have non-preemptive scheduli

Preemptive vs non-preemptive scheduling With preemptive scheduling, another process can be scheduled at any time. A process which is updating shared data must ensure that no other process also starts using the data (by using a lock for instance). The first UNIX kernels were non-preemptive which simplified their design, but user processes where scheduled preemptively. With multiprocessors, UNIX kernels were rewritten with preemptive kernel Process scheduling

Scheduling criteria 1 CPU utilisation: how busy the CPU is with user processes, Throughput: number of processes completed per time unit, Turnaround time: how long time it takes for one process to execute, Waiting time: how long time a process sits in the ready queue, and Response time: how long time it takes before a user gets some response (must be very small — otherwise too annoying). These goals are contradictory, unfortunately

Scheduling criteria 2 A short response time requires frequent re- scheduling. Context-switching time can be several percent and compute-intensive jobs are best run to completion with as little scheduling as possible. For instance, running two long compute- intensive simulations after each other is better on UNIX than running the concurrently (despite losing positive effects of multiprogramming). In addition to context-switching time, frequent rescheduling increases the number of cache misses.