hgesser.com/ulix/

The Implementation of the ULIX Literate Operating System

header

Navigation

Privates

Publikationen

Studium

Software

Sonstiges

Blaue Links: intern
Rote Links: extern

Suche Linux-Bücher bei
Amazon.de


Subscribe ULIX: Literate Unix

A diary documenting the implementation of ULIX-i386

Welcome to the ULIX blog.

Ulix (Literate Unix) is a Unix-like operating system developed at University of Erlangen-Nürnberg. I use D. E. Knuth's concept of Literate Programming for the implementation and documentation. The goal was a fully working system which can be used in operating system courses to show students how OS concepts (such as paging and scheduling) can be implemented. Literate programs are very accessible because they can be read like a book; the order of presentation is not enforced by program logic or compiler restrictions, but instead is guided by the implementer's creative process.

Ulix is written in C and assembler for the Intel architecture. The literate programming part is handled by noweb.

On this page I document my progress with the implementation.


Navigation: 2015 | 2014 | 2013 | 2012 | 2011


Remembering: there's a thing called scope (18.08.2011)


Back to "Learning C 101": Assume you create a new page table, and you do that within a function. That page table is supposed to stay around (even though it's never explicitly accessed outside the function, however it's being pointed to.) Sometimes the code works, sometimes not. You spend half a day on searching for the errors in the paging calculations... Perhaps something's wrong with the physical addresses? But not always? The code looks like this:

void create_new_table() {
  page_table pt;
  ... (fill pt with data)
  ... (enter &pt in global page directory)
  return;
}
Then, suddenly, at 4:00 a.m. in the morning, you realize that this way return is an implicit forget about pt. D'oh.
In related news, moving the pt declaration outside the function solved my problem, and now Ulix can reserve new pages (and correctly update the page tables) until it runs out of physical frames :) Yes, there's still the issue of paging out memory to disk. Which would require disk access. Which is a topic for later.

[ Path: | persistent link ]

Copyright © 2011-2015 Hans-Georg Eßer; Server: Debian Linux, Apache Web Server, blog page powered by blosxom :: the zen of blogging, Theme: Hazard Area 1.6 (modified), created by Bryan Bell, Copyright © 2000-2006 Weblogger.com.