Skip to content
Han edited this page Dec 10, 2015 · 45 revisions

Dress code

Formal attire

Before launching OS

Written in C++

In fact, C++14 or C++1y

1. Maybe type

  • May reminds you of Swift's ! operator (auto unboxing)
  • If you are not sure what type it is, then it is Maybe Type.
  • Auto unboxing (through operator + overload), existence check
  • Sample Usage:
Maybe<Int> value = hashTable(key);//no need to check if exists or not
  • >> overload for lambda (DETAILS HERE)

2. Fops abstraction

  • With only 2 abstract function: read() and write()
  • File descriptor IS the implementation of fops
  • open() is constructor and close() is destructor
  • C++ constructor cannot fail? Wrap it in Maybe type
  • Driver knows nothing about the file system

3. Automatic resource release

  • AutoSpinLock and unique_ptr
AutoSpinLock
  • Through using constructor & destructor, when the lock is out of scope, it will be auto released.
  • Sample Usage:
    AutoSpinLock lock(&mouse_draw_lock);//done, that's all!

#####unique_ptr

  • Ported from boost library
  • Everything malloc() will be automatically free()
  • So,it is GC

4. Code reuse through templates

Kernel level dynamic memory allocation

Using slabs with template metaprogramming

User level dynamic memory allocation

Implemented sbrk

Ported C library

  • whole C std, ready for use

Read and write hard drive

  • DMA for maximum efficiency

Play music

  • Driver for Sound Blaster 16.

Real mode support

  • Display all in HD

Mouse support

  • Left/Right/Double Click, Move support
  • We have a live stream for the process Rendering mouse in our OS LIVE
  • And we hit the Top 1 and get Featured! WOW

I/O wait queues

Extra Linux syscalls

lseek, lstat, sbrk

After launching OS

GUI

  • Duang!~~~
  • With Desktop, Window System, Mouse and DrawNikita&DrawTAs
  • HD Display Support
  • Font Display Support

Lisp

Someone asserted that our OS is not a usable OS, we'd beg to differ. You can write programs in our OS. In fact, as a dedication to the widespread use of functional syntax in our system, the kernel supports the oldest functional language of all: Lisp. Simply hit alt-fn-f10 and you'll see the lisp interface.

Write a factorial program.

(defun factorial (n)
  (if (= n 0)
      1
      (* n (factorial (- n 1))) ) )

(loop for i from 0 to 16
   do (format t "~D! = ~D~%" i (factorial i)) )

Write code to get number of active processes in the system.

Clone this wiki locally