Cosmos (operating system)

Cosmos (operating system)
Cosmos
Cosmos Logo
Cosmos Test Shell
Screenshot of a Cosmos test shell booted in QEMU
Company / developer Cosmos Project
Working state Publicly released/under development
Source model Open source
Kernel type Microkernel
License BSD
Official website cosmos.codeplex.com

Cosmos is an open source operating system written in C#. It also encompasses a compiler (IL2CPU) for converting Common Intermediate Language (.NET) bytecode into native instructions. 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 using P/Invokes). Cosmos is primarily intended for use with Microsoft's .NET Framework, but Mono support is also in the works.

According to the Cosmos website, Cosmos is a backronym 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 Legos". 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 while the user kit is designed for anyone who just wants to use Cosmos to develop their own operating system.

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.

Contents

Writing Cosmos code

Cosmos Builder UI

An operating system built on Cosmos begins life as a .NET project (specifically a console application). 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. 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. 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 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 (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, Virtual PC and VMWare, writing to a disk image (ISO) file that can later be written to a CD-ROM, or via PXE network booting - as well as debug options using Cosmos' built-in debugger, and other options.

When the user has chosen their desired options, they press the Build button. This invokes the IL2CPU compiler which systematically scans through all of the applications CIL code (excluding the Cosmos compiler code), converting it into assembly language 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. Finally, the desired output option is activated, be this starting an emulator, starting a PXE engine, or producing an ISO disk image file from the binary code opcode.

Debug options

Cosmos offers several options as to how to debug the output.

Virtualization

Default Cosmos boot screen as seen in QEMU.

Cosmos allows the user to boot their operating system in an emulated environment using a virtual machine. 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. To allow this, Cosmos makes use of three emulators. QEMU, the default boot option, is a free emulator that comes pre-loaded with Cosmos. VMWare is another emulator that can be downloaded from the VMWare website, with both free and paid versions available. Virtual PC is another free emulator that can be downloaded from Microsoft's website [1]. 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 which allows the user to step through source code like in Visual Studio 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.

Disk images

This option writes the operating system to a disk image (ISO) file, which can be loaded into some emulators (such as Virtual PC) or written to a CD-ROM 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 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 and BIOS 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

External links

News coverage


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Singularity (operating system) — For other uses of Singularity , see Singularity (disambiguation). Singularity Project Singularity after boot up. Company / developer Microsoft Corporation Programmed in Assembly language, C …   Wikipedia

  • SharpOS (operating system) — Infobox OS name = SharpOS caption = SharpOS v0.0.0.75 developer = SharpOS Project family = .NET C# cite web |url=http://www.sharpos.org/redmine/wiki/3/About SharpOS |title=SharpOS Info About SharpOS |accessdate=2008 04 13 |format=HTML… …   Wikipedia

  • Ensemble (operating system) — Infobox OS name = Ensemble caption = Ensemble developer = Ensemble Project family = .NET C# cite web |url=http://www.ensemble os.org/wiki/core/About Ensemble |title=About Ensemble |accessdate=2008 08 06 |format=HTML |work=Ensemble] supported… …   Wikipedia

  • Pick operating system — Company / developer Don Nelson, Dick Pick, TRW Programmed in Assembly language Initial release 1965 (GIRLS), 1973 (Reality Operating System) Marketing target Business data processing Available …   Wikipedia

  • Cosmos (disambiguation) — Cosmos generally refers to an orderly or harmonious system, and is used as a synonym for Universe when emphasizing that the universe is governed by an orderly system of physical laws; this usage originated with the philosopher Pythagoras in the… …   Wikipedia

  • Cosmos (операционная система) — Cosmos …   Википедия

  • system — systemless, adj. /sis teuhm/, n. 1. an assemblage or combination of things or parts forming a complex or unitary whole: a mountain system; a railroad system. 2. any assemblage or set of correlated members: a system of currency; a system of… …   Universalium

  • COSMOS (Spriggan) — Infobox comics organization name=COSMOS imagesize= caption= COSMOS Soldiers publisher=flagicon|Japan Shogakukan flagicon|Canada flagicon|United States VIZ Media (Defunct) flagicon|France Glenat (Defunct) flagicon|Germany Planet Manga… …   Wikipedia

  • system — n 1. order, organization, arrangement, disposition, structure, setup, layout, line up. 2. process, procedure, method, methodology, technique; attack, tack, approach; way, wise, means, mode, fashion, style, ways and means; wont, custom, practice,… …   A Note on the Style of the synonym finder

  • Operations support system — Operations support systems (also called operational support systems or OSS) are computer systems used by telecommunications service providers. The term OSS most frequently describes network systems dealing with the telecom network itself,… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”