Friday 28 December, 2012

Mobile Operating Systems

Overview
  • Introduction
  • Mobile Operating System Structure
  • Mobile Operating System Platforms
  • Java ME Platform
  • Palm OS
  • Symbian OS
  • Linux OS
  • Windows Mobile OS
  • BlackBerry OS
  • iPhone OS
  • Google Android Platform

OS Features
  • Multitasking
  • Scheduling
  • Memory Allocation
  • File System Interface
  • Keypad Interface
  • I/O Interface
  • Protection and Security
  • Multimedia features

Introduction
  •  Design and capabilities of a Mobile OS (Operating System) is very different than a general purpose OS running on desktop machines:
  1. mobile devices have constraints and restrictions on their physical characteristic such as screen size, memory, processing power and etc.
  2. Scarce availability of battery power
  3. Limited amount of computing and communication capabilities

  • Thus, they need different types of operating systems depending on the capabilities they support. e.g. a PDA OS is different from a Smartphone OS.
  • Operating System is a piece of software responsible for management of operations, control,  coordinate the use of the hardware among the various application programs, and sharing the resources of a device.

Operating System Structure
  • A mobile OS is a software platform on top of which other programs called application programs, can run on mobile devices such as PDA, cellular phones, smartphone and etc.




Mobile Operating System Platforms
  • There are many mobile operating systems. The followings demonstrate the most important ones:
    •  Java ME Platform
    •  Palm OS
    •  Symbian OS
    •  Linux OS
    •  Windows Mobile OS
    •  BlackBerry OS
    •  iPhone OS
    •  Google Android Platform

Java ME Platform

  • J2ME platform is a set of technologies, specifications and libraries developed for small devices like mobile phones, pagers, and personal organizers.
  • Java ME was designed by Sun Microsystems. It is licensed under GNU General Public License
  • Java ME platforms are composed of the following elements:



Java ME Main Components
  • Configuration: it defines a minimum platform including the java language, virtual machine features and minimum class libraries for a grouping of devices. E.g. CLDC
  • Profile: it supports higher-level services common to a more specific class of devices. A profile builds on a configuration but adds more specific APIs to make a complete environment for building applications. E.g. MIDP

Java ME
  • Optional Package: it provides specialized service or functionality that may not be associated with a specific configuration or profile. The following table lists some of the available packages:


Java ME Platforms
  • It includes two kinds of platforms:
  1. High-end platform for high-end consumer devices. E.g. TV set-top boxes,  Internet TVs, auto-mobile navigation systems
  2. Low-end platform for low-end consumer devices. E.g. cell phones, and pagers
  • The following figures demonstrate the elements of these two types of platforms:


Java ME CLDC
  • We focus on “Low-end” consumer devices: 
    • CLDC  configuration address the following areas:
      1. Java language and virtual machine features
      2. Core Java libraries
      3. CLDC Specific Libraries (Input/output & Networking) 
      4. Internationalization: There is a limited support for converting Unicode characters to and from a sequence of bytes.
      5. Security: CLDC addresses the following topics to security
        1. At the low-level the virtual machine security is achieved by requiring downloaded Java classes to pass a class file verification step.
        2. Applications are protected from each other by being run in a closed “sandbox” environment. 
        3.  Classes in protected system packages cannot be overridden by applications.
  • The entire CLDC implementation (static size of the K virtual machine + class libraries) should fit in less than 128 kilobytes.
  • It guarantee portability and interoperability of profile-level code between the various kinds of mobile (CLDC) devices

Palm OS

  • Palm OS  is an embedded operating system designed for ease of use  with a touchscreen-based graphical user interface.
  • It has been implemented on a wide variety of mobile devices such as smart phones, barcode readers, and GPS devices.
  • It is run on Arm architecture-based processors. It is designed as a 32-bit architecture.

Palm OS Features
  • The key features of Palm OS  are:
       - A single-tasking OS: 
    1. Palm OS Garnet (5.x) uses a kernel developed at Palm, but it does not expose tasks or threads to user applications. In fact, it is built with a set of threads that can not be changed at run-time.
    2. Palm OS Cobalt (6.0 or higher) does support multiple threads but does not support creating additional processes by user applications.
    3. Palm OS has a preemptive  multitasking kernel that provides basic tasks  but it does not expose this feature to user applications .
      - Memory Management:
