Hacker News new | ask | show | jobs
by xfs 2227 days ago
Is it correct to think of it as application code running as PID 1 in kernel space? Can I fork or create threads? Can I directly access kernel's internal APIs like a kernel module?
2 comments

> Is it correct to think of it as application code running as PID 1 in kernel space?

getpid exists and returns a number - in fact it can return any number you like :-) Everything is linked into a single vmlinux which runs in a single address space. (As an aside I'll have to remember to ask Ali if he's thought about what number getpid() should return in UKL - I guess returning 1 would cause least surprise)

> Can I fork or create threads?

Fork no, threads yes. Threads are implemented using kernel threads.

> Can I directly access kernel's internal APIs like a kernel module?

Yes, although whether this is a good idea is another matter. Note that it's still Linux so internal APIs are unstable and can go away or change their meaning at any time, so if your application starts to rely on internal APIs you could quickly get into trouble.

Slight clarification. Yes, UKL has normal kthreads, but all the application code runs using pthreads. And their implementation is unchanged, except the fact that they do function calls instead of syscall.
Not quite. Everything runs as PID 0. :-)

There are no processes here. Everything runs inside the kernel. You don't have exec(), fork() or similar.

Is this just bare metal embedded development, with a nice HAL?
We're hoping that many regular server-type applications can be ported simply by recompiling them.