An exploration of a new operating system, funnyos

        For the last few years, I've been thinking about how to build my own language, and how to create an operating system that can execute that language on it, which I call the Funny Language, and the corresponding operating system, the Pan Language. Operating system (funnyos). This is not an easy thing, so I didn't know how to start, until recently I had a solution that I could explore and implement. Coincidentally, the recent ZTE incident has made public opinion continue to ferment, which has made us realize our own shortcomings, and it is imminent to create our own application on the Chinese chip. At this juncture, it makes sense to develop such an operating system. Assuming that such an operating system is successfully developed and an ecological chain of applications is established on it, at least we can use our own technology openly and without restriction. And, even when we fail, we gain new knowledge that is useful for advancing technological innovation. Now I will talk about my language and such an operating system.
        First of all, it should be recognized that it is not only C language that can write an OS kernel, but it is more efficient to write an OS kernel in C language. I'm going to use a lightweight scheme language to write the OS kernel, it's not fully rnrs compliant, I'll call it fscheme. Generic language is a macro language built on fscheme, which generates fscheme language after performing several transformations on the input program. Pan language is a kind of natural language, its specification can refer to: FunnyLanguage ; please refer to fscheme language specification: fscheme
         Let me explain the development ideas of funnyos:

  1. No matter what kind of software, first of all, it needs to be supported by hardware, that is, CPU, memory, input and output devices, etc. These devices are varied, and there is no unified standard. In order to run funnyos on some of these devices, it is necessary to constantly test the water on the hardware. If some fatal errors occur, the hardware may be broken, which is a matter of time and money. The requirements are very high, so we exclude the direct use of hardware for development. So, do we have an alternative? have. That is to develop a virtual machine, funnymachine, suitable for funnyos to run. The instruction set of this virtual machine should be consistent with the instruction set of the target chip. Here, we use the MIPS instruction set, because the instruction set is simple and regular, and it is relatively simple to implement, and my country has formed chips based on the MIPS instruction set, such as Godson. For the address of the funnymachine project, see: funnymachine
  2. If developing in C, we have many compilers available off the shelf. But we are developing in the fscheme language now, so we need a compiler for the fscheme language. It is very difficult and time-consuming to use only MIPS assembly language to write a compiler for fscheme language. In order to bypass this difficulty, we can first use MIPS assembly language to write a small fscheme language interpreter, called bootstrap-scheme, and then Use bootstrap-scheme to write the fscheme compiler. Also, we may need tools like make and ld, which are also written in the bootstrap-scheme language. The make and ld here are also commonly known as toolchains. They are used to link small programs into large programs, which are necessary for us to develop OS. We use S expressions as the input of tools such as make and ld, which makes full use of the advantages of lisp-based languages. When they are all developed, we will have the tools to develop the OS. For the address of the fscheme project, see: fscheme
  3. To develop the OS kernel, you can refer to the implementation of minix at this time, but we are the minix version of the scheme language. We must be very familiar with the implementation mechanism of the OS kernel, such as process scheduling, memory management, file system, IO processing, etc., it is possible to build a complete OS kernel, otherwise just a toy OS is useless to us. Our difficulty lies in using new languages ​​to implement old things, and we may encounter some troubles, such as the encapsulation of structures, we can use closures in fscheme accordingly; such as data structures, whether functional programming has more efficient data Structure is something to study; such as performance, the performance of the fscheme language may be worse than that of C. However, these foreseeable difficulties can be overcome. The real difficulty lies in the fear of the unknown and the lack of adherence to the established path. For the address of the funnyos project, please refer to: funnyos (currently an empty project, the focus is on fscheme first, otherwise it will be impossible to talk about)
  4. Develop your own applications based on the funnyos kernel. First, we can use fscheme to develop pan-language translators, and then use pan-language to develop applications. Pan language is first translated into fscheme language and finally into MIPS machine code. To make an analogy here, the pan language is similar to Java, and the fscheme language is similar to the C language, but they should be able to achieve the same function. The reason I write "should" here is because I don't have time to prove whether the panlanguage is Turing complete, but my intuition tells me it is, and it's another matter if it is proved that it is not. Pan language is close to natural language and supports multiple programming paradigms, making it an ideal choice for application layer development. Why not develop applications directly in the scheme language? The problem is comprehensibility, more than 7 layers of scheme brackets are difficult to understand, coupled with ugly macro syntax, resulting in a language fragment that may only be understood by the author himself. That is very unfavorable for developing applications.

        On paper, I feel shallow at the end, and I absolutely know that this matter has to be done! Of course, it is useless to talk on paper here. Good applications are made step by step, so I won't say more, and spend time on learning and exploring. Because I am not a student, my work is not related to OS development, and I have a family, so my time is very limited, and it is impossible for me to complete this project by myself. I am looking for people of insight to join this project, and we can work together to communicate. However, I remind you that this project is still in exploration, and it is currently being implemented while exploring, so it is likely to fail, and you need to pay at your own risk for no reward (I just have an idea now, you may laugh How come I can't even see a single line of kernel code, I don't mind, I have enough patience, I just don't have much time. Also, it's better to finish funnymachine and fscheme before thinking about funnyos, it will be easier to find some problems). You can also use this as an opportunity to learn and improve, and you can be proud if funnyos succeeds one day and leaves your mark.
        I have prepared some necessary study materials in this space for your reference:
        If you want to join the funnyos project or projects related to funnyos, you can contact funnyos by email first, I welcome it! Or have better suggestions for the project, or even objections, you can also contact me, thank you!
        Today is May 1st Labor Day, I wish all workers a happy holiday!

Guess you like