GithubHelp home page GithubHelp logo

rkya / sbunix Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 390 KB

Preemptive multi-tasking operating system

License: Other

CMake 10.15% Makefile 3.48% C 53.00% C++ 16.02% Forth 14.57% Assembly 2.77%
qemu operating-system c preemptive multitasking paging freelist kmalloc interrupts scheduling task-switcher terminal syscalls shell kernel-thread vfs tarfs

sbunix's Introduction

Introduction

This is a preemptive multi-tasking operating system called SBUnix developed as a part of operating systems course in Stony Brook University. I have implemented paging, free list, kmalloc, interrupts, scheduling, task switching, terminal, syscalls, kernel-threads, VFS and tarfs file access. SBUnix also contains binaries like echo, sleep, cat, ls, kill and ps.

Running The OS

To boot the system in QEMU, run:

qemu-system-x86_64 -curses -drive id=boot,format=raw,file=$USER.img,if=none -drive id=data,format=raw,file=$USER-data.img,if=none -device ahci,id=ahci -device ide-drive,drive=boot,bus=ahci.0 -device ide-drive,drive=data,bus=ahci.1 -gdb tcp::9999
  • Explanation of parameters:

    -curses               use a text console (omit this to use default SDL/VNC console)
    -drive ...              connect a CD-ROM or hard drive with corresponding image
    -device ...           configure an AHCI controller for the boot and data disks
    -gdb tcp::9999    listen for "remote" debugging connections on port NNNN
    -S                        wait for GDB to connect at startup
    -no-reboot          prevent reboot when OS crashes

  • When using the -curses mode, switch to the qemu> console with ESC-2.

  • To connect a remote debugger to the running qemu VM, from a different window:

    gdb ./kernel
    

    At the (gdb) prompt, connect with:

    target remote localhost:9961
    

Commands supported

  • Print the present working directory
    pwd
    
  • Print the contents of the current directory
    ls
    
  • Change the current working directory
    cd <Path>
    e.g.
    cd /rootfs/etc/
    cd /rootfs/
    
    Note that you have to enter absolute path right from /rootfs/. Also, note that every directory ends with a '/'. So if you enter cd /rootfs instead of cd /rootfs/, it won't work.
  • Echo
    echo <Word/Variable>
    e.g.
    echo hello
    echo $HOME
    
  • Print the information of the running processes
    ps
    
  • Kill a process
    kill -9 <pid>
    e.g.
    kill -9 1
    
    If you kill a process with pid > 1, the process will be killed.
    But if you try to kill process with pid 1, SBUnix will ask you if you want to shut down the system as this is the special sbush process which runs as soon as you start the SBUnix.
  • Print the contents of the file on the terminal
    cat <Path/To/The/File>
    e.g.
    cat /rootfs/etc/test.txt
    
  • Add/change value of an environment variable
    export Name=Value
    e.g.
    export hello=world
    
    You can later check the value of the variable using the echo command as follows:
    echo $hello
    
  • Sleep for 's' seconds
    sleep <Time in seconds>
    e.g.
    sleep 5
    
  • Shutdown SBUnix
    shutdown
    

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.