Brendan wrote:
Let me see if I understand this right..
Well, you don't. I quite clearly said "If [...] there are no other threads running, the process will be killed."
Brendan wrote:
Of course maybe you're forced to have minimum of 2 threads; where if thread1 crashes then thread2 handles the message and calls "raise()", and if thread2 crashes then thread1 handles the message and calls "raise()". I don't know (it sounds like an ugly mess, but it's the only thing that makes sense).
Yes, I said that there has to be another thread to receive the message. That is quite rightly "the only thing that makes sense" in my system. A typical process will have a thread dedicated to receiving and handling messages, so that thread would call "raise()" if POSIX-like behaviour is desired by the programmer. There is the possible case of what happens when
that thread crashes of course, which I do plan to account for. (In short, there will be 3 possible "message states" for a thread; waiting for message, processing message or doing something else. There will be atomic transitions between the first two states. If at any time there is a "critical" message in the queue and no non-halted thread in one of the first two states, the process is killed.)
Brendan wrote:
In any case; it's just a different way of doing it. It still involves the kernel's exception handlers.
Sure, the kernel is going to need those exception handlers in order to do anything at all when an exception occurs (even if it's kill the process and erase it from disk as you seem to be suggesting). However, as I said, this is far beyond the needs of the C standard. The
only things that C requires is that you can register a "signal handler" with "signal()" and call it with "raise()". That requires no kernel support.
Brendan wrote:mallard wrote:
According to you, just about every major OS ever is "pure idiocy".
Of course (but not necessarily just for this reason alone).
Well, that's your opinion I suppose. Personally, I'd rather trust the opinions of the developers of actual, successful (by my definition of the word, see below) OSs.
Brendan wrote:
On a scale from "0% safe" to "100% safe"; where "100% safe" is perfect software and "0% safe" is the minimum requirement (e.g. able to reduce risk of data loss caused by power failure where necessary); what reason do I have to care about something so badly designed that it doesn't even come close to "0% safe"? For everything that actually matters ("0% safe or better") signals are useless.
And how will you enforce this "minimum requirement"? Considering that very little software in existence (and certainly nothing that a "normal user" might use) comes anywhere close to your "0%" standard, it seems that what you're talking about is not a general-purpose OS. Programmers are human. Humans make mistakes. Punishing the user with loss of data for a programmer's mistake is not good design.
Brendan wrote:
There *is* harm in the belt-and-braces approach - it's like a safety net with massive gaping holes in it.
A safety net with "gaping holes" is still better than no net at all. You're not going to convince me that adding extra features to enhance reliability is a bad thing. Would you be happy to travel in a car with no safety features (crumple zones, airbags, seatbelts) because the driver told you that he's "a perfect driver"? Of course not. Same goes for software. No matter how good the programmer thinks his code is, the unexpected can and, over the course of time, will eventually happen. Even mathematically proven code can fail due to hardware glitches.
Brendan wrote:
mallard wrote:Also, how do you expect to implement debugging on your OS?
Mostly via. remote control; where one process (the debugger) attaches itself to another process (the process being debugged, which may be already running on a completely different computer); where the kernel grants the first process special abilities. These special abilities include receiving notifications for various events (e.g. when the process spawns/terminates threads, allocates/frees virtual pages, etc); being sent copies of messages sent/received by the threads being debugged; asking for copies of arbitrary areas of RAM from the process being debugged; being able to stop/restart any or all of the process' threads, etc. If a process being debugged crashes while a debugger is attached, then the kernel's "generic unrecoverable error handler" puts the process into an "all threads stopped" state (which is the first part of terminating it anyway) and then send a message notifying the debugger that the process is now "post mortem" and why.
So, your OS will have all the same infrastructure for notifying processes of errors, just with a more limited "destination" (since only a second process could receive the notifications).
Brendan wrote:
None of this has nothing at all to do with signals. The process being debugged doesn't even know it is being debugged (however there are security checks - the process being debugged must have an "allow debugger to attach" flag in the executable).
You've still got "signals", you're just sending them somewhere else. Also, that "allow debugger to attach" flag seems unnecessary. Programs shouldn't have the ability to restrict the rights of the user; the ability to attach a debugger should be a per-user permission, not something that a program decides.
Brendan wrote:
mallard wrote:How would you run an interpreter/JIT without crippling performance by pre-checking all math operations?
I wouldn't.
So, you're not designing a general-purpose OS. Fine. I am, so I have different design goals. Not too surprising that my design doesn't match yours, when we have different goals in mind.
Brendan wrote:
Also note that "learning" doesn't really change anything (e.g. "learning to successfully fail" vs. "learning to succeed"). For a hobby, I guess there's nothing really wrong with claiming failure is your hobby.
As I said, "Success" and "failure" are entirely subjective opinions. What you consider "success" and "failure" is obviously different from what I consider "success" and "failure". I'm not building an OS to impress you, so your definitions of "success" and "failure" aren't really relevant to me.