最近困惱的一個問題, 要寫一個應用, 是GUI的, 而需要調用到 一個已經寫好的console應用(可能是C或JAVA寫的), 摸索了好久, 知道怎麼在GUI中啟動console了,可麻煩來了, 怎麼互動通訊呢, 想來想去這也是處理序間通訊的事的了, 複習了一下處理序間通訊的方法, 可具體怎麼做還沒找到門路, 後來看到網上的先人們也有遇到過這個問題, 是用管道pipe來實現的, 對標準輸入和輸出進行重新導向, 於是又想知道作業系統下標準輸入輸出是怎麼實現的(特指windows這樣的), 因為在嵌入式作業系統下沒有windows這麼多彎彎道道, 隔離層次這麼多, 是直腸子型的作業系統, 我喜歡這種直接和透明, 不會像windows在你背後做了很多事情, 嵌入式下直接存取硬體buffer, 我想windows下應該也是經過九道十八彎後也是寫相應的buffer實現的吧, 不過中間的九道十八彎是哪些呢? 它是怎麼根據不同的進程把鍵盤輸入和輸出進行分流的呢? 鍵盤的硬體buffer怎麼將資料傳送到上層的呢? 於是在MSDN上看相關的資料, 主要還是I/O方面的, 後來看到win32 subsystem, 越來越多, 感覺有時工作也是, 本來想做一個工作, 要找相應的資料, 慢慢就發散到很多, 感覺最後花了好多時間, 越走越遠, 都沒聚焦到原來的那個工作任務上了 :( 跑題了,呵呵. 後來網上看到一個資料 windows NT architecture, 還是講的比較全面的, 暫時只看了一部分, 不過看起來當初NT設計之初, 可是野心勃勃呀. 以下轉貼一下它的設計目標:
Design goals
Extensibility: easy support for new hardware devices 擺在第一個,看來是覺得靈活通吃最重要了哈
Portability: ability to move the OS to different hardware platforms with minimal effort. 移植性也是很重要的, 是人都想重用呀, 省錢省力地好事
(
- Windows NT code is modular. 沒見過作業系統源碼, 不過SDK,MFC架構都還是符合的
- Majority of the code is written in C and C++. 這個應該不用懷疑吧
- NT contains a Hardware Abstraction Layer (HAL) that provides isolation from the hardware 隔離隔離
- NT runs on Intel x86, MIPS, and Alpha platforms 硬體平台, 似乎還有AMD x86的, 怎麼給忘了
)
Reliability: robustness of the system to hardware, application, and user errors. Achieved through:
isolation of applications from other applications
isolation of applications from the kernel (core of the OS).
A file system (NTFS) capable of recovering from all types of errors including critical disk errors.
Use of redundant storage (disk mirroring) and transaction-based schemes for data storage.
可靠性, 看來也是一大重點, 不過相應也會帶來效率下降, 還有就是多了那麼多中介層次, 需要轉好多彎, 容易搞暈人,呵呵
Compatibility: ability to execute programs written for other OSs or earlier versions of the same OS.
Achieved through:
protected subsystems where different OSs can run in isolation.
compatibility with OS/2, MS-DOS, and IEEE POSIX (Portable Operating System Interface for Computer Environments) 相容性, 就因為這個引入幾個子系統的, 又是一層轉化
Security: protection against unauthorized use of local and network accessible resources,
Achieved through:
a Security Reference Monitor.
Access Tokens
Owner and Group Identifiers
System Access Control Lists (SACLs)
Discretionary Access Control Lists (DACLs)
安全, 永遠的痛.....
Performance: fast response times through good utilization of system resources.
Achieved through:
true 32-bit architecture
Local Procedure Call (LPC) mechanism
Optimization of critical processes such as system calls and page fault handling
critical elements of Windows NT networking software built-in into the privileged portion of the OS.
多層的轉換如何成就效能呢?
根據目標設計規格特徵:
Windows NT Architecture Main Features
今天先到這了, 後期看了再續上.......