GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - rkya/SBUnix: Preemptive multi-tasking operating system

BranchesTags
Open more actions menu

Latest commit

 

History

39 Commits
39 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
bin/sbush
bin/sbush
 
 
cmake-build-debug
cmake-build-debug
 
 
cmake-build-default
cmake-build-default
 
 
crt
crt
 
 
include
include
 
 
libc
libc
 
 
obj
obj
 
 
rootfs
rootfs
 
 
sys
sys
 
 
.gitattributes
.gitattributes
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
Makefile.config
Makefile.config
 
 
README
README
 
 
README.md
README.md
 
 

Repository files navigation

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

  • http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
  • https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64/
  • https://wiki.osdev.org/USTAR
  • http://www.osdever.net/bkerndev/Docs/intro.htm
  • http://www.jamesmolloy.co.uk/tutorial_html/4.-The%20GDT%20and%20IDT.html
  • https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html
  • https://notes.shichao.io/lkd/ch15/

About

Preemptive multi-tasking operating system

Topics

cfreelistinterruptskernel-threadkmallocmultitaskingoperating-systempagingpreemptiveqemuschedulingshellsyscallstarfstask-switcherterminalvfs

Resources

Readme
License
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.