Zircon systemcall concept - abhishekkumardwivedi/Fuchs1a-doc GitHub Wiki
- System calls with no limitations
- System calls with Handle as first parameter
- System calls creating object but without Handle
Syscalls are provided as libzircon.so virtual dynamic shared library (vDSO) provided by zircon kernel to userspace.
System calls are defined by systemcalls.abigen tool and processed by abigen.
Objects may have multiple handles and gets into destroyed or undone state once the last reference is closed. Handles maybe moved from one process to other by writing into channel using channel_write system call. It could also be process_start system call to pass handle to the first thread of the process. To get acted upon handle or object, there must be correct association and rights. There are system calls available to operate on handles, such as: duplicate, replace, close, close thread of handles.
Kernel object IDs
Each kernel object is given a kernel object Id (koid) which is 64 bit unsigned integer. Artifical koid could also be taken by a program by setting MSB of the koid.
Process, thread and jobs
Process and threads are as same old school concept, process runs in own address space, thread runs in parent process address space. Jobs are owned by parent job all the way upto parent job.
IPC
Double ended bi-directional IPCs are:
- Channels: datagram message. There is no short message concept. Read and write by handle attached to a message. Handle write removes handles from the orign process and on handle read, handle gets attached to remote process. Handle exists during the flight from origin to remote and gets closed (and message destroyed) if remote process is not alive.
- Sockets: stream message. Short message could be sent, such as one or more bytes.
Signals
Objects may have upto 32 signals representing the certain current states.
Events and Event pairs
Simplest object with state of a collection of the active signals.
Event pair is a pair of events which may signal each other. A usful use case is to get peer close assert signal if one of the pair event held process is closed.
Shared memory: Virtual memory objects (VMOs)
VMOs are physical pages of memory which will be created/filled on demand.
Virtual memory address space management(VMARs) keeps an abstraction between address space provided to the created process and having actual space in physical memory.
Futexes
Used for atomicity of user space operations for synchronization.