The Memory, RAM and ROM, for each Palm resides on a memory module known as card. In other words, each memory card contains RAM, ROM or both. Palms can have no card, one card or multiple cards.

        - Expansion  support :
This capability not only augments the memory and I/O , but also  it facilitates data interchanges with other Palm devices and with other non-Palm devices such as digital cameras, and digital audio players.

  1. Handwriting recognition input called Graffiti 2
  2. HotSync technology for synchronization with PC computers
  3. Sound playback and record capabilities 
  4. TCP/IP network access
  5. Support of serial port, USB, Infrared, Bluetooth and Wi-Fi connections 
  6. Defined standard data format for PIM (Personal Information           Management) applications to store calendar, address, task and note entries, accessible by third-party applications

Security model: 
  1. Device can be locked by password, arbitrary application records can be made private 
  2. Palm OS Cobalt include a certificate manager. The certificate Manager handles X.509 certificates.

Symbian OS
  • Symbian OS is 32 bit, little-endian operating system, running on different flavors of ARM architecture[4].
  • It is a multitasking operating system and very less dependence on peripherals.
  • Kernel runs in the privileged mode and exports its service to user applications via user libraries.

Symbian OS Structure

  • User libraries include networking, communication, I/O interfaces and etc.
  • Access to these services and resources is coordinated through a client-server framework.
  • Clients use the service APIs exposed by the server to communicate with the server.
  • The client-server communication is conducted by the kernel.
  • The following demonstrates the Symbian OS architecture:



Symbian OS Features

  • Real-time: it has a real-time, multithreaded kernel.
  • Data Caging [6]: it allows applications to have their own private data partition. This feature allows for applications to guarantee a secure data store. It can be used for e-commerce applications, location aware applications and etc.
  • Multimedia: it supports audio, video recording,  playback and streaming, and Image conversion.
  • Platform Security [6]:  Symbian provides a security mechanism against malware. It allows sensitive operations can be accessed by applications which have been certified by a signing authority. In addition, it supports full encryption and certificate management, secure protocols ( HTTPS, TLS and SSL) and WIM framework
  • Internationalization support: it supports Unicode standard.
  • Fully object-oriented and component- based
  • Optimized memory management
  • Client- server architecture [6]: described in previous slides, it provides simple and high-efficient inter-process communication. This feature also eases porting of code written for other platforms to Symbian OS.
  • A Hardware Abstraction Layer (HAL): This layer provides a consistent interface to hardware and supports device-independency
  • Kernel offers hard real-time guarantees to kernel and user mode threads.

Embedded Linux OS

  • It is known as Embedded Linux which is used in embedded computer systems such as mobile phones, Personal Digital Assistants, media players and other consumer devices.
  • In spite of Linux operating system designed for Servers and desktops, the Embedded Linux is designed for devices which have relatively limited resources such as  small size of RAM, storage, screen, limited power and etc. Then, they should have an optimized kernel.
  • It is a Real-Time Operating System (RTOS). It meets deadlines and switch context
  • It has relatively a small footprint. Today, mobile phones can ship with a small memory. Thus, OS must not seek to occupy a large amount of available storage. It should have a small foot print. Theoretically, they deploy in a footprint of 1MB or less.
  • It is open source. It has no cost for licensing.
  • Examples: Motorola Mobile phones such as RAZR V8, RAZR V9, A1200 are based on MontaVista Linux.
  • ARM and MIPS structures : Embedded CPU architectures like ARM and MIPS  offer small  instruction sets and special execution modes that shrinks application size and consequently generates smaller code.

Windows Mobile OS
  • Windows Mobile is a compact operating system designed for mobile devices and based on Microsoft Win32.
  • It is run on Pocket PCs, Smartphones and Portable media centers.
  • It provides ultimate interoperability. Users with various requirements are able to manipulate their data.

Google Android Platform
  • It is a platform and an operating system for mobile devices based on the Linux operating system.
  • It allows developers design applications in a java-like language using Google-developed java libraries.
  • It supports a wide variety of connectivity such as GSM, WiFi, 3G, …
  • The Operating system has not been implemented yet (Feb, 2008). Several prototypes have been proposed. 

