Linked by Hadrien Grasland on Sun 29th May 2011 09:42 UTC
OSNews, Generic OSes It's funny how trying to have a consistent system design makes you constantly jump from one area of the designed OS to another. I initially just tried to implement interrupt handling, and now I'm cleaning up the design of an RPC-based daemon model, which will be used to implement interrupt handlers, along with most other system services. Anyway, now that I get to something I'm personally satisfied with, I wanted to ask everyone who's interested to check that design and tell me if anything in it sounds like a bad idea to them in the short or long run. That's because this is a core part of this OS' design, and I'm really not interested in core design mistakes emerging in a few years if I can fix them now. Many thanks in advance.
Thread beginning with comment 474967
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[5]: Comment by Kaj-de-Vos
by Neolander on Sun 29th May 2011 20:38 UTC in reply to "RE[4]: Comment by Kaj-de-Vos"
Neolander
Member since:
2010-03-08

You keep defending your existing notions, instead of entertaining the notion I introduced that is apparently new to you.

I work this way. If you want to prove that your way of thinking is better than mine, you have to expose clearly what's wrong in my way of thinking. Alfman has been successfully doing this when defending the async model vs the threaded model, as such async has now more room in my IPC model.

Do you agree that declarative data is at a higher abstraction level than a procedure call?

Define declarative data, Google and Wikipedia have no idea what this is and I haven't either ;)

Do you agree that not specifying an implementation language is simpler than specifying a specific language?

Simpler? Oh, certainly not, if you consider the whole development cycle. The higher-level abstractions are, the more complicated working with them tends to be, as soon as you get away from the path drawn for you by the abstraction manufacturer and you have to think about what the abstraction actually is (which is, say, the case when implementing the abstraction)

As an example, when explaining sorting algorithms, it is common to draw some sketches that implicitly represent lists (packs of data with an "insert" operation). Now, try to visually represent sorting in an abstract storage area that may be as well a list or an array. How hard is that ?

As another example, which programming abstraction is easier to define to someone who has no programming knowledge : a function or an object ?

If you are not willing to look at common implementations, lessons from history become meaningless, either good or bad. Do you have experience with messaging in Amiga, BeOS, Syllable, microkernels, REBOL, enterprise messaging, or anything else?

I'm not sure what is it that you're calling messaging actually. Are you talking about the concept of processes communicating by sending data to each other (pipes), the idea of communicating over such a data link with a messaging protocol (like HTTP), ... ?

Edited 2011-05-29 20:48 UTC

Reply Parent Score: 1

RE[6]: Comment by Kaj-de-Vos
by Kaj-de-Vos on Sun 29th May 2011 21:01 in reply to "RE[5]: Comment by Kaj-de-Vos"
Kaj-de-Vos Member since:
2010-06-09

I don't have to convince you. You asked for criticisms that would be useful to you. If you don't consider what you requested, it won't be useful to you. It seems my impression was right that you don't understand the concept of messaging, and it would take me a lot of time and energy to change your mental model.

Reply Parent Score: 1

RE[6]: Comment by Kaj-de-Vos
by xiaokj on Sun 29th May 2011 21:36 in reply to "RE[5]: Comment by Kaj-de-Vos"
xiaokj Member since:
2005-06-30

Define declarative data, Google and Wikipedia have no idea what this is and I haven't either ;)

Let me help, whatever I can, here. If, and that is a very big "if", I am correct, he is referring to something really esoteric. It should be a design philosophy coming straight out of things like "Art of Unix Programming".

Apparently, he is trying to tell you that there is a very much more abstract way to deal with stuff than the RPC. To work with RPC, you will need to define the function name and its accepted parameters, and that would then be set in stone. If you used declarative data, then, what you would do is to have the library export a datasheet of "what can I do" and when you pick a specific function, "what options are here", complete with version numbers. Preferably XML. Then, the clients can make do with whatever that is provided.

The benefits of this is that major changes can be done a lot easier than before. However, there is a major downside too: it is much harder to code in that form. The benefits tend to pay out over the long run, but still.

The main point of doing things like this, other than the obviously stated one, is that it makes you get used to declarative data structures. They, on the other hand, make much more sense! As the Art of Unix Programming notes, the human mind is a lot better at tackling complex data than complex code flows. Declarative data structures push the complexity into the data side, so that the overall code becomes a lot cleaner, and it is in there that the benefits can be most easily reaped.

