Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.



Similar documents
Operating System: Scheduling

Chapter 2: OS Overview

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

Operating Systems Lecture #6: Process Management

Operating Systems, 6 th ed. Test Bank Chapter 7

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

ELEC 377. Operating Systems. Week 1 Class 3

Operating Systems 4 th Class

Operating System Tutorial

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

OPERATING SYSTEM - MEMORY MANAGEMENT

ICS Principles of Operating Systems

Memory management basics (1) Requirements (1) Objectives. Operating Systems Part of E1.9 - Principles of Computers and Software Engineering

OPERATING SYSTEMS SCHEDULING

Chapter 6, The Operating System Machine Level

How To Understand The History Of An Operating System

OPERATING SYSTEM SERVICES

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

2. is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput

Types Of Operating Systems

CPU Scheduling. CPU Scheduling

Multi-core Programming System Overview

Introduction. What is an Operating System?

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging

Chapter 3 Operating-System Structures

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

CHAPTER 15: Operating Systems: An Overview

Chapter 5: CPU Scheduling. Operating System Concepts 8 th Edition

CS420: Operating Systems OS Services & System Calls

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Real Time Programming: Concepts

Operating System Structures

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Chapter 7 Memory Management

This tutorial will take you through step by step approach while learning Operating System concepts.

Process Scheduling CS 241. February 24, Copyright University of Illinois CS 241 Staff

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances:

Chapter 11 I/O Management and Disk Scheduling

Cloud Computing. Up until now

Operating System Organization. Purpose of an OS

CPU Scheduling Outline

Undergraduate Course Syllabus

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d

Processor Scheduling. Queues Recall OS maintains various queues

Overview and History of Operating Systems

Chapter 5 Process Scheduling

Origins of Operating Systems OS/360. Martin Grund HPI

Operating Systems. III. Scheduling.

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

CS414 SP 2007 Assignment 1

Chapter 3. Operating Systems

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Chapter 2 System Structures

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

CS5460: Operating Systems

CPU Scheduling. Core Definitions

CS3600 SYSTEMS AND NETWORKS

Memory unit sees only the addresses, and not how they are generated (instruction counter, indexing, direct)

The Deadlock Problem. Deadlocks. Deadlocks. Bridge Crossing Example

File System & Device Drive. Overview of Mass Storage Structure. Moving head Disk Mechanism. HDD Pictures 11/13/2014. CS341: Operating System

Operating System Overview. Otto J. Anshus

Devices and Device Controllers

Full and Para Virtualization

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

Announcements. Basic Concepts. Histogram of Typical CPU- Burst Times. Dispatcher. CPU Scheduler. Burst Cycle. Reading

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

Analysis and Comparison of CPU Scheduling Algorithms

Virtual Machines.

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

Gildart Haase School of Computer Sciences and Engineering

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Chapter 1 Computer System Overview

Linux Process Scheduling Policy

Buffer Management 5. Buffer Management

System Structures. Services Interface Structure

Computer-System Architecture

OPERATING SYSTEM - VIRTUAL MEMORY

Operating Systems. Virtual Memory

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management

Example of Standard API

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

find model parameters, to validate models, and to develop inputs for models. c 1994 Raj Jain 7.1

Operating System Components and Services

Real-Time Scheduling 1 / 39

Virtualization. Pradipta De

Virtual Machines. Virtualization

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

System Virtual Machines

Far-western University Central Office, Mahendranagar Operating System

Threads Scheduling on Linux Operating Systems

Terminal Server Software and Hardware Requirements. Terminal Server. Software and Hardware Requirements. Datacolor Match Pigment Datacolor Tools

Have both hardware and software. Want to hide the details from the programmer (user).

Virtualization. Types of Interfaces

Transcription:

Overview Concepts of Mobile Operating Systems Lecture 11 Concepts of Mobile Operating Systems Mobile Business I (WS 2007/08) Prof Dr Kai Rannenberg Chair of Mobile Business and Multilateral Security Johann Wolfgang Goethe-University Frankfurt a M Functions Processes States t and elements Scheduling Inter-Process-Communication (IPC) Memory Management Mapping Paging Segmentation Examples Virtual Machines Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 1 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 2 Mobile Operating Systems Technical Properties What is an operating system (OS)? An OS is a program that serves as a mediator between the user and the hardware It enables the users to execute programs Other properties: p Multi-user, multi-thread, high availability, real-time, Primary goal of an OS: Easy usage of the actual hardware Secondary goal of an OS: Efficient i usage of the hardware Operating System (OS) features: Memory protection, file protection, access controls Security module support, secure input and output, protection of applications and the system s integrity Resource sharing: o Memory (RAM, storage) o Central Processing Unit (CPU) o Input / Output t devices (I/O) Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 3 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 4

