OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 8:00 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Ultimate Monolith
PostPosted: Sat Apr 16, 2016 11:03 pm 
Offline

Joined: Wed Feb 24, 2016 10:24 pm
Posts: 1
I was thinking of an interesting and highly unconventional concept for an OS. There are no executable binaries, only the kernel. The "programs" are only configuration scripts parsed by the kernel. They include different callback functions for the kernel to jump to on specific events, e.g. IRQs, loops, etc. Every time there is a context switch, the kernel loads the configuration again and retains it until the next switch. This would be the "ultimate monolith", where everything is done by the kernel.

_________________
Modulus OS


Top
 Profile  
 
 Post subject: Re: Ultimate Monolith
PostPosted: Sun Apr 17, 2016 2:14 am 
Offline
Member
Member

Joined: Fri Jan 30, 2015 4:57 pm
Posts: 215
Location: Germany
That'd just an interpreter, like the jvm is, but with textfiles and with less abilities. How are such isr procedures and event handlers written? Right, in a scripting language, and this is the same thing as with android.
Android's designer chose the java vm as their program processor over the native one to enable app programmers to 'compile once, debug everywhere'. Do you want to achieve this? If yes, you have to port a scripting language or a bytecode interpreter (or create your own) into the operating system's executive. If not, what are the advantages your design concept offers?


Top
 Profile  
 
 Post subject: Re: Ultimate Monolith
PostPosted: Sun Apr 17, 2016 2:50 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
Someone expressed similar ideas years ago on alt.os.development. Unfortunately, I don't remember who or when exactly (anywhere from 1998 to 2006, when I was very active in news groups). If I'm not mistaken, the ideas also included application fault tolerance (e.g. if the error can be fixed (I/O error, missing file, etc), the app can make further progress when that happens) because the kernel would know about errors and be able to save/restore state and resume execution at the right point in app's code. I don't think that can be done with any/all kinds of errors because there are parts of application state that can't survive long periods of inactivity (think of network/protocol states/connections/sessions/etc with their unique IDs, e.g. your dynamic IP address may change and you may never get it back), but it sure was nice alternative thinking. I don't think those ideas have ever materialized, though.


Top
 Profile  
 
 Post subject: Re: Ultimate Monolith
PostPosted: Sun Apr 17, 2016 2:59 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
As for monoliths and general lolz insufficiency, check out The Page-Fault Weird Machine: Lessons in Instruction-less Computation, code & slides.


Top
 Profile  
 
 Post subject: Re: Ultimate Monolith
PostPosted: Sun Apr 17, 2016 3:14 am 
Offline
Member
Member

Joined: Fri Jan 30, 2015 4:57 pm
Posts: 215
Location: Germany
Quote:
We show that powerful computation on x86 processors is possible without executing any CPU instructions

Hype intensifies.
Edit: Too bad the pdf is damaged and cannot be read by my mobile.


Top
 Profile  
 
 Post subject: Re: Ultimate Monolith
PostPosted: Sun Apr 17, 2016 11:21 am 
Offline
Member
Member

Joined: Sat Feb 27, 2010 8:55 pm
Posts: 147
Techel wrote:
Quote:
We show that powerful computation on x86 processors is possible without executing any CPU instructions

Hype intensifies.
Edit: Too bad the pdf is damaged and cannot be read by my mobile.


I'm having trouble understanding how PaX PAGEEXEC works; I'm hoping someone here can explain it.

Quote:
By setting the Supervisor/User (S/U) bit in the PTE of a designated non-executable page, we can cause the processor to trap any access to that page...

The page fault handler then resets the S/U bit for a single data byte access to succeed,
and performs that access – causing the PTE for the page to be recorded in the dTLB. Right after this access, the handler resets the PTE entry’s S/U bit back to unconditionally causing the fault.


The bolded part is where I'm lost -- how does the page handler regain control? My understanding is it resets the S/U bit, then returns control to the program that caused the page fault. The program then retries the instruction, and this time it succeeds, so the page handler never regains control and can never reset the S/U bit. So how does this work?


Top
 Profile  
 
 Post subject: Re: Ultimate Monolith
PostPosted: Sun Apr 17, 2016 3:40 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
azblue wrote:
Quote:
By setting the Supervisor/User (S/U) bit in the PTE of a designated non-executable page, we can cause the processor to trap any access to that page...

The page fault handler then resets the S/U bit for a single data byte access to succeed,
and performs that access – causing the PTE for the page to be recorded in the dTLB. Right after this access, the handler resets the PTE entry’s S/U bit back to unconditionally causing the fault.


The bolded part is where I'm lost -- how does the page handler regain control? My understanding is it resets the S/U bit, then returns control to the program that caused the page fault. The program then retries the instruction, and this time it succeeds, so the page handler never regains control and can never reset the S/U bit. So how does this work?


Disclosure: I have not read the doc/code closely. This is my simplified understanding of it.

It looks like they set up the system tables (GDT, IDT, TSS, page tables) in such a way that an attempt to execute an instruction always causes an exception (page fault or double fault or maybe something else) and so a return from an exception handler is immediately followed by another exception and all work is therefore happening in exception handlers.
The tricky part that you may be missing is that invoking an exception handler causes the CPU to store a part of its current state somewhere (on the stack and/or in the TSS). The locations of the "somewheres" can be chosen such that those stores overwrite the system tables and alter the behavior of exception handlers and also perform I/O as shown in the Game of life demo.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group