How does your OS manage dependencies/extensions?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
trekos
Posts: 3
Joined: Sun Sep 18, 2016 7:28 am
Libera.chat IRC: trekos

How does your OS manage dependencies/extensions?

Post by trekos »

Hi,

I wanted to ask how you all handled dependencies and extensions. My OS is in its infancy stages (I've just finished with paging and heap), and I wanted to ask how you build and apply extensions to your OS. Now, I don't mean like a microkernel. I mean having the source code for the VFS, or drivers, or anything else seperated from the kernel's build system.

My goal with my OS is to have a core kernel that is completely capable of running on its own. Then I will have a Javascript VM that the kernel runs, then applications that the Javascript VM runs.

I'd like to know how you build different aspects of your OS. Do you build the code for extensions, in this case the Javascript VM, into the kernel's build system or does you set up your build system to scan a directory for extensions, or <other>?

Cheers,
trekos
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: How does your OS manage dependencies/extensions?

Post by BrightLight »

It sounds like your OS would really be a JavaScript interpreter on "bare metal." IMHO, that's not a good approach; interpreted languages are always slower than compiled code.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
trekos
Posts: 3
Joined: Sun Sep 18, 2016 7:28 am
Libera.chat IRC: trekos

Re: How does your OS manage dependencies/extensions?

Post by trekos »

Hi,

Honestly, I'm not focused on providing speed for userspace applications right now, I'm focused on providing a simple way to program applications.

Because there isn't any compiling to be done, I believe the application programming will be tons simpler. If you don't have to compile then these Javascript applications can work architecture independent. That way when I port other architectures it will be super simple for users to download, install, and run applications.

That's just my thoughts.

Cheers,
trekos
shmx
Member
Member
Posts: 68
Joined: Sat Jan 16, 2016 10:43 am

Re: How does your OS manage dependencies/extensions?

Post by shmx »

The OS kernel doesn't maybe created in the JavaScript and other like programming languages. The reason is that these languages imply presence implement memory manager, protection, task management, etc. Another problem is that these languages do not provide means low-level code managment for interrupt and exception handling, cpu control, task switching, etc. You can implement kernel modules, which may be developed on most languages, but maybe a problems related to performance.
I implemented kernel modules loading from PE DLL's and I implemented partial support msvcrt so I can use standard C/C++ libraries without problems with porting. In a similar way, you can implement support for interpreters, but I don't need it.
brunexgeek
Member
Member
Posts: 45
Joined: Wed Dec 25, 2013 11:51 am

Re: How does your OS manage dependencies/extensions?

Post by brunexgeek »

trekos wrote:Do you build the code for extensions, in this case the Javascript VM, into the kernel's build system or does you set up your build system to scan a directory for extensions, or <other>?
I use CMake to automate my build process. The kernel itself is an executable and the kernel modules are shared libraries. I also have some static libraries to implement small functions/classes that I use in many components (e.g. clear memory, copy memory, etc.).
brunexgeek
Member
Member
Posts: 45
Joined: Wed Dec 25, 2013 11:51 am

Re: How does your OS manage dependencies/extensions?

Post by brunexgeek »

omarrx024 wrote:It sounds like your OS would really be a JavaScript interpreter on "bare metal." IMHO, that's not a good approach; interpreted languages are always slower than compiled code.
trekos wrote:Honestly, I'm not focused on providing speed for userspace applications right now, I'm focused on providing a simple way to program applications.
He can still implement a JIT compiler to improve performance.
trekos wrote:Because there isn't any compiling to be done, I believe the application programming will be tons simpler.
You mean simpler because you don't need to run a compiler explicitly to generate the executable? If you intent to run JavaScript programs directly from source you might have some problems (for example) with performance (you need to compile the code every time the user runs it) and security (the source code is exposed and there's no guarantee the code wasn't modified). Compiled executable (native or bytecode) allows you to simplify the process of load/execute programs and also allows you to introduce some security validations.
trekos
Posts: 3
Joined: Sun Sep 18, 2016 7:28 am
Libera.chat IRC: trekos

Re: How does your OS manage dependencies/extensions?

Post by trekos »

brunexgeek wrote:Snip
Hi,

I mean that it would be simpler for cross-platform applications (think of Java), but instead of compiling it to bytecode (again like Java) it is interpreted by the built in Javascript module.

I will still support executable files, but Javascript would be much better to use for user-mode applications. I see where you come from about security, and I will have to take this into consideration. Perhaps implement a checksum to the application's package before executing?

Cheers,
trekos
User avatar
matt11235
Member
Member
Posts: 286
Joined: Tue Aug 02, 2016 1:52 pm
Location: East Riding of Yorkshire, UK

Re: How does your OS manage dependencies/extensions?

Post by matt11235 »

trekos wrote:
brunexgeek wrote:Snip
Hi,

I mean that it would be simpler for cross-platform applications (think of Java), but instead of compiling it to bytecode (again like Java) it is interpreted by the built in Javascript module.

I will still support executable files, but Javascript would be much better to use for user-mode applications. I see where you come from about security, and I will have to take this into consideration. Perhaps implement a checksum to the application's package before executing?

Cheers,
trekos
Why not allow the user to edit it on the fly, similar to how Emacs works?
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
brunexgeek
Member
Member
Posts: 45
Joined: Wed Dec 25, 2013 11:51 am

Re: How does your OS manage dependencies/extensions?

Post by brunexgeek »

trekos wrote:
brunexgeek wrote:Snip
I mean that it would be simpler for cross-platform applications (think of Java), but instead of compiling it to bytecode (again like Java) it is interpreted by the built in Javascript module
I understand, but notice that even an interpreted language will required some kind of intermediate representation (bytecode, syntax tree, etc.) which can be executed by a virtual machine. The only difference is whether the program will be stored as source (JavaScript) or not (e.g. bytecode). In the first case you need to "compile" at runtime; in the later you just load the intermediate representation and run.
Boris
Member
Member
Posts: 145
Joined: Sat Nov 07, 2015 3:12 pm

Re: How does your OS manage dependencies/extensions?

Post by Boris »

Scripts are not less secure than binaries.
It just takes less tools to alter them.
Never give power to something you have no trust/faith in.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: How does your OS manage dependencies/extensions?

Post by Brendan »

Hi,
trekos wrote:I wanted to ask how you all handled dependencies and extensions. My OS is in its infancy stages (I've just finished with paging and heap), and I wanted to ask how you build and apply extensions to your OS. Now, I don't mean like a microkernel. I mean having the source code for the VFS, or drivers, or anything else seperated from the kernel's build system.
Mostly, I don't handle dependencies and extensions.

In theory I'd have a "standard base" (OS installer, boot loaders, kernel, drivers, GUI, utilities/tools, etc) that covers the minimum/required functionality and is all under the one build system and kept "in sync" (only ever depending on itself); and then (completely separated from that) I'd have "optional stuff" (applications, etc). In practice I never get far enough to worry about "optional stuff", so there are no dependencies or extensions on top of that "minimum/required functionality that only ever depends on itself".


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
rdos
Member
Member
Posts: 3276
Joined: Wed Oct 01, 2008 1:55 pm

Re: How does your OS manage dependencies/extensions?

Post by rdos »

trekos wrote:Hi,

I wanted to ask how you all handled dependencies and extensions. My OS is in its infancy stages (I've just finished with paging and heap), and I wanted to ask how you build and apply extensions to your OS. Now, I don't mean like a microkernel. I mean having the source code for the VFS, or drivers, or anything else seperated from the kernel's build system.

My goal with my OS is to have a core kernel that is completely capable of running on its own. Then I will have a Javascript VM that the kernel runs, then applications that the Javascript VM runs.

I'd like to know how you build different aspects of your OS. Do you build the code for extensions, in this case the Javascript VM, into the kernel's build system or does you set up your build system to scan a directory for extensions, or <other>?

Cheers,
trekos
I use a code patching model for it. I insert kernel calls with a macro, which is modified when accessed and patched with the real entry point. Services are registered by drivers at initialization time. Then I build a binary by combining drivers I need for a specific configuration. This way I don't need to link a huge binary, rather the configuration process only needs to write the wanted drivers into the image. The image can by built in the target system itself (or on Windows), supporting automatic configuration.
Post Reply