Friday, October 07, 2011

Jari OS RPCv7 and Vnode

I wrote before why IDL failed. And I know that old uni_rpc_t RPC is failed too, it's not flexible, ugly and slow.
I'm working on this system about 5-6 years, well, and there are 6 attempts to create good IPC/RPC chain:
- v1 create a lot of structures and calls and implement it on the microkernel side
- v2 create one generic RPC in microkernel side
- v3 remove it from microkernel
- v4/v5 uni_rpc_t and related, try to assign all operation to the standard POSIX calls
- v6 IDL
None of this approaches are applicable.
I guess it's all about a way to resolve the problem. Each time I was try to solve one problem, not the set of those.
But, let's back to my favorite method of problem solving: divide and solve.
When you have a one big problem, it's better to divide it to many little ones, and solve it - one by one, and finally your big problem will be solved. Simple, isn't it ?
And now, we have a system, with many objects, with many problems, but ... make a guess, all of operations within this complex system is requests to the objects.
In that case, you just need to create the one generic object that may represent anything you want and provide generic interface to this object.
Well, you are welcome to the RPCv7.
Usually you can divide all your operations between several groups, to take a data, to control object and so on. Also, in Jari OS you need to have session with this object. That's all.
All your requests might be described with one generic header, not the data of the requests, not the some specific flags like it was done in v4/v5 versions, the header will describe request only.
struct rpc_signature.
Other stuff, are not RPCv7 stuff, it might be your data, headers and so on.
It was a first small problem solved. The second one is object representation.
And I got it, vnode, all things might be represented as vnode, it might have a memory mapping, set of many specific operations, many IDs, relations ... and RPC callbacks, the standard set
of it.
All you need - just implement this functions and forget about IPC/RPC headache.
And carrier function:

All data going via sbuf, just forget about IPC/RPC chain.

Well, I will write later about this implementation more, but you can always checkout the fresh sources.

Why IDL fail, or, sometimes you need to fail first, to rise next

IDL for microkernel multiservice system is fail. No, not just because it wasn't implemented, going deeper - it's implemented.
Okay , let's try to understand why, but first - I spent a very lot of time to design and implement IDL for this purposes without any applicable results - that's my fail first, and that's an idea fail second.
Usually you have a simple IDL case: take the message, parse it, call the server function, serialize it and reply. It's common for client-server architecture widely used, and yes, there are many already implemented IDLs for this simple case. Most of IDLs covers this needs.
You can told me about L4 IDL - you are welcome, I didn't see any serios developed with L4 IDL, and I can told you - it will suck.
My approach was more complex.
In case of Jari OS services you need more than receive - call - reply cycle. Request might be postponed, or changed and forwarded.
In real system (not like L4 ping-pong demos), to resolve resource by the name (symlinks and files) you always need to forward it, because symlink and file might be located on different servers. Also, on real system, blocking of server threads is a quite poor idea.
IDL concept was very simple before I've added postponed and forwarded messages, but it wan't so fatally, to get away with this idea.
The next problem was faced later, like time-bomb, it was message modification.
Finally I've got something huge, and not flexible and scalable.
IDL implementation with support of this features are not simply than some RPC interface.
Well, at this point I decide to stop it. I spent something about 1 year to design, research, test and try it - and got the ugly solution.
However, in Jari OS you will be able to use IDL with this features, but it will not used in the base system.

IDL research implementation here - http://jarios.org/gitweb/?p=jari_os.git;a=summary , checkout idlc branch.

Wednesday, May 12, 2010

Approach to the file system design

Within microkernel operating system you may do different kind of interesting things.
Today is a day of file systems, I'm currently working on the file layer general design and there are some feature to implement, well, I can told that it's a several features implemented may.
The first is a copy-on-write feature, well it might be implemented over the file system implementation.
while you have an vnode on top of the implementation you may create a virtual remote link to other file system vnode, and it will goes transparently for implementation. When you will got a miss on the block device of the current filesystem you may take this data from another one, remotely.
Another case of this feature is a creating a new function that will clone files in the fast way, just creating a shadow vnode on the destination file system.

I will research this cases later and write it here, it's not so good to write it in bus.