Skip to content

Latest commit

 

History

History
92 lines (76 loc) · 8.43 KB

xnu_vs_android_kernel.md

File metadata and controls

92 lines (76 loc) · 8.43 KB
iOS (XNU) Kernel Function Android (Linux) Kernel Function Description
task_for_pid find_task_by_vpid Find a task_struct by its process ID
vfs_getattr vfs_stat Get file attributes (stat)
vfs_read vfs_read_file Read data from a file
vfs_write vfs_write_file Write data to a file
kern_return_t int or void Return type for various kernel functions
mach_msg ipc_send or ipc_receive Inter-process communication using messages
thread_create kthread_create Create a new thread
vm_map mm_struct Data structure representing a virtual memory map
kern_execve do_execve Execute a new program
kern_fork do_fork Create a new process (fork)
kern_exit do_exit Terminate a process (exit)
kern_wait4 do_wait Wait for a child process to exit
thread_terminate do_exit Terminate a thread
thread_suspend send_sig Suspend a thread
thread_resume send_sig Resume a suspended thread
vm_allocate vm_mmap Allocate virtual memory
vm_deallocate vm_munmap Deallocate virtual memory
mach_vm_protect mprotect Change memory protection
task_suspend send_sig Suspend a task (process)
task_resume send_sig Resume a suspended task (process)
vfs_lookup d_find_alias or lookup_dentry Lookup a file or directory in the filesystem
iOS (XNU) Kernel Struct Android (Linux) Kernel Struct Description
task_struct task_struct Represents a process or task
thread task_struct Represents a thread within a process
vm_map mm_struct Represents a virtual memory map
vm_object vm_area_struct Represents a virtual memory object
vm_page page Represents a page of virtual memory
file file Represents an open file descriptor
dentry dentry Represents a directory entry in the filesystem
inode inode Represents an inode in the filesystem
file_operations file_operations Defines file operation functions
super_block super_block Represents a filesystem superblock
address_space address_space Manages the address space of a process
mmu_gather mmu_gather Used for TLB (Translation Lookaside Buffer) operations

Certainly, here are the tables in markdown format with some indication of relevant versions or start years where applicable:

Scheduling Policies and Priorities:

iOS (XNU) Scheduler Android (Linux) Scheduler Description
Priority-Based (Mach) Completely Fair Scheduler (CFS) Introduced in iOS (XNU) 2.5 (early versions used a different scheduler)
Real-Time and Fair Schedulers (Mach) Round Robin Scheduler Real-time scheduler (Fixed priority) and fair scheduler for background tasks in iOS
Priority Ranges (Mach) Nice Values Priority values typically range from -20 to +20 in Android

IPC Mechanisms:

iOS (XNU) IPC Mechanisms Android (Linux) IPC Mechanisms Description
Mach Messages Inter-Process Communication (IPC) Mach IPC is part of the XNU kernel, while Android uses Binder IPC
Port Rights (Mach) Binder IPC Binder IPC framework introduced in Android 1.0
XPC (XNU) Socket IPC XPC introduced in iOS 7 (Grand Central Dispatch, GCD)

File Systems:

iOS (XNU) File Systems Android (Linux) File Systems Description
HFS+ (Historically) Ext4 (Historically) Default file systems in older versions
APFS (Current) F2FS (Some Devices) APFS introduced in iOS 10, F2FS used on some Android devices
File System APIs VFS (Virtual File System) Abstraction layers for file operations

Memory Management:

iOS (XNU) Memory Management Android (Linux) Memory Management Description
Mach Virtual Memory System Page Cache and Slab Allocator Mach VM system in iOS (XNU), Page Cache and Slab Allocator in Linux
ARC (Automatic Reference Counting) Garbage Collection (Java) iOS memory management for Objective-C/Swift, Java GC for Android

Power Management:

iOS (XNU) Power Management Android (Linux) Power Management Description
Advanced Power Management (APM) Advanced Power Management (APM) Power-saving strategies and APIs for devices
Energy Impact Measurement Battery Stats Framework Introduced in iOS 9, Battery Stats in Android

Device Drivers:

iOS (XNU) Device Drivers Android (Linux) Device Drivers Description
Proprietary and Open-Source Drivers Kernel and Vendor-Specific Drivers iOS uses proprietary drivers for Apple devices, Android uses a combination of open-source and vendor-specific drivers
IOKit Framework (XNU) Hardware Abstraction Layer (HAL) Abstraction layers for device interaction

Security Models:

iOS (XNU) Security Model Android (Linux) Security Model Description
App Sandbox (App Store) SELinux (Security-Enhanced Linux) App sandboxing enforced in iOS, SELinux introduced in Android 4.3 (Jelly Bean)
Code Signing (App Store) Android Permissions System Code signing required for iOS apps, Permissions system for Android apps