semi final report

Upload: akshay-soni

Post on 06-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Semi Final Report

    1/50

    1

    CHAPTER 1

    INTRODUCTION

  • 8/3/2019 Semi Final Report

    2/50

    2

    1. INTRODUCTION

    1.1. Overview

    Operating system (OS) research has been focused on developing general purpose

    operating systems (GPOS) that can execute all applications, delivering acceptable

    performance for each which required trade off of some of the system performance to

    support those features. However, the trade off hugely harmed the performance of

    several domains of applications, especially resource intensive ones. Examples of those

    application domains are database systems, high performance applications and scientific

    applications. Thus, in order to enhance their applications performance one had to

    reverse-engineer the OS such that to introduce limited changes for limited performance

    gains. But it is a very complicated task, and require the developer to know the OS

    internals, while the other option of building an OS is even more complicated and time-consuming task. Therefore, the OS community realized the need for operating systems

    which can be customized for special kinds of applications.

    However, customizable OS were not widely acceptable and used, due to the several

    complications involved in developing and deploying such systems, Therefore, the need

    for an application specific OS was evident to many of those application domains

    developers. The idea was to give the application developer more flexibility and control

    over the hardware by separating hardware protection from mechanism.

    The another reason is the growth in the number of applications dedicated to the specifichardware lead to the development of the operating system which will optimize the use

    of the available hardware resources to increase the efficiency of the applications and

    decrease the over heads. Most of such systems are implemented with customizing the

    available operating system in the market. The technological opportunities have led to

    the possibility of creating the application specific operating system which can fulfil the

    purpose.

    The basic characteristics of application specific operating system,

    The degree of security provided

    The performance in terms of speed and minimal resource consumption Most importantly, ease of use to the end userThe use of the high level language as the programming language add the extra edge as

    it provides the maximum level of abstraction to the user as well as the extra features

    like garbage collection etc which makes it the self managed code.

  • 8/3/2019 Semi Final Report

    3/50

    3

    1.2. Motivation

    From different contributions and evolutions to the compiler technologies and

    programming paradigms we had motivations to pursue in the creation of a new C#

    compiler.

    Distributing the binaries created by the C# compilers requires us to install the bulky.NET Framework. Even a traditional helloworld program would require all the

    features of .NET Framework to be installed. To solve this problem we have taken the

    approach of C and C++ which link the appropriate libraries required to the program

    successfully.

    Writing of operating system has been evolving throughout the past decades from

    assembly codes to high level languages such as C and C++. There have been many

    other projects such asSharpOS, Comos and even Microsofts research operating system

    Singularity, which have taken a different approach by writing the kernel, device

    drivers and application in managed code. The compilers of these operating systems

    have been the motivation to create a C# compiler that produces native codes.

    Write Once, Run Anywhere (WORA) slogan from Sun Microsystems has made us

    think to generate a portable code which could be used over a wide variety of operating

    system and computer architectures.

    1.3. Objectives

    i. Performance: Our operating system should exceed the performance of other

    operating systems and make optimum use of resources available

    ii. Ease of use: Users should find our operating system simple to use or they may opt

    not to use it at all.

    iii. Security: The operating system should offer strong enough security against many

    trivial and moderately sophisticated attacks; its design should not be complicated by the

    desire to protect against very sophisticated attacks.

    iv. Scalability: The operating system should be scalable means it could be used forsmall applications as well for large applications depending upon the need accordingly

    v. Portability: The operating system should be portable means it should be architecture

    independent.

  • 8/3/2019 Semi Final Report

    4/50

    4

    1.4. Application & Advantages

    i. our os will have Small development life cycle.

    ii. Application specific and its device drivers will be developed in high level language

    which will provide high readability, maintainability.

    iii. As we are using llvm our os will be Architecture independent and can be run on

    various architecture.

    iv. Industry level optimisation by the use of LLVM.

    v. It can even run on platform/device where General Purpose Operating System cannot

    run.

    vi. It is dedicated towards application specific devices.

    vii. Can be used in specific devices to run applications like music players to listen andwatch videos, set top boxes of televisions, routers firmware.

    viii. The end user of ASMOS* is Developer who will use it as a framework for

    developing operating systems/firmware for application specific devices.

    1.5. Organization of Report

    1.5.1. Chapter 1: This chapter gives an introduction to the entire project. It states the

    broad objectives of the project and also it uses or applications.

    1.5.2. Chapter 2: This chapter gives a detailed description of the concepts involved in

    the project and the technologies related to the project. It also gives a description

    of the significant works already done in the same field.

    1.5.3. Chapter 3: This chapter puts down the project in perspective. It objectively

    defines what problems exist while developing this file system. It gathers and

    analyses the requirements as well along with defining the scope of work of the

    project.

    1.5.4. Chapter 4: This chapter lays down the system design or architecture of the projectto be developed.

    1.5.5 .Chapter 5: In this chapter, implementation related details are described such as

    the splitting of the whole application into independent modules

  • 8/3/2019 Semi Final Report

    5/50

    5

    CHAPTER 2

    LITERATURE

    REVIEW

  • 8/3/2019 Semi Final Report

    6/50

    6

    2. Literature Review

    2.1. Conceptual Overview

    2.1.1. Operating System

    Anoperating system(OS) is a set ofprogramsthat managecomputer

    hardwareresources and provide common services forapplication software. The

    operating system is the most important type ofsystem softwarein a computer system.

    A user cannot run an application program on the computer without an operating system,

    unless the application program is self booting. Time-sharing operating systems

    schedule tasks for efficient use of the system and may also include accounting for cost

    allocation of processor time, mass storage, printing, and other resources. For hardware

    functions such as input and output andmemory allocation, the operating system acts as

    an intermediary between application programs and the computer hardware,although the

    application code is usually executed directly by the hardware and will frequently call

    the OS or be interrupted by it. Operating systems are found on almost any device

    that contains a computerfromcellular phonesandvideo game

    consolestosupercomputersandweb servers.

    Examples of popular modern operating systems includeAndroid,iOS,Linux,Mac OS

    X, andMicrosoft Windows.

    Fig 1.1: General Architecture of an Operating System

    http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/System_softwarehttp://en.wikipedia.org/wiki/System_softwarehttp://en.wikipedia.org/wiki/System_softwarehttp://en.wikipedia.org/wiki/Dynamic_memory_allocationhttp://en.wikipedia.org/wiki/Dynamic_memory_allocationhttp://en.wikipedia.org/wiki/Video_game_consolehttp://en.wikipedia.org/wiki/Video_game_consolehttp://en.wikipedia.org/wiki/Video_game_consolehttp://en.wikipedia.org/wiki/Video_game_consolehttp://en.wikipedia.org/wiki/Supercomputershttp://en.wikipedia.org/wiki/Supercomputershttp://en.wikipedia.org/wiki/Supercomputershttp://en.wikipedia.org/wiki/Web_servershttp://en.wikipedia.org/wiki/Web_servershttp://en.wikipedia.org/wiki/IOS_(Apple)http://en.wikipedia.org/wiki/IOS_(Apple)http://en.wikipedia.org/wiki/IOS_(Apple)http://en.wikipedia.org/wiki/Web_servershttp://en.wikipedia.org/wiki/Supercomputershttp://en.wikipedia.org/wiki/Video_game_consolehttp://en.wikipedia.org/wiki/Video_game_consolehttp://en.wikipedia.org/wiki/Dynamic_memory_allocationhttp://en.wikipedia.org/wiki/System_softwarehttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Computer_program
  • 8/3/2019 Semi Final Report

    7/50

    7

    An operating system consists of many parts. One of the most important components is

    thekernel, which controls low-level processes that the average user usually cannot see:

    it controls how memory is read and written, the order in which processes are executed,

    how information is received and sent by devices like the monitor, keyboard and mouse,

    and decides how to interpret information received from networks. Theuser interfaceis

    a component that interacts with the computer user directly, allowing them to controland use programs. The user interface may begraphical with icons and a desktop,

    ortextual, with a command line.Application programming interfacesprovide services

    and code libraries that let applications developers write modular code reusing well

    defined programming sequences in user space libraries or in the operating system itself.

    Which features are considered part of the operating system is defined differently in

    various operating systems. For example, Microsoft Windows considers its user

    interface to be part of the operating system, while many versions of Linux do not.[12]

    2.1.2. Kernel

    Incomputing, thekernelis the main component of most computeroperating systems; it

    is a bridge between applications and the actual data processing done at the hardware

    level. The kernel's responsibilities include managing the system's resources (the

    communication betweenhardwareandsoftwarecomponents). Usually as a basic

    component of an operating system, a kernel can provide the lowest-levelabstraction

    layerfor the resources (especiallyprocessorsandI/O devices) that application software

    must control to perform its function. It typically makes these facilities available

    toapplicationprocessesthroughinter-process communicationmechanisms andsystem

    calls. Operating system tasks are done differently by different kernels, depending on

    their design and implementation. While monolithic kernelsexecute all the operating

    system code in the sameaddress spaceto increase the performance of the

    system,microkernelsrun most of the operating system services inuser spaceas servers,

    aiming to improve maintainability and modularity of the operating system. A range of

    possibilities exists between these two extremes.

    Fig 1.2: General Working of the Kernel of the Operating System

    http://en.wikipedia.org/wiki/Kernel_(computing)http://en.wikipedia.org/wiki/Kernel_(computing)http://en.wikipedia.org/wiki/User_interfacehttp://en.wikipedia.org/wiki/User_interfacehttp://en.wikipedia.org/wiki/User_interfacehttp://en.wikipedia.org/wiki/Graphical_User_Interfacehttp://en.wikipedia.org/wiki/Graphical_User_Interfacehttp://en.wikipedia.org/wiki/Command-line_interfacehttp://en.wikipedia.org/wiki/Command-line_interfacehttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/Computinghttp://en.wikipedia.org/wiki/Computinghttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Computer_softwarehttp://en.wikipedia.org/wiki/Computer_softwarehttp://en.wikipedia.org/wiki/Computer_softwarehttp://en.wikipedia.org/wiki/Abstraction_layerhttp://en.wikipedia.org/wiki/Abstraction_layerhttp://en.wikipedia.org/wiki/Abstraction_layerhttp://en.wikipedia.org/wiki/Abstraction_layerhttp://en.wikipedia.org/wiki/Central_processing_unithttp://en.wikipedia.org/wiki/Central_processing_unithttp://en.wikipedia.org/wiki/Central_processing_unithttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Application_softwarehttp://en.wikipedia.org/wiki/Application_softwarehttp://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Inter-process_communicationhttp://en.wikipedia.org/wiki/Inter-process_communicationhttp://en.wikipedia.org/wiki/Inter-process_communicationhttp://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/Monolithic_kernelhttp://en.wikipedia.org/wiki/Monolithic_kernelhttp://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Monolithic_kernelhttp://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/Inter-process_communicationhttp://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Application_softwarehttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Central_processing_unithttp://en.wikipedia.org/wiki/Abstraction_layerhttp://en.wikipedia.org/wiki/Abstraction_layerhttp://en.wikipedia.org/wiki/Computer_softwarehttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Computinghttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/Command-line_interfacehttp://en.wikipedia.org/wiki/Graphical_User_Interfacehttp://en.wikipedia.org/wiki/User_interfacehttp://en.wikipedia.org/wiki/Kernel_(computing)
  • 8/3/2019 Semi Final Report

    8/50

    8

    Fig 1.3: Kernel Architecture Overview:-

    2.1.3.Microkernel

    In computer science, a microkernel is the near-minimum amount of software that can

    provide the mechanisms needed to implement an operating system (OS). These

    mechanisms include low-level address space management, thread management,

    and inter-process communication (IPC). If the hardware provides multiple rings or CPUmodes, the microkernel is the only software executing at the most privileged level

    (generally referred to as supervisor or kernel mode). Traditional operating system

    functions, such as device drivers, protocol stacks and file systems, are removed from

    the microkernel to run in user space. In source code size, microkernels tend to be under

    10,000 lines of code, as a general rule. MINIX for example has around 4,000 lines of

    code. kernels larger than 20,000 lines are generally not considered microkernels.

    Microkernels developed in the 1980s as a response to changes in the computer world,

    and several challenges adapting existing "mono-kernels" to these new systems. New

    device drivers, protocol stacks, file systems and other low-level systems were being

    developed all the time, code that was normally located in the monolithic kernel, and

    thus required considerable work and careful code management to work on.

    Microkernels were developed with the idea that all of these services would be

    implemented as user-space programs, like any other, allowing them to be worked on

    monolithically and started and stopped like any other program. This would not only

    allow these services to be more easily worked on, but also separated the kernel code to

    allow it to be finely tuned without worrying about unintended side effects. Moreover, it

    would allow entirely new operating systems to be "built up" on a common core, aiding

    OS research.

    http://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Thread_(computer_science)http://en.wikipedia.org/wiki/Inter-process_communicationhttp://en.wikipedia.org/wiki/Hierarchical_protection_domainshttp://en.wikipedia.org/wiki/CPU_modeshttp://en.wikipedia.org/wiki/CPU_modeshttp://en.wikipedia.org/wiki/Kernel_modehttp://en.wikipedia.org/wiki/Device_driverhttp://en.wikipedia.org/wiki/Protocol_stackhttp://en.wikipedia.org/wiki/File_systemhttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/MINIXhttp://en.wikipedia.org/wiki/MINIXhttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/File_systemhttp://en.wikipedia.org/wiki/Protocol_stackhttp://en.wikipedia.org/wiki/Device_driverhttp://en.wikipedia.org/wiki/Kernel_modehttp://en.wikipedia.org/wiki/CPU_modeshttp://en.wikipedia.org/wiki/CPU_modeshttp://en.wikipedia.org/wiki/Hierarchical_protection_domainshttp://en.wikipedia.org/wiki/Inter-process_communicationhttp://en.wikipedia.org/wiki/Thread_(computer_science)http://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Computer_science
  • 8/3/2019 Semi Final Report

    9/50

    9

    Amonolithic kernelis an operating system architecture where the entire operating

    system is working in the kernel spaceand alone assupervisor mode. The monolithic

    differs from other operating system architectures (such as

    themicrokernelarchitecture)in that it defines alone a high-level virtual interface over

    computer hardware, with a set of primitives orsystem callsto implement all operating

    system services such asprocessmanagement,concurrency, andmemorymanagementitself and one or more device drivers asmodules.

    Fig 1.4:Structure of monolithic and microkernel-based operating systems

    2.1.4. Compiler

    Acompileris acomputer program(or set of programs) that transformssource

    codewritten in a programming language(thesource language) into another computer

    language (thetarget language, often having a binary form known as object code). The

    most common reason for wanting to transform source code is to create

    anexecutableprogram. The name "compiler" is primarily used for programs that

    translate source code from ahigh-level programming languageto a lower level

    language (e.g.,assembly languageormachine code). If the compiled program can run

    on a computer whoseCPUoroperating systemis different from the one on which the

    compiler runs, the compiler is known as across-compiler. A program that translates

    from a low level language to a higher level one is a decompiler. A program that

    http://en.wikipedia.org/wiki/Kernel_spacehttp://en.wikipedia.org/wiki/Kernel_spacehttp://en.wikipedia.org/wiki/Supervisor_modehttp://en.wikipedia.org/wiki/Supervisor_modehttp://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Concurrency_(computer_science)http://en.wikipedia.org/wiki/Concurrency_(computer_science)http://en.wikipedia.org/wiki/Memory_managementhttp://en.wikipedia.org/wiki/Memory_managementhttp://en.wikipedia.org/wiki/Memory_managementhttp://en.wikipedia.org/wiki/Memory_managementhttp://en.wikipedia.org/wiki/Module_(programming)http://en.wikipedia.org/wiki/Module_(programming)http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Source_codehttp://en.wikipedia.org/wiki/Source_codehttp://en.wikipedia.org/wiki/Source_codehttp://en.wikipedia.org/wiki/Source_codehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Cross-compilerhttp://en.wikipedia.org/wiki/Cross-compilerhttp://en.wikipedia.org/wiki/Decompilerhttp://en.wikipedia.org/wiki/Decompilerhttp://en.wikipedia.org/wiki/Decompilerhttp://en.wikipedia.org/wiki/Cross-compilerhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Source_codehttp://en.wikipedia.org/wiki/Source_codehttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Module_(programming)http://en.wikipedia.org/wiki/Memory_managementhttp://en.wikipedia.org/wiki/Memory_managementhttp://en.wikipedia.org/wiki/Concurrency_(computer_science)http://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/Supervisor_modehttp://en.wikipedia.org/wiki/Kernel_space
  • 8/3/2019 Semi Final Report

    10/50

    10

    translates between high-level languages is usually called alanguage translator,source

    to source translator, orlanguage converter. A languagerewriteris usually a program

    that translates the form of expressions without a change of language. A compiler is

    likely to perform many or all of the following operations:lexical

    analysis,preprocessing, parsing, semantic analysis (Syntax-directed translation),code

    generation, andcode optimization.

    Program faults caused by incorrect compiler behaviour can be very difficult to track

    down and work around; therefore, compiler implementors invest a lot of time ensuring

    thecorrectness of their software. The termcompiler-compileris sometimes used to

    refer to aparser generator, a tool often used to help create thelexerandparser.

    Fig 1.5:Working of the Compiler

    http://en.wikipedia.org/wiki/Translator_(computing)http://en.wikipedia.org/wiki/Translator_(computing)http://en.wikipedia.org/wiki/Rewritinghttp://en.wikipedia.org/wiki/Rewritinghttp://en.wikipedia.org/wiki/Rewritinghttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Preprocessinghttp://en.wikipedia.org/wiki/Preprocessinghttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Syntax-directed_translationhttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Code_optimizationhttp://en.wikipedia.org/wiki/Code_optimizationhttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Compiler-compilerhttp://en.wikipedia.org/wiki/Compiler-compilerhttp://en.wikipedia.org/wiki/Compiler-compilerhttp://en.wikipedia.org/wiki/Parser_generatorhttp://en.wikipedia.org/wiki/Parser_generatorhttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Parserhttp://en.wikipedia.org/wiki/Parserhttp://en.wikipedia.org/wiki/Parserhttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Parser_generatorhttp://en.wikipedia.org/wiki/Compiler-compilerhttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Code_optimizationhttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Syntax-directed_translationhttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Preprocessinghttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Rewritinghttp://en.wikipedia.org/wiki/Translator_(computing)
  • 8/3/2019 Semi Final Report

    11/50

    11

    2.1.5. The structure of a compiler

    Compilers bridge source programs in high-level languages with the underlying

    hardware. A compiler requires

    determining the correctness of the syntax of programs,

    generating correct and efficient object code, run-time organization, formatting output according to assembler and/or linker conventions. A compiler

    consists of three main parts: the frontend, the middle-end, and the backend.

    The front end checks whether the program is correctly written in terms of the

    programming language syntax and semantics. Here legal and illegal programs are

    recognized. Errors are reported, if any, in a useful way. Type checking is also

    performed by collecting type information. The frontend then generates an intermediate

    representation or IR of the source code for processing by the middle-end.

    The middle end is where optimization takes place. Typical transformations for

    optimization are removal of useless or unreachable code, discovery and propagation of

    constant values, relocation of computation to a less frequently executed place (e.g., out

    of a loop), or specialization of computation based on the context. The middle-end

    generates another IR for the following backend. Most optimization efforts are focused

    on this part.

    The back end is responsible for translating the IR from the middle-end into assembly

    code. The target instruction(s) are chosen for each IR instruction. Register allocationassigns processor registers for the program variables where possible. The backend

    utilizes the hardware by figuring out how to keep parallel execution units busy, filling

    delay slots, and so on. Although most algorithms for optimization are in NP, heuristic

    techniques are well-developed.[10]

    2.1.6 Linker

    Incomputer science, a linkerorlink editoris aprogramthat takes one or

    moreobjectsgenerated by a compiler and combines them into a

    singleexecutableprogram.

    Computer programs typically comprise several parts or modules; all these

    parts/modules need not be contained within a single object file, and in such case refer to

    each other by means ofsymbols. Typically, an object file can contain three kinds of

    symbols:

    http://en.wikipedia.org/wiki/Programming_language#Type_systemhttp://en.wikipedia.org/wiki/Register_allocationhttp://en.wikipedia.org/wiki/Processor_registerhttp://en.wikipedia.org/wiki/Execution_unithttp://en.wikipedia.org/wiki/Delay_slothttp://en.wikipedia.org/wiki/NP_(complexity)http://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Object_filehttp://en.wikipedia.org/wiki/Object_filehttp://en.wikipedia.org/wiki/Object_filehttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Object_filehttp://en.wikipedia.org/wiki/Debug_symbolhttp://en.wikipedia.org/wiki/Debug_symbolhttp://en.wikipedia.org/wiki/Object_filehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/Object_filehttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/NP_(complexity)http://en.wikipedia.org/wiki/Delay_slothttp://en.wikipedia.org/wiki/Execution_unithttp://en.wikipedia.org/wiki/Processor_registerhttp://en.wikipedia.org/wiki/Register_allocationhttp://en.wikipedia.org/wiki/Programming_language#Type_system
  • 8/3/2019 Semi Final Report

    12/50

    12

    defined symbols, which allow it to be called by other modules,undefined symbols, which call the other modules where these symbols are defined,local symbols, used internally within the object file to facilitaterelocation.

    When a program comprises multiple object files, the linker combines these files into a

    unified executable program, resolving the symbols as it goes along.

    Linkers can take objects from a collection called a library. Some linkers do not include

    the whole library in the output; they only include its symbols that are referenced from

    other object files or libraries. Libraries exist for diverse purposes, and one or more

    system libraries are usually linked in by default.

    The linker also takes care of arranging the objects in a program's address space. This

    may involve relocating code that assumes a specific base address to another base. Since

    a compiler seldom knows where an object will reside, it often assumes a fixed base

    location (for example, zero). Relocating machine code may involve re-targeting of

    absolute jumps, loads and stores.

    The executable output by the linker may need another relocation pass when it is finally

    loaded into memory (just before execution). This pass is usually omitted

    on hardware offering virtual memory every program is put into its own address

    space, so there is no conflict even if all programs load at the same base address. This

    pass may also be omitted if the executable is a position independent executable.

    A linker takes the object code generated by the compiler / assembler, and linksit

    against the C library (and / or libgcc.a or whatever link library you provide). This can

    be done in two ways: static, and dynamic.

    Fig 1.6: An illustration of the linking process.

    http://en.wikipedia.org/wiki/Relocation_(computer_science)http://en.wikipedia.org/wiki/Relocation_(computer_science)http://en.wikipedia.org/wiki/Library_(computer_science)http://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Base_addresshttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Virtual_memoryhttp://en.wikipedia.org/wiki/Position_independenthttp://en.wikipedia.org/wiki/Position_independenthttp://en.wikipedia.org/wiki/Virtual_memoryhttp://en.wikipedia.org/wiki/Computer_hardwarehttp://en.wikipedia.org/wiki/Base_addresshttp://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Library_(computer_science)http://en.wikipedia.org/wiki/Relocation_(computer_science)
  • 8/3/2019 Semi Final Report

    13/50

    13

    Object files and static libraries are assembled into a new library or executable.

    a) Static Linking

    When linking statically, the linker is invoked during the build process, just after the

    compiler / assembler run. It takes the object code, checks it for unresolved references,

    and checks if it can resolve these references from the available libraries. It then adds thebinary code from these libraries to the executable; after this process, the executable

    is complete, i.e. when running it does not require anything but the kernel to be present.

    On the downside, the executable can become quite large, and code from the libraries is

    duplicated over and over, both on disk and in memory.

    b) Dynamic Linking

    When linking dynamically, the linker is invoked during the loading of an executable.

    The unresolved references in the object code are resolved against the libraries currently

    present in the system. This makes the on-disk executable much smaller, and allows for

    in-memory space-saving strategies such as shared libraries (see below).

    On the downside, the executable becomes dependent on the presence of the libraries it

    references; if a system does not have those libraries, the executable cannot run.

    This approach offers two advantages:

    Often-used libraries (for example the standard system libraries) need to be stored inonly one location, not duplicated in every single binary.

    If an error in a library function is corrected by replacing the library, all programsusing it dynamically will benefit from the correction after restarting them. Programs

    that included this function by static linking would have to be re-linked first.

    There are also disadvantages:

    Known on the Windows platform as "DLL Hell", an incompatible updated DLL willbreak executables that depended on the behavior of the previous DLL.

    A program, together with the libraries it uses, might be certified (e.g. as tocorrectness, documentation requirements, or performance) as a package, but not ifcomponents can be replaced. (This also argues against automatic OS updates in critical

    systems; in both cases, the OS and libraries form part of aqualifiedenvironment.)[11]

    2.1.6. Shared Libraries

    A popular strategy is to share dynamically linked libraries across multiple executables.

    This means that, instead of attaching the binary of the library to the executable image,

    the references in the executable are tweaked, so that all executables refer to the same

    in-memory representation of the required library.

    http://en.wikipedia.org/wiki/DLL_Hellhttp://en.wikipedia.org/wiki/DLL_Hell
  • 8/3/2019 Semi Final Report

    14/50

    14

    This requires some trickery. For one, the library must either not have any state (static or

    global data) at all, or it must provide a separate state for each executable. This gets even

    trickier with multi-threaded systems, where one executable might have more than one

    simultaneous control flow.

    Second, in a virtual memory environment, it is usually impossible to provide a library

    to all executables in the system at the same virtual memory address. To access library

    code at an arbitrary virtual address requires the library code to be position

    independent (which can be achieved e.g. by setting the -PIC command line option for

    the GCC compiler). This requires support of the feature by the binary format

    (relocation tables), and can result in slightly less efficient code on some architectures.

    2.1.7. Virtual Machines

    Avirtual machine(VM) is a "completely isolated guest operating system installation

    within a normal host operating system".Modern virtual machines are implemented with

    eithersoftware emulationorhardware virtualizationor (in the most cases) both

    together. A virtual machine (VM) is a software implementation of a machine (i.e. a

    computer) that executes programs like a physical machine. Virtual machines are

    separated into two major categories, based on their use and degree of correspondence to

    any real machine. A system virtual machine provides a complete system

    platform which supports the execution of a complete operating system (OS). In

    contrast, a process virtual machine is designed to run a single program, which means

    that it supports a single process. An essential characteristic of a virtual machine is that

    the software running inside is limited to the resources and abstractions provided by the

    virtual machineit cannot break out of its virtual world.

    2.1.8. MSIL

    Microsoft Intermediate Language, former acronym of Microsoft's Common

    Intermediate Language.is the lowest-level human-readableprogramming

    language defined by the Common Language Infrastructure (CLI) specification and is

    used by the .NET Frameworkand Mono. Languages which target a CLS-compatible

    runtime environment compile to CIL, which is assembled into an object code that hasa bytecode-style format. CIL is an object-oriented assembly language, and is

    entirely stack-based. Its bytecode is translated into native code or executed by a virtual

    machine.

    CIL was originally known as Microsoft Intermediate Language (MSIL) during the beta

    releases of the .NET languages. Due to standardization ofC# and the Common

    Language Infrastructure, the bytecode is now officially known as CIL.[1]

    http://wiki.osdev.org/GCChttp://en.wikipedia.org/wiki/Software_emulationhttp://en.wikipedia.org/wiki/Software_emulationhttp://en.wikipedia.org/wiki/Software_emulationhttp://en.wikipedia.org/wiki/Virtualization#Hardwarehttp://en.wikipedia.org/wiki/Virtualization#Hardwarehttp://en.wikipedia.org/wiki/Virtualization#Hardwarehttp://en.wikipedia.org/wiki/System_platformhttp://en.wikipedia.org/wiki/System_platformhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Human-readablehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Common_Language_Infrastructurehttp://en.wikipedia.org/wiki/.NET_Frameworkhttp://en.wikipedia.org/wiki/Mono_(software)http://en.wikipedia.org/wiki/Common_Language_Infrastructurehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Bytecodehttp://en.wikipedia.org/wiki/Object-orientedhttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Stack_machinehttp://en.wikipedia.org/wiki/Native_codehttp://en.wikipedia.org/wiki/Virtual_machinehttp://en.wikipedia.org/wiki/Virtual_machinehttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/Common_Language_Infrastructurehttp://en.wikipedia.org/wiki/Common_Language_Infrastructurehttp://en.wikipedia.org/wiki/Common_Intermediate_Language#cite_note-0http://en.wikipedia.org/wiki/Common_Intermediate_Language#cite_note-0http://en.wikipedia.org/wiki/Common_Intermediate_Language#cite_note-0http://en.wikipedia.org/wiki/Common_Intermediate_Language#cite_note-0http://en.wikipedia.org/wiki/Common_Language_Infrastructurehttp://en.wikipedia.org/wiki/Common_Language_Infrastructurehttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/Virtual_machinehttp://en.wikipedia.org/wiki/Virtual_machinehttp://en.wikipedia.org/wiki/Native_codehttp://en.wikipedia.org/wiki/Stack_machinehttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Object-orientedhttp://en.wikipedia.org/wiki/Bytecodehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Common_Language_Infrastructurehttp://en.wikipedia.org/wiki/Mono_(software)http://en.wikipedia.org/wiki/.NET_Frameworkhttp://en.wikipedia.org/wiki/Common_Language_Infrastructurehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Human-readablehttp://en.wikipedia.org/wiki/Human-readablehttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/System_platformhttp://en.wikipedia.org/wiki/System_platformhttp://en.wikipedia.org/wiki/Virtualization#Hardwarehttp://en.wikipedia.org/wiki/Software_emulationhttp://wiki.osdev.org/GCC
  • 8/3/2019 Semi Final Report

    15/50

    15

    2.1.9. C#

    It is a high-level object-oriented programming language that is part of the .NET

    language family developed by Microsoft. Although the language is considered to be

    primarily object-oriented a closer look reveals that it is in fact a multi-paradigm

    language with aspects of functional and imperative programming styles included in it as

    well.

    It is currently designed to function within the Common Language Infrastructure (CLI)

    which provides a CTS (Common Type System) and CLS (Common Language

    Specification) so that when it is compiled it generates the CIL (Common Intermediate

    Language).

    By design, C# is the programming language that most directly reflects the

    underlying Common Language Infrastructure (CLI). Most of its intrinsic types

    correspond to value-types implemented by the CLI framework. However, the language

    specification does not state the code generation requirements of the compiler: that is, it

    does not state that a C# compiler must target a Common Language Runtime, or

    generate Common Intermediate Language (CIL), or generate any other specific format.

    Theoretically, a C# compiler could generate machine code like traditional compilers of

    C++ or Fortran.

    Some notable features of C# that distinguish it from C and C++ (and Java, where noted)

    are:

    i. It has no global variables or functions. All methods and members must be declaredwithin classes. Static members of public classes can substitute for global variablesand functions.

    ii. Local variables cannot shadow variables of the enclosing block, unlike C andC++. Variable shadowing is often considered confusing by C++ texts.

    iii. C# supports a strict Boolean data type, bool. Statements that take conditions, suchas while and if, require an expression of a type that implements the true operator,

    such as the boolean type. While C++ also has a boolean type, it can be freely

    converted to and from integers, and expressions such as if(a) require only that a is

    convertible to bool, allowing a to be an int, or a pointer. C# disallows this "integer

    meaning true or false" approach, on the grounds that forcing programmers to useexpressions that return exactly bool can prevent certain types of common

    programming mistakes in C or C++ such as if (a = b) (use of assignment = instead

    of equality ==).

    iv. In C#, memory address pointers can only be used within blocks specificallymarked as unsafe, and programs with unsafe code need appropriate permissions to

    run. Most object access is done through safe object references, which always either

    point to a "live" object or have the well-defined null value; it is impossible to

    obtain a reference to a "dead" object (one that has been garbage collected), or to a

    random block of memory. An unsafe pointer can point to an instance of a value-

    type, array, string, or a block of memory allocated on a stack. Code that is not

    http://en.wikipedia.org/wiki/Common_Language_Infrastructurehttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Fortranhttp://en.wikipedia.org/wiki/Variable_shadowinghttp://en.wikipedia.org/wiki/Boolean_data_typehttp://en.wikipedia.org/wiki/Nullable_typehttp://en.wikipedia.org/wiki/Nullable_typehttp://en.wikipedia.org/wiki/Boolean_data_typehttp://en.wikipedia.org/wiki/Variable_shadowinghttp://en.wikipedia.org/wiki/Fortranhttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Common_Language_Infrastructure
  • 8/3/2019 Semi Final Report

    16/50

    16

    marked as unsafe can still store and manipulate pointers through

    the System.IntPtr type, but it cannot dereference them.

    v. Managed memory cannot be explicitly freed; instead, it is automatically garbagecollected. Garbage collection addresses the problem ofmemory leaks by freeing

    the programmer of responsibility for releasing memory that is no longer needed.

    vi.

    In addition to the try...catch construct to handle exceptions, C# hasa tryfinally construct to guarantee execution of the code in the finally block.

    vii. Multiple inheritance is not supported, although a class can implement any numberof interfaces. This was a design decision by the language's lead architect to avoid

    complication and simplify architectural requirements throughout CLI.

    viii. C#, like C++, but unlike Java, supports operator overloading.ix. C# is more type safe than C++. The only implicit conversions by default are those

    that are considered safe, such as widening of integers. This is enforced at compile-

    time, during JIT, and, in some cases, at runtime. No implicit conversions occur

    between booleans and integers, nor between enumeration members and integers

    (except for literal 0, which can be implicitly converted to any enumerated type).

    Any user-defined conversion must be explicitly marked as explicit or implicit,

    unlike C++ copy constructors and conversion operators, which are both implicit by

    default. Starting with version 4.0, C# supports a "dynamic" data type that enforces

    type checking at runtime only.

    x. Enumeration members are placed in their own scope.xi. C# provides properties as syntactic sugar for a common pattern in which a pair of

    methods, accessor (getter) and mutator (setter) encapsulate operations on a

    single attribute of a class.

    xii. Full type reflection and discovery is available.xiii. Checked exceptions are not present in C# (in contrast to Java). This has been a

    conscious decision based on the issues of scalability and versionability. [7]

    http://en.wikipedia.org/wiki/Memory_leakhttp://en.wikipedia.org/wiki/Multiple_inheritancehttp://en.wikipedia.org/wiki/Operator_overloadinghttp://en.wikipedia.org/wiki/Type_safetyhttp://en.wikipedia.org/wiki/Just-in-time_compilationhttp://en.wikipedia.org/wiki/Copy_constructorhttp://en.wikipedia.org/wiki/Enumerated_typehttp://en.wikipedia.org/wiki/Scope_(programming)http://en.wikipedia.org/wiki/Property_(programming)http://en.wikipedia.org/wiki/Syntactic_sugarhttp://en.wikipedia.org/wiki/Mutator_methodhttp://en.wikipedia.org/wiki/Attribute_(computing)http://en.wikipedia.org/wiki/Reflection_(computer_science)http://en.wikipedia.org/wiki/Checked_exceptionshttp://en.wikipedia.org/wiki/Checked_exceptionshttp://en.wikipedia.org/wiki/Reflection_(computer_science)http://en.wikipedia.org/wiki/Attribute_(computing)http://en.wikipedia.org/wiki/Mutator_methodhttp://en.wikipedia.org/wiki/Syntactic_sugarhttp://en.wikipedia.org/wiki/Property_(programming)http://en.wikipedia.org/wiki/Scope_(programming)http://en.wikipedia.org/wiki/Enumerated_typehttp://en.wikipedia.org/wiki/Copy_constructorhttp://en.wikipedia.org/wiki/Just-in-time_compilationhttp://en.wikipedia.org/wiki/Type_safetyhttp://en.wikipedia.org/wiki/Operator_overloadinghttp://en.wikipedia.org/wiki/Multiple_inheritancehttp://en.wikipedia.org/wiki/Memory_leak
  • 8/3/2019 Semi Final Report

    17/50

    17

    2.1.10 Device driver

    A device driver or software driver is a computer program allowing higher-level

    computer programs to interact with a hardware device. A driver typically

    communicates with the device through the computer bus or communications subsystem

    to which the hardware connects. When a calling program invokes a routine in the

    driver, the driver issues commands to the device. Once the device sends data back to

    the driver, the driver may invoke routines in the original calling program. Drivers are

    hardware-dependent and operating-system-specific. They usually provide

    the interrupt handling required for any necessary asynchronous time-dependent

    hardware interface.

    Purpose:-

    A device driver simplifies programming by acting as translator between a hardware

    device and the applications or operating systems that use it. Programmers can write the

    higher-level application code independently of whatever specific hardware device.[8]

    Fig1.7: Interaction of device drivers with devices and operating system

    http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Peripheralhttp://en.wikipedia.org/wiki/Computer_bushttp://en.wikipedia.org/wiki/Subroutinehttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Interrupthttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Interrupthttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Subroutinehttp://en.wikipedia.org/wiki/Computer_bushttp://en.wikipedia.org/wiki/Peripheralhttp://en.wikipedia.org/wiki/Computer_program
  • 8/3/2019 Semi Final Report

    18/50

    18

    2.2. Technologies Used

    2.2.1.LLVM

    Low Level Virtual Machine (LLVM) is a compiler infrastructure that consists of two

    primary components, an optimizer and a code generator. It is designed so that

    optimizations of programs can occur at different phases of the program life such ascompile-time, link-time and run-time.[3]

    2.2.2.LLVM IR (Intermediate Representation)

    It is a low-level language similar to assembly language containing RISC like instruction

    set that effectively captures the operations of the processor whilst avoiding machine-

    specific constraints such as pipelines, physical registers and other low-level calling

    conventions. By increasing the layer of abstraction apart from the hardware specifics inthe code, the LLVM IR is in a sense, platform independent and can be used on a variety

    of machines with different hardware specifications.

    The common code representation used throughout all phases of the LLVM compilation

    strategy is a Single Static Assignment (SSA) based representation which provides type

    safety, low-level operations and is flexible and capable of representing high-level

    languages in a clear and efficient manner.

    A key important factor contributing to the productivity of the LLVM system is its

    virtual instruction set. The LLVM code is a low level representation while being able to

    contain high-level information due to its designed structure.[4][6]

    2.2.3. Coco/R

    Coco/R is a compiler generator that takes an L-attributed Extended BackusNaur

    Form (EBNF) grammar of a source language and generates a scanner and a parser for

    that language. The scanner works as a deterministic finite-state machine. It

    supports Unicode characters in UTF-8 encoding and can be made case-sensitive or

    case-insensitive. It can also recognize tokens based on their right-hand-side context. Inaddition to terminal symbols the scanner can also recognize pragmas, which are tokens

    that are not part of the syntax but can occur anywhere in the input stream (e.g. compiler

    directives or end-of-line characters).

    The parser uses recursive descent; LL(1) conflicts can be resolved by either a multi-

    symbol look ahead or by semantic checks. Thus the class of accepted grammars is

    LL(k) for an arbitrary k. Fuzzy parsing is supported by so-called ANY symbols that

    match complementary sets of tokens. Semantic actions are written in the same language

    as the generated scanner and parser. The parser's error handling can be tuned by

    specifying synchronization points and "weak symbols" in the grammar. Coco/R checks

    http://en.wikipedia.org/wiki/Compiler_generatorhttp://en.wikipedia.org/wiki/L-attributed_grammarhttp://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Formhttp://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Formhttp://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Formhttp://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Formhttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Deterministic_finite-state_machinehttp://en.wikipedia.org/wiki/Unicodehttp://en.wikipedia.org/wiki/UTF-8http://en.wikipedia.org/wiki/Compiler_directivehttp://en.wikipedia.org/wiki/Parserhttp://en.wikipedia.org/wiki/Recursive_descenthttp://en.wikipedia.org/wiki/LL_parserhttp://en.wikipedia.org/wiki/Fuzzy_string_searchinghttp://en.wikipedia.org/wiki/Fuzzy_string_searchinghttp://en.wikipedia.org/wiki/LL_parserhttp://en.wikipedia.org/wiki/Recursive_descenthttp://en.wikipedia.org/wiki/Parserhttp://en.wikipedia.org/wiki/Compiler_directivehttp://en.wikipedia.org/wiki/UTF-8http://en.wikipedia.org/wiki/Unicodehttp://en.wikipedia.org/wiki/Deterministic_finite-state_machinehttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Formhttp://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Formhttp://en.wikipedia.org/wiki/L-attributed_grammarhttp://en.wikipedia.org/wiki/Compiler_generator
  • 8/3/2019 Semi Final Report

    19/50

    19

    the grammar for completeness, consistency, non-redundancy as well as for LL(1)

    conflicts.

    There are versions of Coco/R for most modern languages

    (Java, C#, C++, Pascal, Modula-2, Modula-3, Delphi, VB.NET, Python, Ruby and

    others). The latest versions from the University of Linz are those for C#, Java and C++.

    For the Java version, there is an Eclipse plug-in and for C#, a Visual Studio plug-in.

    There are also sample grammars for Java and C#. Coco/R was originally developed at

    the University of Linz and is distributed under the terms of a slightly relaxed GNU

    General Public License.

    2.2.4.Optimization

    Compiler optimization is the process of tuning the output of a compiler to minimize or

    maximize some attributes of an executable computer program. The most commonrequirement is to minimize the time taken to execute a program; a less common one is

    to minimize the amount ofmemory occupied. The growth ofportable computers has

    created a market for minimizing the power consumed by a program. Compiler

    optimization is generally implemented using a sequence of optimizing transformations,

    algorithms which take a program and transform it to produce a semantically equivalent

    output program that uses less resources.

    2.2.5.IPC

    In computing, Inter-process communication (IPC) is a set of methods for the exchange

    of data among multiple threads in one or more processes. Processes may be running on

    one or more computers connected by a network. IPC methods are divided into methods

    for message passing, synchronization, shared memory, and remote procedure

    calls (RPC). The method of IPC used may vary based on the bandwidth and latency of

    communication between the threads, and the type of data being communicated.

    There are several reasons for providing an environment that allows process

    cooperation:

    Information sharingSpeedupModularityConveniencePrivilege separationIPC may also be referred to as inter-thread communication and inter-application

    communication.

    The combination of IPC with the address space concept is the foundation for addressspace independence/isolation.

    http://en.wikipedia.org/wiki/Java_(programming_language)http://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/Pascal_(programming_language)http://en.wikipedia.org/wiki/Modula-2http://en.wikipedia.org/wiki/Modula-3http://en.wikipedia.org/wiki/CodeGear_Delphihttp://en.wikipedia.org/wiki/VB.NEThttp://en.wikipedia.org/wiki/Python_(programming_language)http://en.wikipedia.org/wiki/Ruby_(programming_language)http://en.wikipedia.org/wiki/University_of_Linzhttp://en.wikipedia.org/wiki/Eclipse_(software)http://en.wikipedia.org/wiki/Johannes_Kepler_University_of_Linzhttp://en.wikipedia.org/wiki/GNU_General_Public_Licensehttp://en.wikipedia.org/wiki/GNU_General_Public_Licensehttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Memory_(computers)http://en.wikipedia.org/wiki/Portable_computerhttp://en.wikipedia.org/wiki/Energy_conservationhttp://en.wikipedia.org/wiki/Computinghttp://en.wikipedia.org/wiki/Thread_(computer_science)http://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Computer_networkhttp://en.wikipedia.org/wiki/Message_passinghttp://en.wikipedia.org/wiki/Synchronization_(computer_science)http://en.wikipedia.org/wiki/Shared_memoryhttp://en.wikipedia.org/wiki/Remote_procedure_callhttp://en.wikipedia.org/wiki/Remote_procedure_callhttp://en.wikipedia.org/wiki/Privilege_separationhttp://en.wikipedia.org/wiki/Privilege_separationhttp://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Privilege_separationhttp://en.wikipedia.org/wiki/Remote_procedure_callhttp://en.wikipedia.org/wiki/Remote_procedure_callhttp://en.wikipedia.org/wiki/Shared_memoryhttp://en.wikipedia.org/wiki/Synchronization_(computer_science)http://en.wikipedia.org/wiki/Message_passinghttp://en.wikipedia.org/wiki/Computer_networkhttp://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Thread_(computer_science)http://en.wikipedia.org/wiki/Computinghttp://en.wikipedia.org/wiki/Energy_conservationhttp://en.wikipedia.org/wiki/Portable_computerhttp://en.wikipedia.org/wiki/Memory_(computers)http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/GNU_General_Public_Licensehttp://en.wikipedia.org/wiki/GNU_General_Public_Licensehttp://en.wikipedia.org/wiki/Johannes_Kepler_University_of_Linzhttp://en.wikipedia.org/wiki/Eclipse_(software)http://en.wikipedia.org/wiki/University_of_Linzhttp://en.wikipedia.org/wiki/Ruby_(programming_language)http://en.wikipedia.org/wiki/Python_(programming_language)http://en.wikipedia.org/wiki/VB.NEThttp://en.wikipedia.org/wiki/CodeGear_Delphihttp://en.wikipedia.org/wiki/Modula-3http://en.wikipedia.org/wiki/Modula-2http://en.wikipedia.org/wiki/Pascal_(programming_language)http://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/Java_(programming_language)
  • 8/3/2019 Semi Final Report

    20/50

    20

    2.2.6. Cross Compiler

    Across compileris acompilercapable of creatingexecutablecode for aplatformother

    than the one on which the compiler is run. Cross compiler toolsare used to generate

    executables forembedded systemor multiple platforms. It is used to compile for a

    platform upon which it is not feasible to do the compiling, likemicrocontrollersthat

    don't support anoperating system. It has become more common to use this tool

    forparavirtualizationwhere a system may have one or more platforms in use.

    2.2.7.Just-in-time compilation

    It is known as dynamic translation, is a method to improve the runtime performance

    ofcomputer programs. Historically, computer programs had two modes of runtime

    operation, either interpreted or static (ahead-of-time) compilation. Interpreted code is

    translated from a high-level language to a machine code continuously during every

    execution, whereas statically compiled code is translated into machine code before

    execution, and only requires this translation once.

    JIT compilers represent a hybrid approach, with translation occurring continuously, as

    with interpreters, but with caching of translated code to minimize performance

    degradation. It also offers other advantages over statically compiled code at

    development time, such as handling of late-bound data types and the ability to enforce

    security guarantees.JIT builds upon two earlier ideas in run-time

    environments: bytecode compilation and dynamic compilation. It converts code

    at runtime prior to executing it natively, for example bytecode into native machine

    code.Several modern runtime environments, such as Microsoft's .NET Frameworkand

    most implementations ofJava, rely on JIT compilation for high-speed code execution.

    2.2.8. MONO

    Mono is an open source implementation of the .NET framework, it contains a Mono C#

    compiler that is written in C# and can be run on several different operating systems

    such as Linux, UNIX, Mac OS X and Solaris. The concept of how it works is first theC# code gets compiled into MSIL then the Mono JIT translates the MSIL into native

    code at run time which is similar to as the original implementation of the .NET

    framework by Microsoft.

    Mono is a software platform designed to allow developers to easily create cross

    platform applications. Sponsored by Xamarin, Mono is an open source implementation

    of Microsoft's .NET Framework based on the ECMA standards for C# and

    the Common Language Runtime. A growing family of solutions and an active and

    enthusiastic contributing community is helping position Mono to become the leading

    choice for development of Linux applications.

    http://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Platform_(computing)http://en.wikipedia.org/wiki/Platform_(computing)http://en.wikipedia.org/wiki/Platform_(computing)http://en.wikipedia.org/wiki/Programming_toolhttp://en.wikipedia.org/wiki/Programming_toolhttp://en.wikipedia.org/wiki/Programming_toolhttp://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Paravirtualizationhttp://en.wikipedia.org/wiki/Paravirtualizationhttp://en.wikipedia.org/wiki/Paravirtualizationhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Interpreter_(computing)http://en.wikipedia.org/wiki/AOT_compilerhttp://en.wikipedia.org/wiki/Dynamic_compilationhttp://en.wikipedia.org/wiki/Run_time_(program_lifecycle_phase)http://en.wikipedia.org/wiki/Bytecodehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/.NET_Frameworkhttp://en.wikipedia.org/wiki/Java_(programming_language)http://www.xamarin.com/http://www.mono-project.com/ECMAhttp://www.mono-project.com/CSharp_Compilerhttp://www.mono-project.com/Mono:Runtimehttp://www.mono-project.com/Mono:Runtimehttp://www.mono-project.com/CSharp_Compilerhttp://www.mono-project.com/ECMAhttp://www.xamarin.com/http://en.wikipedia.org/wiki/Java_(programming_language)http://en.wikipedia.org/wiki/.NET_Frameworkhttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Bytecodehttp://en.wikipedia.org/wiki/Run_time_(program_lifecycle_phase)http://en.wikipedia.org/wiki/Dynamic_compilationhttp://en.wikipedia.org/wiki/AOT_compilerhttp://en.wikipedia.org/wiki/Interpreter_(computing)http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Paravirtualizationhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Programming_toolhttp://en.wikipedia.org/wiki/Platform_(computing)http://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Compiler
  • 8/3/2019 Semi Final Report

    21/50

    21

    2.3.Current Technologies

    2.3.1. COSMOS

    Cosmos(C# Open Source Managed Operating System) is an OS that is written entirely

    in C#, the OS makes use of IL2CPU which is an AOT(ahead-of-time) compiler that

    translates the CIL into machine code by outputting raw assembly files which then getprocessed through NASM(Netwide Assembler).

    The operating system is compiled together with a user program and associated libraries

    using IL2CPU to create a bootable standalone native binary. The binary can be booted

    from a floppy disk, USB flash drive, CD-ROM, over the network using PXE booting,

    or inside a virtual machine. The currently supported architecture is x86, with more

    planned, and although the system is aimed at C#, it can be used with most .NET

    compliant languages (requirements are that the language must compile to

    pure CIL without usingP/Invokes). Cosmos is primarily intended for use

    with Microsoft's .NET Framework, but Mono support is also in the works.

    Cosmos uses Syslinux as a bootloader. Syslinux is not used other than to load a

    secondary Cosmos boot loader. After that point, Cosmos runs on its own with no

    support from Syslinux or the BIOS.[5]

    2.3.2. Singularity

    is an experimental operating system being built by Microsoft Research since 2003. It is

    intended as a highly-dependable OS in which the kernel, device drivers, and

    applications are all written in managed code.

    Working-

    The lowest-level x86 interrupt dispatch code is written in assembly language and C.

    Once this code has done its job, it invokes the kernel, whose runtime and garbage

    collector are written in Sing# (an extended version ofSpec#, itself an extension ofC#)

    and runs in unprotected mode. The hardware abstraction layer is written in C++ and

    runs in protected mode. There is also some C code to handle debugging. The

    computer's BIOS is invoked during the 16-bit real mode bootstrap stage; once in 32-bit

    mode, Singularity never invokes the BIOS again, but invokes device drivers written

    in Sing#. During installation, Common Intermediate Language (CIL) opcodes are

    compiled into x86 opcodes using the Bartok compiler.

    Security design:-Singularity is a microkernel operating system. Unlike most historical

    microkernels, its components execute in the same address space(process), which

    contains "software-isolated processes" (SIPs). Each SIP has its own data and code

    layout, and is independent from other SIPs. These SIPs behave like normal processes,

    but avoid the cost of task-switches.

    http://en.wikipedia.org/wiki/IL2CPU_(compiler)http://en.wikipedia.org/wiki/Floppy_diskhttp://en.wikipedia.org/wiki/USB_flash_drivehttp://en.wikipedia.org/wiki/CD-ROMhttp://en.wikipedia.org/wiki/Virtual_machinehttp://en.wikipedia.org/wiki/List_of_CLI_languageshttp://en.wikipedia.org/wiki/List_of_CLI_languageshttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/P/Invokehttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/.NET_Frameworkhttp://en.wikipedia.org/wiki/Mono_(software)http://en.wikipedia.org/wiki/Syslinuxhttp://en.wikipedia.org/wiki/Bootloaderhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Microsoft_Researchhttp://en.wikipedia.org/wiki/Dependabilityhttp://en.wikipedia.org/wiki/Kernel_(computer_science)http://en.wikipedia.org/wiki/Device_driverhttp://en.wikipedia.org/wiki/Managed_codehttp://en.wikipedia.org/wiki/X86_architecturehttp://en.wikipedia.org/wiki/Interrupthttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/C_(programming_language)http://en.wikipedia.org/wiki/Run-time_systemhttp://en.wikipedia.org/wiki/Garbage_collection_(computer_science)http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)http://en.wikipedia.org/wiki/Sing_sharphttp://en.wikipedia.org/wiki/Spec_Sharphttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/Hardware_abstraction_layerhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/BIOShttp://en.wikipedia.org/wiki/Real_modehttp://en.wikipedia.org/wiki/Sing_sharphttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Opcodehttp://en.wikipedia.org/wiki/Bartok_(compiler)http://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Address_spacehttp://en.wikipedia.org/wiki/Microkernelhttp://en.wikipedia.org/wiki/Bartok_(compiler)http://en.wikipedia.org/wiki/Opcodehttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Sing_sharphttp://en.wikipedia.org/wiki/Real_modehttp://en.wikipedia.org/wiki/BIOShttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/Hardware_abstraction_layerhttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/Spec_Sharphttp://en.wikipedia.org/wiki/Sing_sharphttp://en.wikipedia.org/wiki/Garbage_collection_(computer_science)http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)http://en.wikipedia.org/wiki/Run-time_systemhttp://en.wikipedia.org/wiki/C_(programming_language)http://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Interrupthttp://en.wikipedia.org/wiki/X86_architecturehttp://en.wikipedia.org/wiki/Managed_codehttp://en.wikipedia.org/wiki/Device_driverhttp://en.wikipedia.org/wiki/Kernel_(computer_science)http://en.wikipedia.org/wiki/Dependabilityhttp://en.wikipedia.org/wiki/Microsoft_Researchhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Bootloaderhttp://en.wikipedia.org/wiki/Syslinuxhttp://en.wikipedia.org/wiki/Mono_(software)http://en.wikipedia.org/wiki/.NET_Frameworkhttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/P/Invokehttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/List_of_CLI_languageshttp://en.wikipedia.org/wiki/List_of_CLI_languageshttp://en.wikipedia.org/wiki/Virtual_machinehttp://en.wikipedia.org/wiki/CD-ROMhttp://en.wikipedia.org/wiki/USB_flash_drivehttp://en.wikipedia.org/wiki/Floppy_diskhttp://en.wikipedia.org/wiki/IL2CPU_(compiler)
  • 8/3/2019 Semi Final Report

    22/50

    22

    Protection in this system is provided by a set of rules called invariants that are verified

    by static analysis. For example, in the memory-invariant states there must be no cross-

    references (or memory pointers) between two SIPs; communication between SIPs

    occurs via higher-order communication channels managed by the operating system.

    Invariants are checked during installation of the application. (In Singularity, installation

    is managed by the operating system.)

    Most of the invariants rely on the use of safer memory-managed languages, such as

    Sing#, which have a garbage collector, allow no arbitrary pointers, and allow code to be

    verified to meet a certain policy.[2]

    2.3.3.Sharp Operating System

    SharpOSwas anopen source.NET-C#based operating systemthat was developed by a

    group of volunteers and presided over by a team of six project administrators (Mircea-CristianRacasan, Bruce Markham, Johann MacDonagh, Sander van Rossen, Jae Hyun

    and William Lahti). It is no longer in active development, and resources have been

    moved to theMOSAproject. This operating system is only one of twoC#based

    operating systemsreleased under anopen sourcelicense.SharpOS has only one public

    version availableand a basiccommand line interface.[1]

    2.3.4.Symbian

    It is a mobile operating system (OS written in C++) and computing platform designed

    for smart phones and currently maintained by Nokia. It is an operating system that

    controls a mobile device or information appliancesimilar in principle to an operating

    system such as Windows, Mac OS X, or Linux distributions that controls a desktop

    computer or laptop. However, they are currently somewhat simpler and more oriented

    towards application use. Basically designed to increase the performance of applications.

    http://en.wikipedia.org/wiki/Invariant_(computer_science)http://en.wikipedia.org/wiki/Static_code_analysishttp://en.wikipedia.org/wiki/Memory_managementhttp://en.wikipedia.org/wiki/Garbage_collection_(computer_science)http://en.wikipedia.org/wiki/Computer_security_policyhttp://en.wikipedia.org/wiki/Open_sourcehttp://en.wikipedia.org/wiki/Open_sourcehttp://en.wikipedia.org/wiki/.NET_Frameworkhttp://en.wikipedia.org/wiki/.NET_Frameworkhttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/MOSAhttp://en.wikipedia.org/wiki/MOSAhttp://en.wikipedia.org/wiki/MOSAhttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/Operating_Systemhttp://en.wikipedia.org/wiki/Operating_Systemhttp://en.wikipedia.org/wiki/Open_sourcehttp://en.wikipedia.org/wiki/Open_sourcehttp://en.wikipedia.org/wiki/Open_sourcehttp://en.wikipedia.org/wiki/Command_line_interfacehttp://en.wikipedia.org/wiki/Command_line_interfacehttp://en.wikipedia.org/wiki/Mobile_operating_systemhttp://en.wikipedia.org/wiki/Computing_platformhttp://en.wikipedia.org/wiki/Smartphonehttp://en.wikipedia.org/wiki/Nokiahttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Mobile_devicehttp://en.wikipedia.org/wiki/Information_appliancehttp://en.wikipedia.org/wiki/Microsoft_Windowshttp://en.wikipedia.org/wiki/Mac_OS_Xhttp://en.wikipedia.org/wiki/Linux_distributionshttp://en.wikipedia.org/wiki/Desktop_computerhttp://en.wikipedia.org/wiki/Desktop_computerhttp://en.wikipedia.org/wiki/Laptophttp://en.wikipedia.org/wiki/Laptophttp://en.wikipedia.org/wiki/Desktop_computerhttp://en.wikipedia.org/wiki/Desktop_computerhttp://en.wikipedia.org/wiki/Linux_distributionshttp://en.wikipedia.org/wiki/Mac_OS_Xhttp://en.wikipedia.org/wiki/Microsoft_Windowshttp://en.wikipedia.org/wiki/Information_appliancehttp://en.wikipedia.org/wiki/Mobile_devicehttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Nokiahttp://en.wikipedia.org/wiki/Smartphonehttp://en.wikipedia.org/wiki/Computing_platformhttp://en.wikipedia.org/wiki/Mobile_operating_systemhttp://en.wikipedia.org/wiki/Command_line_interfacehttp://en.wikipedia.org/wiki/Open_sourcehttp://en.wikipedia.org/wiki/Operating_Systemhttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/MOSAhttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)http://en.wikipedia.org/wiki/.NET_Frameworkhttp://en.wikipedia.org/wiki/Open_sourcehttp://en.wikipedia.org/wiki/Computer_security_policyhttp://en.wikipedia.org/wiki/Garbage_collection_(computer_science)http://en.wikipedia.org/wiki/Memory_managementhttp://en.wikipedia.org/wiki/Static_code_analysishttp://en.wikipedia.org/wiki/Invariant_(computer_science)
  • 8/3/2019 Semi Final Report

    23/50

    23

    CHAPTER 3

    PROBLEMFORMULATION

  • 8/3/2019 Semi Final Report

    24/50

    24

    3. Problem Formulation

    3.1. Problem Statement

    A general purpose OS makes use of all available resources for any application.

    However every application does not require all resources. Simple tasks like playingmusic or editing a text require only few resources. Also some mission-critical

    applications are resource-intensive. They require only a few particular resources and

    high performance is their main objective. Examples of those application domains are

    database systems, high performance applications and scientific applications. In such a

    case the other resources are unnecessary and only increase the cost overhead and lead

    to wastage of resources. Thus this arise a need to develop an operating system that is

    specific to only a particular application so that a high level of performance is obtained

    with efficient and optimum use of available resources to bring down the cost overheads.

    Many operating systems available in the market are in low level language. So they lack

    the certain features like easy maintainability and readability. Another drawback is that

    many operating systems are architecture dependent and others which are architecture

    independent are written for all the architecture leading to the large codes. So the need is

    to make the operating system that can provide the solution to all the problems defined

    above.

    Our Operating System will serve the purpose as it will provide secure environment to

    its user as it will be configured for a particular application only. So does not provide

    any loopholes or backdoor to the hackers. It comprises with the feature of portability

    with respect to hardware and architecture. This operating system is not confined to a

    single system but can be used in the network comprising of large number of system i.e.

    it is scalable. The use of high level language will serve the purpose of easymaintainability and readability. The use of LLVM makes it architecture independent as

    it generates the independent code.

    Thus we look forward to developing an operating system that would be specific to only

    a particular application so that high performance can be delivered for that particular

    application and resource wastage can be minimized. The operating system will be self

    managed and architecture independent.

    3.2. Objectives

    i. Performance: Our operating system should exceed the performance of other

    operating systems and make optimum use of resources available

    ii. Ease of use: Users should find our operating system simple to use or they may opt

    not to use it at all.

    iii. Security: The operating system should offer strong enough security against many

    trivial and moderately sophisticated attacks; its design should not be complicated by the

    desire to protect against very sophisticated attacks.

  • 8/3/2019 Semi Final Report

    25/50

    25

    iv. Scalability: The operating system should be scalable means it could be used for

    small applications as well for large applications depending upon the need accordingly

    v. Portability: The operating system should be portable means it should be architecture

    independent.

    3.3 Uses & Benefits

    Following are the key benefits pertaining to society & science that may be reaped by

    organizations as well as SOHO (Small Office/Home Office) users and home users by

    using this application specific operating system:

    1) Efficient utilization of resources because it uses resources specific only to a

    particular application.

    2) Secure environment for an application since only a single application runs on thesystem and no other scripts are supported.

    3) High performance delivery because all resources are allocated to one application

    itself.

    4) Low maintenance cost.

    5) It can be used by organizations to develop applications specific to their needs only.

    Example: banking solutions, business analysis and management, database

    management, scientific applications which focus on one problem domain at a time

    etc.

    6) It provides a secure environment so it can be used for applications that deal with

    confidential data and need protection from unauthorised use.

    7) It can also be used by small/home users to efficiently perform simple tasks like

    watching movie, browsing internet, file management etc without any resource

    wastage.

    3.4. REQUIREMENT

    The application specific operating system will meet the following requirements:

    3.4.1. Functional Requirements:

    i) The operating system should provide a secure environment for an application. No

    arbitrary code should be allowed to run on an application .It should be compiled

    with the operating system before it can run. Thus it prevents the system against

    unauthorised users or hackers who try to run unauthorised scripts on the system to

    gain unauthorised access to the system.

  • 8/3/2019 Semi Final Report

    26/50

    26

    ii) The operating system should be run on bare hardware.

    iii) The operating system should run single application in a user space at a time hence it

    should use only those resources that are required for that particular application thus

    minimizing wastage of resources.

    iv)It should be hardware portable make use of LLVM tool (Low Level virtualmachine) which converts a bit code into a machine code that can be used on any

    architecture like x86 architecture, x64 architecture, ARM, PPC & MIPS architecture.

    v) It should not provide support for dynamic loadable device driver(Device driver

    cannot be loaded at run time).

    vi) To configure the operating system for a particular application only minor change

    has to be made in the source code thus increasing the pace of development so that it

    suits the need of the newly configured application.

    vii) The operating system should have an option of running entirely in the main

    memory (RAM) i.e. diskless mode which means there is no ROM and the

    application is small enough to run in main memory only. This reduces memory

    space requirement.

    viii) The operating system should be able to automatically adjust and reconfigure itself

    automatically if any new module is added to an existing set of modules. For

    example, if this operating system is used for a network application then if any new

    router is added to the network it should automatically get configured accordingly.

    ix)The operating system should provide backhand which could be used in future

    applications by making modifications accordingly. It should be free from extra

    overheads of maintenance.

    3.4.2. Non Functional Requirements:

    i) The operating system shall provide a high degree of performance for the application

    for which it is configured because it will allocate all the required resources to that

    application only.

    ii) The operating system shall be scalable. Scalability is the ability of a system,

    network, or process, to handle growing amounts of work or its ability to be enlarged

    to accommodate growth. For example, if a system is used for a network application

    then it can easily manage a single user and adjust itself to the size of the network as

    more systems get added or removed from the network.

    iii) The operating system shall be easy to use, run and maintain.

  • 8/3/2019 Semi Final Report

    27/50

    27

    3.5. FEASIBILITY STUDY

    3.5.1. Preliminary Work Done

    We have taken Introduction to Computer Programming, Introduction to computer

    Programming Lab, Algorithms, Operating Systems, Operating Systems Lab, Systemand Network Programming Lab. We have done Socket programming, Sun RPC and

    have gained information which is crucial for completing this project successfully.

    Knowledge gained through study and practical of these subjects will help us implement

    our project.

    3.5.2. Resources Available

    In terms of input we need:

    Hardware Systems: We need any PC (a computer) whose configuration could be

    anything close to

    RAM: 3.00GB Hard Disk: 40 GB and above Processor: Intel Core 2 Duo CPU Peripheral devices: Monitor, Keyboard, MouseSoftware Tools:

    1) Low level virtual machine (LLVM): - Low Level Virtual Machine (LLVM) is a

    compiler infrastructure that consists of two primary components, an optimizer and a

    code generator. It is designed so that optimizations of programs can occur at

    different phases of the program life such as compile-time, link-time and run-time.

    2) MONO: - software platform designed to allow developers to easily create cross

    platform applications. It is an open source implementation of Microsoft's .Net

    Framework.

    3)QEMU: - a common emulator that provides dynamic binary translation and can runmany unmodified guest operating systems on many different architectures from

    x86_64 to MIPS and PowerPC. Guest operating system is an operating system that is

    running in a virtualized environment.

    All the required resources are available in order to implement our project, i.e. the

    knowledge about operating system concepts, coding in C# and C, knowledge of System

    Programming, device drivers and optimization techniques.

    We have required OS and compiler installed on our computers so that we can go ahead

    for the project. For the information about the latter, we have various books, Articles and

    http://www.phoronix.com/scan.php?page=news_item&px=OTM0MQhttp://www.phoronix.com/scan.php?page=news_item&px=OTM0MQ
  • 8/3/2019 Semi Final Report

    28/50

    28

    Research Paper with us, and also the faculty members and the project led by our project

    guide.

    Resource Availability Index (RAI):-

    As per our knowledge, we can rank the resources available as 0.80 on the scale of 0 to 1

    3.5.3 Confidence Factor

    0

  • 8/3/2019 Semi Final Report

    29/50

    29

    Thus to calculate the confidence factor (CF)

    CF= avg (0.8, 0.7, 0.8)

    CF= 0.77Therefore, the confidence factor, until now, can be considered to be 0.77 on a scale of 0

    to 1.

    3.5.4. CAPABILITY INDEX (CI)

    This denotes the ability required to synergize the resources available. Since we are now

    equipped with all the basic concepts and tools involved, we believe synergizing the

    requirements into a basic design, and this design into a good code will not be difficult

    for us. Therefore, according to us, our capability index at this point of time can be said

    to be of the rank 0.6, on a scale of 0 to 1.

    CI= RAI * CF

    CAPABILITY INDEX (CI) = (0.80 * 0.77)

    CI= 0.616

    3.5.5.RELATIVE SIGNIFICANCE FACTOR (RSF)

    0

  • 8/3/2019 Semi Final Report

    30/50

    30

    Technology4: Bit Code

    RSF4=8

    RSF=avg(8,9,7,8)

    RSF=8

    3.5.6.Viability Index (VI)

    0

  • 8/3/2019 Semi Final Report

    31/50

    31

    3.5.8.System Integration Factor (SIF)

    0

  • 8/3/2019 Semi Final Report

    32/50

    32

    3.5.10. Inadequacy Parameter(IP)

    IP = (1-CI)* RSFavg

    RSF avg = (9 + 8 + 8) / 3

    RSF avg = 8.3

    IP = ( 1-0.616) * 8.3

    IP = 3.18This represents that inadequacy in project is very less.

    3.6. Scope of Work

    We propose to develop the application specific and managed operating system in C#.

    The operating system will be in C# which is a high level language and will help to

    make the operating system to be the managed code by providing features like garbage

    collection etc. The use of LLVM as the compiler will help us to develop the

    architecture independent code means the byte code will be architecture independent.

    This operating system will offer stronger security as it will not provide any back door to

    the hackers to run other scripts in operating systems. The use of LLVM will provide the

    high level of optimisat