Cosmos (operating system)
Encyclopedia
Cosmos is an open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 written in C#. It also encompasses a compiler (IL2CPU
IL2CPU (compiler)
IL2CPU is an AOT compiler that is written using a Common Intermediate Language compliant language . It translates Common Intermediate Language to machine code. IL2CPU is the primary component of the Cosmos Project, and is developed by the same team.- See also :* Cosmos* .NET Framework* Bartok*...

) for converting Common Intermediate Language
Common Intermediate Language
Common Intermediate Language is the lowest-level human-readable programming language defined by the Common Language Infrastructure specification and is used by the .NET Framework and Mono...

 (.NET) bytecode into native instructions. The operating system is compiled together with a user program and associated libraries using IL2CPU
IL2CPU (compiler)
IL2CPU is an AOT compiler that is written using a Common Intermediate Language compliant language . It translates Common Intermediate Language to machine code. IL2CPU is the primary component of the Cosmos Project, and is developed by the same team.- See also :* Cosmos* .NET Framework* Bartok*...

 to create a bootable standalone native binary. The binary can be booted from a floppy disk
Floppy disk
A floppy disk is a disk storage medium composed of a disk of thin and flexible magnetic storage medium, sealed in a rectangular plastic carrier lined with fabric that removes dust particles...

, USB flash drive
USB flash drive
A flash drive is a data storage device that consists of flash memory with an integrated Universal Serial Bus interface. flash drives are typically removable and rewritable, and physically much smaller than a floppy disk. Most weigh less than 30 g...

, CD-ROM
CD-ROM
A CD-ROM is a pre-pressed compact disc that contains data accessible to, but not writable by, a computer for data storage and music playback. The 1985 “Yellow Book” standard developed by Sony and Philips adapted the format to hold any form of binary data....

, over the network using PXE booting, or inside a virtual machine
Virtual machine
A virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...

. 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
Common Intermediate Language
Common Intermediate Language is the lowest-level human-readable programming language defined by the Common Language Infrastructure specification and is used by the .NET Framework and Mono...

 without using P/Invokes). Cosmos is primarily intended for use with Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

's .NET Framework
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

, but Mono
Mono (software)
Mono, pronounced , is a free and open source project led by Xamarin to create an Ecma standard compliant .NET-compatible set of tools including, among others, a C# compiler and a Common Language Runtime....

 support is also in the works.

According to the Cosmos website, Cosmos is a backronym
Backronym
A backronym or bacronym is a phrase constructed purposely, such that an acronym can be formed to a specific desired word. Backronyms may be invented with serious or humorous intent, or may be a type of false or folk etymology....

 for C# Open Source Managed Operating System, in that the name was chosen before the meaning. Cosmos does not currently aim to become a full operating system, but rather a toolkit to allow other developers to simply and easily build their own operating systems, or as one of the project leaders put it, to act as "operating system Lego
Lego
Lego is a line of construction toys manufactured by the Lego Group, a privately held company based in Billund, Denmark. The company's flagship product, Lego, consists of colorful interlocking plastic bricks and an accompanying array of gears, minifigures and various other parts...

s". It also functions as an abstraction layer, hiding much of the inner workings of the hardware from the eventual developer.

Milestone 5 was released in August 2010 and work on future releases is well underway. Most work on Cosmos is currently aimed at the debugger and Visual Studio integration. Kernel work is focused on file systems and developing a network interface for the system, with the system already supporting some network cards and some of the features of TCP/IP. Two versions of Cosmos are currently available, the (more up-to-date) source code version and the release version (known as the User Kit). The source version is intended for anyone who wants to help develop the kernel
Kernel (computing)
In computing, the kernel is the main component of most computer operating 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...

 while the user kit is designed for anyone who just wants to use Cosmos to develop their own operating system.

Cosmos uses Syslinux
SYSLINUX
The SYSLINUX Project is a suite of lightweight IBM PC MBR bootloaders for starting up computers with the Linux kernel. It is the work of H. Peter Anvin, and consists of several separate systems, the best-known of which is ISOLINUX.-List:...

 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.

Writing Cosmos code

An operating system built on Cosmos begins life as a .NET
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

 project (specifically a console application
Console application
A console application is a computer program designed to be used via a text-only computer interface, such as a text terminal, the command line interface of some operating systems or the text-based interface included with most Graphical User Interface operating systems, such as the Win32 console in...

). The developer first adds special pieces of code which allow the Cosmos system to be compiled and run. The user adds the following code to the application's Main method:

Cosmos.Compiler.Builder.BuildUI.Run

This code opens the Cosmos Builder Window, which is used by the developer to compile the code into machine opcode
Opcode
In computer science engineering, an opcode is the portion of a machine language instruction that specifies the operation to be performed. Their specification and format are laid out in the instruction set architecture of the processor in question...