Take the pic language for example. It is a lot easier to declare that you want a rectangle of a certain size, and that its top left corner (NW) corner is connected to an arrow that points to a circle of radius so and so. The code then takes care of the rest. These kinds of code tend to stay sane even with extreme longevity whereas if you tried to define things by coordinates, sooner or later your API will be replaced, for such simplistic API are a dime a dozen. Declarative programming is something like that, and it is really time-saving.

I hope I have correctly captured his idea. I don't know anything, actually, so take some salt with this.

Reply Parent Score: 2

RE[7]: Comment by Kaj-de-Vos
by Kaj-de-Vos on Sun 29th May 2011 21:50 in reply to "RE[6]: Comment by Kaj-de-Vos"
Kaj-de-Vos Member since:
2010-06-09

That's pretty good, except:

- It's not esoteric, but widely used. Hence my example of HTML.

- I do not prefer XML. It has become a reflex for people to come up with that immediately, but like RPC, it's an implementation detail. Actually, I think XML is way too heavy.

- Specification sheets (such as DTDs) are not strictly necessary. This is also an implementation detail. A metadata specification is required if all the world needs to know the meaning of the data, but most interfaces are between parties that know each other and don't need to be understood by parties that have no preexisting knowledge of the interface.

- Therefore, there are no inherent drawbacks of difficult implementation. It can be as simple as you make it.

Reply Parent Score: 1

RE[7]: Comment by Kaj-de-Vos
by Neolander on Mon 30th May 2011 05:11 in reply to "RE[6]: Comment by Kaj-de-Vos"
Neolander Member since:
2010-03-08

Oh, alright, now I see better what is it going.

It would be a bit like using objects for making calls (yeah, yeah, I know, implementation details and stuff).

A malloc implementation could be described like...

//This is written in the PidginObject language
service Malloc [
....option AllocatedSize
]

And for the caller, it'd be like...

mymalloc = setup_service(Malloc)
mymalloc.setproperty(AllocatedSize = <whatever>)
call_service(mymalloc)

...or if we're a messaging freak...

send_message(daemon, "run_service Malloc with option AllocatedSize = <whaterver>, option SaveWilly = no, etc...")

Actually, I plan to use something like that for UI description.

It has at least the following benefits :

-> You can indeed use language-agnostic headers (like XML or CSS). More precisely, you'd use headers written in your own language.
-> The order in which you put function parameters don't matter. That means that you can change one default parameter without redefining all the others "before" it, since there isn't such a concept
-> You can use a consistent data description language for services and UIs, settings, etc...

There are some tricks worth pointing out, though.

First, a significant header parsing overhead has to be here each time a functionality is called, not only when it is declared. This could be quite problematic for low-level stuff that has to be fast.

If you want to fully implement your own communication protocol, and not use those of an existing programming language, then you have to not only write the function prototypes in your new language, but also describe the data with it. Now this is a tricky one. In C, everything can be described in term of blocks of memory with integers inside and pointers. But there, if you want to do things cleanly using your own specifications, you need to create a syntax for arrays, a syntax for objects, a syntax for strings, a syntax for numbers, etc... one for each data abstraction which you want people to be able to use.

What this means is that you'll have to code a data translator that exactly as complex as a modern compiler, and have a great data conversion overhead, akin to that of having heterogeneous OSs written in different languages and running on different networks communicating over a network, except that it'll occur all the time, even when you remain on a local machine, running a single architecture, and doing calls between programs written in the same language. You do not optimize for the common case.

Astonishingly enough, this does not solve the compatibility problem.

The classical compatibility issue is that functions can gain parameters, but not change name, change the name of parameters, change the order of parameters, or lose parameters.

Here, the object replacing our functions cannot change name either (otherwise processes looking for that service using the old name won't find it). Parameters can't get a different name or disappear for the same reason (programs coded for an old version of the service wouldn't work). So basically, all we can do is change the orders in which parameters are written.

My question is, is it worth the performance hit of going back and forth an intermediate representation each time a call is made ? Is it worth the bloat and security risk of having a the translator around each time something as common as a procedure code is made ? Is it worth the extreme coding complexity of that translator, and the lost comfort of being able to use a large number of assumptions about the language being used ? How about rather writing function parameters in the right order the first time ?

Edited 2011-05-30 05:15 UTC

Reply Parent Score: 1