OSDev.org
https://forum.osdev.org/

How does your OS manage dependencies/extensions?
https://forum.osdev.org/viewtopic.php?f=15&t=30822
Page 1 of 1

Author:  trekos [ Sun Sep 18, 2016 7:40 am ]
Post subject:  How does your OS manage dependencies/extensions?

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

Author:  BrightLight [ Sun Sep 18, 2016 11:26 am ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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.

Author:  trekos [ Sun Sep 18, 2016 11:48 am ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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

Author:  shmx [ Sun Sep 18, 2016 12:29 pm ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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.

Author:  brunexgeek [ Tue Sep 20, 2016 10:02 am ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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.).

Author:  brunexgeek [ Tue Sep 20, 2016 10:17 am ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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.

Author:  trekos [ Tue Sep 20, 2016 12:33 pm ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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

Author:  matt11235 [ Tue Sep 20, 2016 1:36 pm ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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?

Author:  brunexgeek [ Tue Sep 20, 2016 2:02 pm ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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.

Author:  Boris [ Tue Sep 20, 2016 3:22 pm ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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.

Author:  Brendan [ Tue Sep 20, 2016 5:25 pm ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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

Author:  rdos [ Wed Sep 21, 2016 3:00 pm ]
Post subject:  Re: How does your OS manage dependencies/extensions?

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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/