Android architecture:


  • As demonstrated in the previous slide, the Android platform contains the following layers:
Linux Kernel: Android relies on Linux for core system          services such as security, memory management, process          management and etc.

Android  Runtime: it provides a set of core libraries which         supports most of the functionality in the core libraries of Java.         The Android Virtual Machine known as Dalvik VM relies on         the linux kernel for some underlying functionality such as         threading,…

Libraries:  Android includes a set of C/C++ libraries. These          libraries are exposed to developers through the Android          application framework. They include media libraries, system          C libraries, surface manager, 3D libraries, SQLite and etc.  For more details, please  visit the following link:          http://code.google.com/android/what-is-android.html

Application Framework: it provides an access layer to the         framework APIs  used by the core applications. It allows         components to be used by the developers.


iPhone OS
  • iPhone OS is an operating system run on iPhone and iPod.
  • It is based on Mach Kernel and Drawin core as Mac OS X.
  • The Mac OS X kernel includes the following component:
    • Mach Kernel
    • BSD
    • I/O component
    • File Systems
    • Networking components
  • The following is Mac OS X Architecture 

  • Mac OS X has a preemptive multitasking environment. 
  • Preempting is the act of taking the control of operating system from one task and giving it to another task.
  • It supports real-time behavior.
  • In Mac OS X, each application has access to its own 4 GB address space.
  • Not any application can directly modify the memory of the kernel. It has a strong mechanism for memory protection.
  • For more  details about kernel architecture, please visit the following link: http://developer.apple.com/documentation/Darwin/Conceptual/KernelProgramming/Architecture/Architecture.html

BlackBerry OS
  • BlackBerry OS has a multitasking environment.
  • It enables heavy use of input devices like trackball, and scroll wheel. It does not support touchpad.
  • It is an event-driven Operating System.
  • Later BlackBerry Smartphone's CPU architecture is based on ARM XScale. The other BlackBerry devices has Intel-based processors.
  • It supports multitasking and multithreading applications.
  • Security:  Any application that want to use certain BlackBerry functionality must be digitally signed.

