Skip to content

abed252/jos-kernel

Repository files navigation

jos-kernel

A full implementation of the JOS teaching operating system, built as part of the Operating Systems course at the Technion. Based on the MIT 6.828 JOS skeleton, extended with network challenge implementations.

Written in C and x86 assembly. Runs on QEMU; tested with a multi-container Docker setup.

What was implemented

Lab 1 — Booting

  • x86 bootloader: real-mode → protected mode transition, ELF kernel loading
  • Kernel monitor with stack backtrace and debug symbol resolution (kern/kdebug.c)
  • VGA/serial console output

Lab 2 — Memory management

  • Physical page allocator (free list, page_alloc, page_free)
  • Two-level x86 page table setup (kern/pmap.c)
  • Virtual memory mappings: kernel, user stacks, MMIO regions
  • pgdir_walk, boot_map_region, page_insert, page_lookup, page_remove

Lab 3 — User environments and system calls

  • User environment (process) creation and ELF loading
  • x86 IDT setup, trap/interrupt dispatch (kern/trap.c, kern/trapentry.S)
  • Page fault handler with user-level fault delegation
  • System call interface: sys_exofork, sys_env_set_status, sys_page_alloc, sys_page_map, sys_page_unmap

Lab 4 — Preemptive multitasking

  • Multiprocessor boot: AP startup via kern/mpentry.S, LAPIC initialization
  • Kernel-level spinlocks (kern/spinlock.c)
  • Round-robin scheduler with clock interrupt preemption (kern/sched.c)
  • fork() with copy-on-write via user-level page fault handler (lib/fork.c)
  • Inter-process communication: sys_ipc_recv / sys_ipc_try_send

Lab 5 — File system

  • Block cache with demand paging over the disk device
  • File system server as a separate JOS environment (fs/)
  • open, read, write, seek, close, stat via IPC to FS server
  • Shell with I/O redirection and pipes

Lab 6 — Network driver and web server

  • Intel E1000 NIC driver: PCI enumeration, TX/RX descriptor ring management (kern/e1000.c)
  • DMA-based packet transmission and receive with descriptor ring wraparound
  • Integration with lwIP TCP/IP stack
  • HTTP web server serving static content over the JOS network stack

Challenge extensions

Three additional network applications built on top of the JOS stack and tested using Docker containers:

Live chatchatd (server) + chatcli (client). Multiple clients connect and exchange messages in real time. Handles simultaneous sends, disconnects, and empty messages.

File transferfiled (server) + filecli (client) supporting PUT and GET operations. Verified integrity across multiple concurrent transfers.

Host-to-JOS file injectiontransferfile server accepts HTTP PUT requests from the host machine (tested with curl), writing files into the live JOS filesystem at runtime.

Building and running

Requirements: gcc, make, qemu-system-i386

make
make qemu-nox

To run the challenge network applications, use the included Docker setup:

docker-compose up --build

Structure

Directory Contents
boot/ x86 bootloader (real mode → protected mode → ELF load)
kern/ Kernel: memory, traps, syscalls, scheduler, NIC driver
lib/ User-space runtime: fork, IPC, syscall wrappers
fs/ File system server
net/ Network glue: lwIP integration, socket layer
user/ User programs: shell, chat, file transfer, web server
inc/ Shared headers

License

MIT

About

JOS operating system — 6 labs + network challenges in C and x86 asm (Technion OS course)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors