amirsaniyan wrote:I have an idea about creating an OS.
My idea is: Create an OS that's written in a scripting language (eg. JavaScript or Python).
This image shows the architecture:
Note:
HAL written in ASM/C/C++ and should be minimal. Some classes like CPU provides Interrupts/Privileges (Even CPU like Z80 not supported that feature).
OS (Kernel, Drivers and ...) written in a scripting language (eg. JavaScript or ECMA Script).
Applications written in a scripting language too (eg. XHTML + CSS + JavaScript).
Benefits:
* Open Source (Because OS written in a scripting language)
* Easy to port to other Hardwares.
* Easy to port to Mobile devices.
* Easy to debug.
* Easy to update.
* XHTML, CSS, JavaScript are popular.
....
Is it a good idea to create an OS that's written in a scripting language?
For example, how about creating an OS using JavaScript?
I have a similar idea for my projects: Create a proper kernel in C/Assembly and the like, build a compiler that can combine different languages and
compiles them, including a language like JavaScript for some aspects that aren't the core of a component but that can make such component more maintainable and readable, and use as many standards as possible to make it worthy. Some of those standards would be HTML/XHTML/JavaScript/CSS to build a GUI that obeys standard practices and in which we can use HTML to create an application's GUI, probably compiling it partially or totally to native code or some bytecode. However, there should always be the option of using any other languages.
I would say it is a good idea only if you are capable of writing all of the above for yourself, use scripting languages as compiled code ultimately if you use them for parts of the system/kernel itself, and let the programmer choose the use of regular APIs, or fancy and easy interfaces that, like JavaScript, require no configuration from the end user/end developer. Otherwise it would be so pointless that you simply won't be able to implement that OS to begin with.
You still have a lot of work ahead, and will need to start with very low level stuff anyway, which won't be so fancy from that point of view, while you get the huge experience required to be capable of creating such a complex environment properly.
After all, if it wasn't a good idea to have such languages in an OS, they wouldn't be in the OS'es everyone use normally; but they must be used correctly, not necessarily in the same old way in which they have been used so far, but efficiently, and just compile them if it is beneficial to do so. And don't leave out the possibility of the rest of languages like C and Assembly, since they are still the primary ones in OS development, and in applications to.
iansjack wrote:I'll tell you what. Write an ext2fs driver in javascript and post it somewhere where I can review it; then I'll answer your question.
I would be one to do so if I had enough information and expertise on ext2. However I have implemented tiny parts of FAT12 in JavaScript, and could finish a driver that can at least read the root directory, but since I already have a working implementation in assembly, I see no practical use for a FAT12 JavaScript driver in the short term, or maybe only to create an interactive tutorial about it with a driver in the web browser.
It is common knowledge that JavaScript can handle binary data easily in modern browsers since FireFox 3 (use Base64 functions btoa to load the binary data as plain text, and decode it back to its binary form using atob; in this way you could, for instance, request or embed part or all of a floppy image and parse it with pure JavaScript). Working with raw binary data in JavaScript is no longer something to be afraid of (at least not in moderate quantity, and in the default environment of a web browser, mainly to read it, unless you build an extension or use a web server to have it make writes to a file to save what you did at the JavaScript side).