An Experimental “.NET” Operating System Based on the CLI An executing method of a OS kernel...

19
An Experimental “.NET” Operating System Based on the CLI An executing method of a OS kernel represented in the CIL Research Division in Engineering, Musashi Institute of Technology Akio TAKAHASHI Graduate School of Systems and Information Engineering University of Tsukuba Kazuhiko KATO eme Workshop 2006 - Microsoft Research Asia
  • date post

    18-Dec-2015
  • Category

    Documents

  • view

    213
  • download

    2

Transcript of An Experimental “.NET” Operating System Based on the CLI An executing method of a OS kernel...

An Experimental “.NET” Operating System Based on the CLI

An executing method of a OS kernel represented in the CIL

Research Division in Engineering, Musashi Institute of Technology

Akio TAKAHASHI

Graduate School of Systems and Information Engineering University of Tsukuba

Kazuhiko KATO

Theme Workshop 2006 - Microsoft Research Asia

2 /23

CLIを実装する次世代オペレーティングシステムの開発

Introduction

We developed a new CLI (.NET)-based operating system.◆ CLI is used in two ways:

The OS is implemented with CLI. Application programs run on CLI.

◆ The OS is mostly written in C#. Type safety Memory safety

3 /23

CLIを実装する次世代オペレーティングシステムの開発

Backgrounds

CLI provides enough specs that system software should have.◆ Effective speed◆ Security

However, CLI has not been applied to operating systems.◆ Conventional OSs cannot fully take advantage of CLI.

To use CLI for OS description, we have to develop a technique to handle CLI intermediate codes for OS kernel execution.◆ CLI languages are usually compiled into a intermediate code,

the CIL (Common Intermediate Language).

4 /23

CLIを実装する次世代オペレーティングシステムの開発

Related Work

Java-based◆ JavaOS (Sun Microsystems)◆ JX (OSS)◆ JNode (OSS)

CLI-based◆ Singularity (Microsoft Research)

Basic Architecture

(4 slides)

6 /23

CLIを実装する次世代オペレーティングシステムの開発

Approaches

Utilize CLI features as much as possible.◆ At runtime, all the system objects are expressed in CLI.

Take advantage of existing software◆ Mono Class Library (as .NET standard library)◆ The FreeType font engine

7 /23

CLIを実装する次世代オペレーティングシステムの開発

System Structure

Managed Kernel (CIL)

Legacy Kernel (C++)

Assembly Loader

CIL Compiler

CIL Interpreter

execute

etc.compile

Legacy Kernel◆ Functions:

Memory manager & Device drivers CIL interpreter

◆ Written in C++ and compiled into native codes in advance.

◆ Used only in the bootstrap time; it disappears after that.

Managed Kernel◆ Functions:

Ordinary OS functions CIL compiler

◆ Mostly written in C# and compiled into CIL codes in advance.

◆ At the bootstrap time, the CIL codes are compiled into native codes by the (self) CIL compiler by using the CIL interpreter in Legacy Kernel.

8 /23

CLIを実装する次世代オペレーティングシステムの開発

Bootstrap Sequence

Finally, only CIL programs remains in the system.

(disappear)

Bootloader

Legacy Kernel

Managed Kernel

Native Code

Metadata

Executed bythe interpreter

Executed directly

Metadata Construction Stage

Compilation Stage

9 /23

CLIを実装する次世代オペレーティングシステムの開発

Advantages of the Proposed Method

The entire system can be expressed in CLI.

We can fully take advantage of CLI technologies even in the earlier stages.◆ Both native and CLI codes can be executed in a

mixed manner.◆ Mono Class Library is used with trivial

modifications.

High portability◆ Architecture-dependent part is well modularized.◆ We don’t use MMU.

Experiments and Demo

(5 slides)

11 /23

CLIを実装する次世代オペレーティングシステムの開発

Demo

Run our OS with Text-mode on VMware◆ It takes about 3 minutes to bootstrap and show the promp

t.

What you see on bootstrapping is◆ Legacy Kernel’s Loading (with NO outputs)◆ Compiling a little part (not complete)◆ Managed Kernel’s Loading some data (with many outputs)

What I do is◆ Execute a ‘ls’ program for listing the contents of CD-ROM◆ Execute a ‘cat’ program for its source file

12 /23

CLIを実装する次世代オペレーティングシステムの開発

Start-up Screens

Figures are taken just after OS booted. Text Mode (Left)

Graphic Mode (Right)

13 /23

CLIを実装する次世代オペレーティングシステムの開発

Fundamental Test

The simple “ls” program (ls.cs).

1. Compile ls.cs on Windows2. Run ls.exe on Windows3. Copy ls.exe to our OS

And run also

We confirmed successful execution:◆ Cross-platform execution◆ File system compatibility

using System;using System.IO;

class ls {  static void Main(string[] args) {   DirectoryInfo dir;

if(args.Length==0) {   dir = new DirectoryInfo(

Directory.GetCurrentDirectory());} else {   dir = new DirectoryInfo(args[0]);}foreach(FileSystemInfo fsi in dir.GetFileSystemInfos()) {   Console.Write("{0,-32} ", fsi.Name);   if(fsi is FileInfo) {

FileInfo fi = (FileInfo)fsi;Console.Write("{0,10} B", fi.Length);

   } else {Console.Write("{0,10} -","");

   }   Console.WriteLine();}

  }}

14 /23

CLIを実装する次世代オペレーティングシステムの開発

Practical Test using Font Engine

In both Windows and our OS, the FreeType Library can be successfully executed.◆ FreeType is a high-quality font ren

dering engine written in C++.◆ Japanese characters are handled.

15 /23

CLIを実装する次世代オペレーティングシステムの開発

Writing Device Drivers

A constructor and a initializing method of DMA Controller class

In the constructor, associative IOPort instances are created.

In the initializing method, the device is controlled via associative I/O ports.

private DMAController(ushort cadr0, ushort cadr1, ushort cadr2, ushort cadr3,ushort ccnt0, ushort ccnt1, ushort ccnt2, ushort ccnt3,ushort psts, ushort pcmd, ushort preq, ushort psmask,ushort pmode, ushort pcbpf, ushort ptmp, ushort pmclr,ushort pcmask, ushort pamask)

{this.cur_address[0] = new IOPort1(cadr0);this.cur_address[1] = new IOPort1(cadr1);this.cur_address[2] = new IOPort1(cadr2);this.cur_address[3] = new IOPort1(cadr3);this.cur_counter[0] = new IOPort1(ccnt0);this.cur_counter[1] = new IOPort1(ccnt1);this.cur_counter[2] = new IOPort1(ccnt2);this.cur_counter[3] = new IOPort1(ccnt3);this.status = new IOPort1(psts);this.command = new IOPort1(pcmd);this.request = new IOPort1(preq);this.single_mask = new IOPort1(psmask);this.mode = new IOPort1(pmode);this.clear_byte_ptr_flipflop = new IOPort1(pcbpf);this.temporary = new IOPort1(ptmp);this.master_clear = new IOPort1(pmclr);this.clear_mask = new IOPort1(pcmask);this.all_mask = new IOPort1(pamask);

}

private void Initialize(byte mode, byte mask) {this.master_clear.Write(0x00); // master clear (reset)this.command.Write(0x00);    // cmd reg.this.mode.Write(mode);      // mode reg.this.all_mask.Write(mask);     // all mask reg.

}

16 /23

CLIを実装する次世代オペレーティングシステムの開発

Conclusion

We designed and implemented a 100%-pure CLI OS. Existing large-scale CLI libraries are executed with tri

vial modification. ◆ Mono Class Library◆ FreeType font engine

Device drivers are written in C#.◆ DMA Controller & ATA/ATAPI & CD-ROM device driver◆ ISO9660 (CD-ROM file system) driver

17 /23

CLIを実装する次世代オペレーティングシステムの開発

Future work

Remove dependencies on the CIL interpreter to execute a few runtime methods.◆ This requires analysis of the call-graphs of the

runtime methods.

Pre-execute the CIL interpreter in Legacy Kernel to generate a ready-made image of Managed Kernel, to shorten the start up time.

18 /23

CLIを実装する次世代オペレーティングシステムの開発

Acknowledgements

This research project was supported by Mitou Software Development Program of Information-technology Promotion Agency (IPA), Japan.

We thank to Dr. Dave Provert for useful comments.

19 /23

CLIを実装する次世代オペレーティングシステムの開発

Does anyone have any questions?