Multitasking Feature
  • BlackBerry OS employs co-operative multitasking so no application can preempt another application in mid-stream, unless that application explicitly yields control.
  • All applications run simultaneously and are managed by an application server.
  • Each application at startup, receives an execution thread.  They may also create and destroy additional thread dynamically.
  • At no time preemption can occur between applications. Such a design removes the need for mutual exclusion mechanisms and semaphores.
  • However, the task will take several seconds
  • Threads can be run in the background waiting for messages or data for processing, or they can be run in foreground having control of user interfaces, display, and input like keystrokes .
  • The foreground tasks include displaying context such as display bitmap, show on the LCD,  and receiving all keypad and trackwheel inputs.
  • Each task that is not in the foreground, still maintains a copy of the LCD display bitmap in its display context. So, it can manipulate it at  any time.
  • When the foreground thread is changed to a different thread or task, the new task’s display bitmap is placed on the LCD and now, it receives all inputs.

    Threads
    • Whenever, the foreground is switched from one application to other application, the new foreground application receives a message of type SWITCH_FOREGROUND and wisely, the previous foreground application receives a message of type SWITCH_BACKGROUND.
    • Foreground threads can be switched by applications requesting a new application to be replaced on the foreground by calling RimRequestForeground
    • Communication between OS and threads is done by a messaging system.
    • Like event-driven systems, applications receive messages describing system events and associate parameters. Then, they post them to threads to process.

    Message Services
    • As described earlier, BB OS is an event-driven OS.
    • This means that BB applications receive all external otifications through events sent to the applications.
    • Applications process the events. Since the process is completed, they call  the RIMGETMESSAGE function to receive the next event.
    • If there is no event,  the application blocks the send process, allowing other applications to run.
    • If also other applications do not have any event to process, the application puts the CPU in a standby state until the next event.
    • There are two ways of sending messages between two tasks: synchronous and asynchronous.

    Message Services: Asynchronous
    • For asynchronous communication (non-blocking send), applications send message to another application messages’ queue by calling RimPostMessage. The destination receives messages. The sending process continues  execution immediately after the call to RimPostMessage.

    Message Services: Synchronous
    • In Synchronous communications (blocking send), applications send messages to other application’s message queue by calling RimSendMessage and blocks the sending process until it receives responses from the destination.
    • The destination application receives the messages by calling RimGetMessage, put it in the queue and processes all earlier events in its message queue.
    • Then, it processes the message, and any result of the processed message  is sent to the location specified by the sending process (if applicable).
    • The sending application is unblocked and it returns form RimSendMessage.
    • Thus, in order to avoid deadlock from occuring,  when you write an application, you should run the synchronous sends in background threads.

    File System Services
    • File System APIs are used to access the device’s persistent memory.
    • The BB device file system mechanism is different from traditional file systems.
    • All the file’s system non-violate data is stored in flash memory.
    • Both read and write operations are done on a flash space.
    • Writing a single word on the flash involves the following tasks:
    1. Saving the content of entire enclosing flash sector
    2. Erasing the entire flash sector
    3. Rewriting the entire contents of the flash sector with the changed content
    4. The process of rewriting is like a log-structured file system like follows:

    • All writes are performed sequentially at the end of the log file
      • When data that already exists in the log file is modified, it is added to the end of the log. The old copy of data left in the log but it marks as dirty.
        • When file system runs out of space, old segments of the log (with a dirty flag) are cleaned.

        Random Access to Files
        • In desktops, file systems use indexing structures to access files. 
        • This can not be used in handheld devices because of limited resources.
        • As a result, random access to a file is done by sequentially scanning the file from the beginning. This method in handheld device is fast, because the entire file system in a flash memory.

        Reading from the File System
        • In order to optimize the speed of reading from the file system, the file system provides a form read-only memory mapped access.
        • In disk-based file systems, memory mapped file access is implemented through the memory management system.
        • In handhelds, file system explicitly provides lookup tables for all of the records in the fule system.

        BlackBerry OS APIs
        • Radio Communication API
        • Serial Communication API
        • File System API
        • Keypad API
        • LCD API
        • System API

        Radio Communication APIs
        • The BB Radio communication APIs provide easy access to radio network for sending and receiving data.
        • To know about these API, please refer to  Radio Developer’s Guide.
        • Regarding the Radio Communication, the following events may occur:
          • MESSAGE_RECEIVED
          • MESSAGE_SENT
          • MESSAGE_NOT_SENT
          • SIGNAL_LEVEL
          • NETWORK_STARTED
          • BASE_STATION_CHANGE
          • RADIO_TURNED_OFF
          • MESSAGE_STATUS

        System APIs
        • System APIs include a variety of functionalities. They provide functions for thread management, message handling, and task switching.
        • They also provides function for memory allocation, timers, alarm and the system clock.
        • Threads can provide information about battery  status, language, handheld status.

        System Devices Events
        • The following system events may occur:
          • SWITCH_BACKGROUND
          • SWITCH_FOREGROUND
          • POWER_OFF/POWER_UP
          • BATTERY_LOW
          • TASK_LIST_CHANGED
          • Timer Device Events
          • RTC device Events

        Keypad APIs
        • Keypad functions are :
          • KeypadBeep: turns key tones on or off.
          • KeypadRate: configure the keypad for auto key repeat.
          • KeypadRegister: allows an application to intercept global hot keys.
        • The events include:
          • THUMB_CLICK, THUMB_UNCLICK, THUMB_ROLL_UP, THUMB_ROLL_DOWN
          • KEY_DOWN, KEY_REPEAT, KEY_STATUS

        LCD APIs
        • LCD APIs provides a variety of functions for LCD.

        Other APIs
        • There are a variety of APIs for BlackBerry OS including:
          • Radio API SDK
          • UI Engine API SDK
          • Database API SDK
          • Extended API including:
            • Address Book API SDK.
            • Auto Text API SDK.
            • Messaging API SDK.
            • Ribbon API SDK.
        • In order to access them, please refer to SDKs in the RIM Web site.

        No comments:

        Post a Comment