最近困恼的一个问题, 要写一个应用, 是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
-
Preemptive Multitasking
-
Support for Symmetric Multiprocessing (SMP)
-
Integrated Networking Services
-
Support for 2 Gbyte linear address spaces for applications and 2 Gbyte address space for the OS.
-
Support for several file systems
-
Client/Server architecture
今天先到这了, 后期看了再续上.......
-