. It is called when the .NET application is run, but is excluded from the eventual operating system.

The developer then adds a new method to the Program class, called Init. The method goes as follows:

public static void Init
{
Cosmos.Sys.Boot xBoot = new Cosmos.Sys.Boot;
xBoot.Execute;
//Add further code here...
}

This method is the first to be called when the operating system is booted. The first two lines set up the system, loading drivers and preparing the machine. In a practical operating system, the developer would replace //Add further code here... with the code of his/her own operating system. This code can use any objects in the .NET Framework library that are supported by Cosmos (either a translation of the object into machine code has been created, or every part of it is already supported). It may also call any of Cosmos' built-in public libraries.

The Cosmos User Kit and Visual Studio

The Cosmos User Kit is a part of Cosmos designed to make Cosmos easier to use for developers using Microsoft Visual Studio
Microsoft Visual Studio
Microsoft Visual Studio is an integrated development environment from Microsoft. It is used to develop console and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all...

. When installed, the user kit adds a new project type to Visual Studio, called a Cosmos Project. This is a modified version of a console application, with the Cosmos compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

 and bootup stub code already added.

Compiling a project

Once the code is complete, a user would compile the project using their preferred .NET compiler. This converts the application from the original source code (C# or otherwise) into Common Intermediate Language
Common Intermediate Language
Common Intermediate Language is the lowest-level human-readable programming language defined by the Common Language Infrastructure specification and is used by the .NET Framework and Mono...

 (CIL), the native language of the .NET Framework. Next the application is run, showing the Cosmos Builder Window, which presents the developer with options which determine exactly how the project is compiled. These options include how to boot the project - via emulators such as QEMU
QEMU
QEMU is a processor emulator that relies on dynamic binary translation to achieve a reasonable speed while being easy to port on new host CPU architectures....

, Virtual PC
Microsoft Virtual PC
Windows Virtual PC is a virtualization program for Microsoft Windows. In July 2006 Microsoft released the Windows-hosted version as a free product...

 and VMWare
VMware
VMware, Inc. is a company providing virtualization software founded in 1998 and based in Palo Alto, California, USA. The company was acquired by EMC Corporation in 2004, and operates as a separate software subsidiary ....

, writing to a disk image
Disk image
A disk image is a single file or storage device containing the complete contents and structure representing a data storage medium or device, such as a hard drive, tape drive, floppy disk, CD/DVD/BD, or USB flash drive, although an image of an optical disc may be referred to as an optical disc image...

 (ISO) file that can later be written to a CD-ROM
CD-ROM
A CD-ROM is a pre-pressed compact disc that contains data accessible to, but not writable by, a computer for data storage and music playback. The 1985 “Yellow Book” standard developed by Sony and Philips adapted the format to hold any form of binary data....

, or via PXE
Preboot Execution Environment
The Preboot eXecution Environment is an environment to boot computers using a network interface independently of data storage devices or installed operating systems.PXE was introduced as part of the Wired for Management framework by Intel and is described in the specification The Preboot...

 network booting - as well as debug options using Cosmos' built-in debugger
Debugger
A debugger or debugging tool is a computer program that is used to test and debug other programs . The code to be examined might alternatively be running on an instruction set simulator , a technique that allows great power in its ability to halt when specific conditions are encountered but which...

, and other options.

When the user has chosen their desired options, they press the Build button. This invokes the IL2CPU
IL2CPU (compiler)
IL2CPU is an AOT compiler that is written using a Common Intermediate Language compliant language . It translates Common Intermediate Language to machine code. IL2CPU is the primary component of the Cosmos Project, and is developed by the same team.- See also :* Cosmos* .NET Framework* Bartok*...

 compiler which systematically scans through all of the applications CIL code (excluding the Cosmos compiler code), converting it into assembly language
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...

 for the selected processor architecture. (Currently only x86 is supported.) Next, Cosmos invokes the selected assembler to convert this assembly language code into native CPU opcode
Opcode
In computer science engineering, an opcode is the portion of a machine language instruction that specifies the operation to be performed. Their specification and format are laid out in the instruction set architecture of the processor in question...

. Finally, the desired output option is activated, be this starting an emulator, starting a PXE engine, or producing an ISO disk image
Disk image
A disk image is a single file or storage device containing the complete contents and structure representing a data storage medium or device, such as a hard drive, tape drive, floppy disk, CD/DVD/BD, or USB flash drive, although an image of an optical disc may be referred to as an optical disc image...

 file from the binary code
Binary code
A binary code is a way of representing text or computer processor instructions by the use of the binary number system's two-binary digits 0 and 1. This is accomplished by assigning a bit string to each particular symbol or instruction...

 opcode.

Virtualization

Cosmos allows the user to boot their operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 in an emulated environment using a virtual machine
Virtual machine
A virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...

. This lets the developer test the system on their own computer without having to reboot, giving the advantages of requiring no extra hardware nor requiring the developer to leave their development environment
Integrated development environment
An integrated development environment is a software application that provides comprehensive facilities to computer programmers for software development...

. To allow this, Cosmos makes use of three emulators. QEMU
QEMU
QEMU is a processor emulator that relies on dynamic binary translation to achieve a reasonable speed while being easy to port on new host CPU architectures....

, the default boot option, is a free emulator that comes pre-loaded with Cosmos. VMWare
VMware
VMware, Inc. is a company providing virtualization software founded in 1998 and based in Palo Alto, California, USA. The company was acquired by EMC Corporation in 2004, and operates as a separate software subsidiary ....

 is another emulator that can be downloaded from the VMWare website, with both free and paid versions available. Virtual PC
Microsoft Virtual PC
Windows Virtual PC is a virtualization program for Microsoft Windows. In July 2006 Microsoft released the Windows-hosted version as a free product...

 is another free emulator that can be downloaded from Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

's website http://www.microsoft.com/downloads/details.aspx?FamilyId=04D26402-3199-48A3-AFA2-2DC0B40A73B6&displaylang=en. As well as these emulators, the compile to disk image option allows a Cosmos project to be booted in any emulator that allows booting from disk images.

Another feature available with QEMU is the Cosmos debugger
Debugger
A debugger or debugging tool is a computer program that is used to test and debug other programs . The code to be examined might alternatively be running on an instruction set simulator , a technique that allows great power in its ability to halt when specific conditions are encountered but which...

 which allows the user to step through source code like in Visual Studio
Microsoft Visual Studio
Microsoft Visual Studio is an integrated development environment from Microsoft. It is used to develop console and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all...

 while running their OS in QEMU. This works by adding code into the operating system, which communicates with the Cosmos debugger via a virtual network
Virtual network
A virtual network is a computer network that consists, at least in part, of virtual network links. A virtual network link is a link that does not consist of a physical connection between two computing devices but is implemented using methods of network virtualization.The two most common forms of...

.

Disk images

This option writes the operating system to a disk image
Disk image
A disk image is a single file or storage device containing the complete contents and structure representing a data storage medium or device, such as a hard drive, tape drive, floppy disk, CD/DVD/BD, or USB flash drive, although an image of an optical disc may be referred to as an optical disc image...

 (ISO) file, which can be loaded into some emulators (such as Virtual PC
Microsoft Virtual PC
Windows Virtual PC is a virtualization program for Microsoft Windows. In July 2006 Microsoft released the Windows-hosted version as a free product...

) or written to a CD-ROM
CD-ROM
A CD-ROM is a pre-pressed compact disc that contains data accessible to, but not writable by, a computer for data storage and music playback. The 1985 “Yellow Book” standard developed by Sony and Philips adapted the format to hold any form of binary data....

 and booted on real hardware.

PXE network boot

This option allows the operating system to be booted on real hardware. The data is sent via a LAN
Län
Län and lääni refer to the administrative divisions used in Sweden and previously in Finland. The provinces of Finland were abolished on January 1, 2010....

 network to the client machine. This requires two computers - one as the client machine (on which the OS is booted) and one as the server (usually the development machine). It also requires a network connecting the two computers, and the client machine must have a network card
Network card
A network interface controller is a computer hardware component that connects a computer to a computer network....

 and BIOS
BIOS
In IBM PC compatible computers, the basic input/output system , also known as the System BIOS or ROM BIOS , is a de facto standard defining a firmware interface....

 that is capable of PXE booting.

Cosmos assembler

The Cosmos Project team have also created an assembler that is eventually designed to become the main assembler for the Cosmos system. However, the assembler is as of yet inefficient and slow, and so the NASM assembler is used instead.

See also

  • IL2CPU
  • .NET Framework
    .NET Framework
    The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

  • Mono (software)
    Mono (software)
    Mono, pronounced , is a free and open source project led by Xamarin to create an Ecma standard compliant .NET-compatible set of tools including, among others, a C# compiler and a Common Language Runtime....

  • SharpOS
    SharpOS (operating system)
    SharpOS was an open source .NET-C# based operating system that was developed by a group of volunteers and presided over by a team of six project administrators . It is no longer in active development, and resources have been moved to the MOSA project...

  • Singularity
    Singularity (operating system)
    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.- Workings :...

  • Phantom OS
    Phantom OS
    Phantom OS is an operating system mostly made by Russian programmers.Phantom OS is based on a concept of persistent virtual memory, and is managed-code oriented. Phantom OS is one of a few OSes that are not based on classical concepts of UNIX-like systems...


External links


News coverage

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK