CSC/ECE 517 Fall 2014/final M1455 yaaa

From Expertiza_Wiki
Jump to navigation Jump to search

This wiki page contains design details for the project on Evaluate replacing C libraries with modern Rust equivalents for the Mozilla research project Servo.

Background Information

Rust

Rust is a new programming language for developing reliable and efficient systems. It is designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety. Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.

Servo

Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. Rust’s lightweight task mechanism promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. Servo is not designed to create a full browser but is rather focused on creating a reliable and fast browser engine.

Introduction

Servo currently depends on a lot of C libraries for image decoding. We wish to evaluate switching some of these to new Rust libraries. This project involves rewriting the code that uses these libraries as well as taking measurements before and after to determine the costs involved.

Setup of Development Environment

Servo is currently developed on 64bit OS X and 64bit Linux.

The steps needed to build on a Debian based 64 bit Linux machine are included below. The instructions for other platforms are available here.

  • Install the prerequisite dependencies
sudo apt-get install curl freeglut3-dev \
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \
    msttcorefonts gperf g++ cmake python-virtualenv \
    libssl-dev libglfw-dev
  • Clone and build servo repository
git clone https://www.github.com/servo/servo
cd servo
./mach build
./mach run tests/html/about-mozilla.html

Architecture of system <ref>https://github.com/servo/servo/wiki/Design#task-supervision-diagram</ref>

Task Supervision Diagram

Task Communication Diagram

The above diagrams gives us an overview of the Servo's architecture.

  • Each box represents a Rust task.
  • Primary tasks are the ones which are represented by blue boxes.
  • Gray boxes are for auxiliary tasks.
  • White boxes are for worker tasks. Each such box represents several tasks, the precise number of which are decided by the workload.
  • Supervisor relationships are shown by dashed lines.
  • Communication channels are shown by solid lines.


The scope of our project is limited to the image decoding task shown above.

Requirement analysis<ref>https://github.com/servo/servo/wiki/Replace-C-libraries-student-project</ref>

Data and component design

Design patterns

UML diagrams

Use case diagram

Class Diagram

Proposed Test Cases

References

<references/>