In some sense C was the DSL to build UNIX. It becomming a general purpose language happened after that and because of the success of UNIX.
Also in general operating systems are extremely complex and need a wide range of functionality and extensibility while being able to easily interface with assembly. That makes a DSL tend towards a general purpose language, as has happened with C.
The question "What is the domain specific language for operating sysyems?" is meaningless and unanswerable, because "operating systems" does not define the D in DSL in any meaningful useful way.
* For instance, when you try to replace all the sh scripts in a distro with say python (as some distros have tried to do) you immediately discover several ways that python is far less convenient for executing external executables and feeding, collecting, piping, their inputs and outputs. Then for all of the arcane annoyances with bash/ksh syntax, it's basic shell / batch / glue functionality is more important than all of it's "not like a better designed general purpose language" annoyances. In other words, exactly, it's not a general purpose language, it's a domain-specific language.
A DSL covering more and different parts of OS development would probably have to be so general that it doesn’t make sense not to use a general purpose language…
AppleScript is a scripting language created by Apple. It allows users to directly control scriptable Macintosh applications, as well as parts of macOS itself. You can create scripts—sets of written instructions—to automate repetitive tasks, combine features from multiple scriptable applications, and create complex workflows.
set targetFolder to POSIX file "/Users/Me/Desktop/MyFolder"
tell application "Finder"
set finderFolder to item targetFolder
set lstTargets to target of every Finder window
if {finderFolder} is in lstTargets then
set target of (make new Finder window) to targetFolder
end if
end tell
That said, AppleScript is probably not long for this world. The future looks more like visual programming via Shortcuts.
Widespread examples include firewalls and routing rules written in DSLs, which get compiled into a form that gets run inside the kernel. Example: nftables in Linux.
Some research OSes allow drivers to be written in a "safe" language to run inside the kernel. Some perform JIT-compilation, others create a custom kernel at compiled-time. Go search for Scout, Termite2, and Synthesis Kernel.
For Windows between 2000 and 7, that would be VBScript. The language itself is primitive, but through various COM APIs (WMI, ADSI, ADO, MSXML, WScript.Shell, etc.) one can do borderline anything with the OS, or even with the whole Windows networks.
Modern Windows, while still supporting VBScript and most of these COM things, has also added PowerShell as another option.
DSLs for interfacing with OSes exist in the form of command shells, syscalls, and ABIs.
Compilers and manuals for these aren’t generally available, but here are published descriptions of two older variants, for use by customers who received source listings on microfiche:
http://www.bitsavers.org/pdf/ibm/360/pls/GC28-0786-0_Guide_t...
http://www.bitsavers.org/pdf/ibm/360/pls/GC28-6794-0_PLSIIgu...
Ansible, Puppet or Nix could also be viewed as operating system DSL. Again depending on what your goal is.
* embedded os : https://blog.felgo.com/embedded/embedded-operating-systems
* OS modules / daemons : ebpf / systemd
* ebpf : https://news.ycombinator.com/item?id=33489935 ; https://news.ycombinator.com/item?id=33462031
* tiny core : https://en.wikipedia.org/wiki/Tiny_Core_Linux
* yocto : https://www.yoctoproject.org/
* 'bootloaders' don't have to just 'load an os' https://wiki.archlinux.org/title/syslinux
* uefi : https://askubuntu.com/questions/651902/what-is-the-differenc...
* OS device drivers for external devices such as printers (post script printers)
* OS api's
I am currently interested in this problem and more specifically the expression problem.
Also the problem of how do you tell a computer to do X operation when it encounters Y.
Computers are often turning machines and state machines.
I recently implemented async/await with a giant switch statement.
Async await is far more powerful than bash jobs.
I think the scheduling of processes on a computer needs a powerful DSL.
Kubernetes is interesting since it scheduled processes on a cluster of nodes. But it doesn't define pipelines.
Kafka defines a pipeline for processing.
Bash defined pipelines of operations and processes text.
Java streams define a pipeline.
JavaScripts promises and C# async/await are interesting for scheduling tasks.
ETL workflows Extract Transform Load and Enterprise service buses often have visual DSL/GUIs with eclipse tools for defining mappings.
In Python I often chain together processes with POpen. But it's very low level
I think all these topics are linked.
I want a DSL for defining operations and chaining them together similar to a pipeline. I also want when_any and when_all support and multithreading support.
Looks like they released the compiler under the MIT license and put it on Github, so you may want to look into it.
https://en.wikipedia.org/wiki/P_(programming_language)
https://www.microsoft.com/en-us/research/project/safe-asynch...
DSLs for operating systems might be easier to write with programming languages that have higher-order unification – meaning that they can automatically piece together programs to fill out the meaning of one smaller word that has a complex, concise meaning – and totality checking, which means that given subprograms can be known to run to completion. And first-class types. (Dependently typed languages.)
This combination allows for tightly controlled and deterministic automation of programming, which is especially useful for getting rid of boilerplate code, conversion between formats, serialization and deserialization – and the maintenance of this kind of code… when all targets are moving targets due to many pieces of software that change from day to day. As found in things as complex and arbitrary as operating systems.
That said, various Lisp Machine systems as well as internals of Lisp implementations often contain DSL for implementing the OS/language, sometimes with many smaller DSLs (while the ur-example is "LOOP" macro from MIT, my favourite is a file from Genera bearing a comment - paraphrased - "behold, I implement half of PL/I to implement structure packing into byte vectors").
Of course, in languages like Lisp or TCL the separation between DSL and main language is not so stark as in case of DSLs implemented in let's say C or Java.
As others have pointed out, *nix systems (Linux in particular) are rife with DSLs. Not just C but (c|ba|k|tc|z)sh, sed, awk, grep, to name a few. Each of these tools has it's own mini DSL, some more complicated than others, that can than be composed to with other tools, using their own DSLs to manage tasks (e.g. operating system tasks).
Even the task of creating DSLs has many DSLs attached to it (lex, yacc, etc.).
Programs that get used and become popular introduce their own DSLs, often times. Apache, NGinx, etc. all have config files that each have their own special sauce of DSL for their own tasks.
Even many of the newer systems like Docker, Kubernetes, etc. have config files/DSLs to manage them.
I'm sure I'm forgetting even more.
There is so much bloat due to everyone making a DSL to learn distributed systems with, or every little bit of UNIX coming with its own text config format.
I’d like to get away from generating yaml for Docker and k8s and import balancing forks of microservice logic v8 style; read kernel telemetry from eBPF in the app to determine how many forks the code can add or needs to subtract, and terraform because it’s still just a Linux box under there.
But the cottage industry that profits from these ideas is threatened by these ideas and sticks with showing off a new arbitrary string parser that ALSO sends the strings to an API for you!
The software industry has turned into a jobs program and has little to do with novel engineering.
If something were to offer a DSL for writing operating systems with, I think it would be either an embedded platform or a hypervisor.