Functions of the Operating System Operating System Controlling of the resources: Computation time, real-time processing: Who is computing how much? How long does it take? Memory (RAM, Disk): Who gets which part of the memory? Security functions: Protection of the data (memory, hard disk): Who is allowed to access resources? Process protection (computation time, code, isolation): Who is allowed to compute? Communication: Allocation of I/O-Resources Processing of the communication User interface (UI) Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 5 User 1 User 2 User 3 User n Compiler Assembler Text Editor Database System System and Application Programs Operating system Computer Hardware Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 6 Overview Concepts of Mobile Operating Systems Functions Processes States t and elements Scheduling Inter-Process-Communication (IPC) Memory Management Mapping Paging Segmentation Examples Virtual Machines Questions Several programs (processes) can run simultaneously & concurrently on an OS: How are processes managed in a system with regard to processing time, memory, etc? Which process is allowed to access resources when? How are resources (I/O) (/ shared among processes? How do processes exchange data among each other? Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 7 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 8

Process A process is a program in operation A process uses resources, such as CPU time, memory, files, and I/O devices The resources of a process are allocated while it is created or when it is running The operating system has to manage the process (creation, resource distribution, etc) More than simple code! Components of a Process Program counter: Indicates on which point in the code the process resides Contents of the process registers: Stack: Contains temporary data, such as subroutine parameters or return addresses, etc Data section: Contains the global variables Heap: Dynamically allocated memory Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 9 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 10 States of a Process States of a Process new admitted I/O or event completion ready interrupt scheduler dispatch exit running I/O or event wait terminated New: Process is created Ready: Process is waiting for being executed Running: Process is running Waiting: Process is waiting for results: Completion of an I/O-operation An event Terminated: Process is terminated waiting Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 11 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 12

Abstracted View on a Process: Process Control Block (PCB) Abstracted View on a Process: Process Control Block (PCB) Abstracted representation of the contents of a process control block (PCB), needed by an operating system process pointer state process number program counter registers memory limits list of open files Process State: new, ready, running, waiting, Program Counter: Address of the next command to be executed CPU Registers: Accumulator, Index Register, Stack Pointer and general registers Information for: CPU-Scheduling Memory-Management Accounting I/O Status Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 13 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 14 Scheduling Scheduling in Queues Multiprogramming: Several processes are being run in parallel for: ready queue CPU Maximisation of the CPU usage Enabling users to operate several programs simultaneously Enabling several users to work on the same machine simultaneously On a CPU only one process is running at a time The process switching must be fast, to enable the user to interact with all running programs Queues are used to handle this task I/O I/O queue child executes interrupt is being handled I/O request time slice expired fork a child interrupt based on Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 15 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 16

Scheduling Algorithms Scheduling Criteria If the CPU is idle (no process is running), the scheduler invokes a process from the ready-queue to be run on the CPU There are different methods (algorithms) to make the choice, which process to invoke Methods are optimised towards different criteria CPU utilisation: The goal is to maximise the CPU usage Throughput: Number of finished processes per time unit Turnaround-time: Time interval between the beginning and the end of a process Latency time: Sum of all the waiting time of all processes in the queue Response time: Time span of a process to answer a user's request and to generate the answer Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 17 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 18 First Come, First Serve (FCFS) Shortest Job First Processes are executed by the CPU one after another in order of their occurrence FIFO-principles (First In First Out) Pros/Cons: The throughput is not optimal Average response time is very high No optimal utilisation of the CPU (Convoy- Effect) Not appropriate for Time-Sharing-Systems Systems The processes are executed in order of their execution time Processes that can be finished fast are executed first Pros/Cons: Optimal with regard to the average latency time Not fair Complex processes can starve to death Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 19 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 20

Priority Scheduling Processes get an assigned priority number Process execution in the order of the assigned priority Deadlocks or starvation of processes with low priority numbers is possible Aging: i Gradually raising i the priority i of a process Round Robin Scheduling Especially used for Time-Sharing-Systems Systems and one of the simplest scheduling algorithms Similar to FCFS, assigning time slices of a time interval to a process being held in the scheduling queue After the time slice of a process is expired, the CPU is revoked from the process and the process is placed at the end of the scheduling queue The efficiency of this method depends on the size of a time interval Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 21 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 22 Inter-Process-Communication Processes are able to interact with each other (data exchange) Several methods are possible Direct or indirect Symmetric or asymmetric Automatic ti or by explicit it buffering Handover as copy or reference Fixed or variable size of communication packet Overview Concepts of Mobile Operating Systems Functions Processes States t and elements Scheduling Inter-Process-Communication (IPC) Memory Management Mapping Paging Segmentation Examples Virtual Machines Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 23 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 24

Memory Management Mapping Logical vs Physical Addresses The CPU retrieves instructions from the memory depending on the program counter Thereby it might be necessary to read or write data from certain memory-addresses addresses The operating system has an address space where the data and the programs reside The whereabouts of a process in the memory can be unknown by the time of the actual programming Usage of symbolic addresses during programming g that get mapped to physical addresses later on (Mapping) Binding: The conversion of symbolic addresses to logical addresses in the memory of an operating system Logical Addresses: Generated by the CPU Physical Addresses: Sent to the memory unit Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 25 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 26 Mapping Memory Management Unit Mapping Relocation Register The mapping is done by a so called MMU (Memory Management Unit) Usage of a relocation register that contains the base address for a process The base address is added to the logical address, resulting in the physical address CPU logical address 346 relocation register 14000 + physical address 14346 memory MMU Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 27 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 28

Mapping Limit Register Mapping Limit Register The memory of a system also contains the actual operating system The access of other processes onto the code of the operating systems needs to be prevented Furthermore, the processes need to be protected against each other CPU logical address limit register < no yes relocation register + physical address memory Solution: Usage of so called Limit Registers trap: addressing error Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 29 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 30 Paging Overview The memory contains several processes of varying size When a process is loaded or removed from the memory, the free memory will be fragmented One solution is the so called paging, putting the process into several separate memory chunks of a defined size, instead of putting it into the memory in one single piece Paging Overview The physical memory is divided into blocks of a defined size, the so called frames The logical memory gets divided into blocks of the same size, the so called (memory) pages Every address created by a CPU is divided into a page number [p] and an offset [d] The page number is used as the index for the page table, containing the base address for all (memory) pages The base address is combined with the offset resulting in the physical address Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 31 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 32

Paging Schematics Segmentation Overview CPU logical address physical address p d f d p Search f Base Address (p) physical memory The memory is partitioned into segments of variable length Every segment has a name and a defined d length A segment table is used to store the base address and the limit of the segments The logical address consists of a segment number [s] and the offset [d] page table Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 33 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 34 Segmentation Schematics Windows XP Memory Map s FFFF FFFF CPU s d limit base yes < + no memory 8000 0000 System Reserved (kernel mode space) Ati Active Active Process Process Active Active Process Process Active Process Application Space Trap: addressing error 0000 0000 Active Process [Hall2002] Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 35 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 36

Windows CE Memory Map Windows CE Memory Map FFFF FFFF FFFF FFFF 8000 0000 4200 0000 0200 0000 0000 0000 System Reserved (kernel mode space) Large Memory Area (memory mapped files) Reserved Active Active Process Process Active Active Process Process Application Active Active Process Process Space [Hall2002] Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 37 8000 0000 4200 0000 4000 0000 3E00 0000 0800 0000 0600 0000 0400 0000 0200 0000 0000 0000 System Reserved (kernel mode space) Large Memory Area (memory mapped files) Slot 32 Slot 31 Process 32 Process 31 Slot 3 Process 3 Slot Active 2 Process 2 Active Slot 1 Process Active Active Process Process 1 Application Active Active Process Process Slot 0 Space Act Process Detailed View [Hall2002] Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 38 System Memory Map Application Memory Map (Slot 0) Memory (RAM) is divided into 33 slots One process per slot Slot 1 to slot 32 A process only has access to his own slot o and to slot 0, when it is active Active process is placed into slot 0 Remaining memory is shared 01FF FFFF Solid lines are on 64K boundaries Dashed lines are on page boundaries COREDLLDLL Other DLLs Free virtual space Stack (reserved space) Heap (reserved space) Resources Read write data Read only data Code EXE Image (demand paged) Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 39 0001 0000 0000 0000 reserved [Hall2002] Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 40

Virtual Memory Maximum of 32 MB for virtual memory Virtual memory is used for the code and the data Memory is: Allocated on the basis of pages Reserved din blocks of f64 KB Dynamic Link Libraries (DLL) Software library, containing a collection of functions and sub-programs that can be used by other independent programs This methodology offers the following advantages: Reutilisation of existing code Distribution of the development process Etc Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 41 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 42 DLL Load Positioning DLL Load Positioning 01FF FFFF COREDLLDLL Other DLLs DLL A DLL B COREDLLDLL Other DLLs DLL A DLL D COREDLLDLL Other DLLs DLL A DLL C DLL C Stack Stack Stack Heap Heap Heap Code Code Code Any DLL being loaded by any process allocates memory of other processes, regardless if the DLL is used by other processes or not The address, the DLL is loaded to, is dependent on the other DLLs being loaded by other processes All DLLs are loaded/stored into memory blocks of 64K The more DLLs are loaded, the bigger is the problem 0001 0000 0000 0000 reserved reserved reserved [Hall02] Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 43 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 44

Solution in Windows CE NET Windows CE NET solves the DLL load problem by modifying the memory map The kernel (NKEXE) is relocated from slot 1 into the kernel space starting from address 0xC200 0000 Slot 1 is used for the DLLs: Is connected with all applications for slot 0 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 45 NK moved FFFF FFFF C200 0000 8000 0000 4200 0000 4000 0000 3E00 0000 0800 0000 0600 0000 0400 0000 0200 0000 0000 0000 NK Slot Kernel Space Large Memory Area (memory mapped files) Slot 32 Process 31 Slot 31 Process 30 31 Slot 3 Slot 2 Slot 1 Slot 0 Windows CE NET Memory Map Process 2 Process 1 DLLs Act Process [Hall2002] Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 46 Windows CE NET Application Memory Map Application Memory Map 03FF FFFF COREDLLDLL Other XIP DLLs Windows CE NET Application Memory Map 01FF FFFF XIP DLL space RAM based DLLs Free virtual space DLL Space (Constant t for all applications) Application memory is now extended to 64 MB DLLs are loaded into the upper 32 MB Executable (EXE) code, heaps and stacks are using the lower 32 MB There is no possibility for loaded applications to allocate memory above 32 MB Stack (reserved space) Heap (reserved space) Resources Read write data Read only data Application Slot (Cloned into slot 0) 0001 0000 0000 0000 reserved Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 47 Code [Hall2002] Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 48

Overview Concepts of Mobile Operating Systems Functions Processes States t and elements Scheduling Inter-Process-Communication (IPC) Memory Management Mapping Paging Segmentation Examples Virtual Machines Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 49 Virtual Machines Intermediate layer between an operating system and a software application The system creates the impression that every process has its own machine, having a separate CPU and its own memory Protection of the resources (sandboxing) Complete isolation between the different virtual machines running on the host system Examples: Java Virtual Machine VMWare Virtual PC 2004 IBM z/vm Emulators (eg ScummVM or PocketPC Emulator exercise course) Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 50 Virtual Machines Bibliography [Burkhardt2001] Burckhardt J et al: Pervasive Computing, München, 2001 processes kernel hardware programming interface processes processes processes kernel kernel virtual machine hardware kernel [Hall2002] Hall, Mike: Windows CE NET Advanced Memory Management Microsoft Embedded Crash Course for Faculty and PhD s, 2002 [Microsoft2006] http://researchmicrosoftcom/collaboration/university/europe/events/ dotnetcc/version3/dvd/, t accessed 2006-10-20 Silberschatz; Galvin: Operating System Concepts, 5th Edition, John Wiley & Sons, Inc, 1999 [Stallings2003] Stallings, W: Betriebssysteme Prinzipien und Umsetzung, 4th Edition, Pearson Studium, München, 2003 [Zobel2001] Zobel, J: Mobile Business und M-Commerce, München, 2001 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 51 Mobile Business 1 (MB 1), WS 2007/2008, Professur für Mobile Business & Multilateral Security 52