操作系统
IPC
- 共享内存
- 管道
- socket
- RPC romote procesure calls
同步机制
- Semaphore And PV
- Mutex
- Monitor
Android中的同步
Mutex
framework/native/include/utils/Mutex.h
就是对pthread
的封装Condition
framework/native/include/utils/Condition.h
包装Mutex-
Barrier
framework/native/services/surfaceflinger/Barrier.h
对Condition的实现wait()
是先释放锁,再休眠,最后再去获取锁,而且当wait()
返回的时候已经释放锁。
内存管理
-
Virtual Memory
- Logic Address --->
Segment Selector
+Offset
- Linear Address---> 段基地址 + 段内偏移量
- Physical Address---> 页基址 + 页内偏移
- Logic Address --->
-
内存的分配与回收
- native
malloc/free
andnew/delete
- java
gc
- native
-
mmap Mermory Map
- 把
设备/文件
映射到进程
的内存空间
- 把
Copy On Wirte 写时拷贝技术
CopyOnWriteArrayList