看板Programming
标 题Re: [问题] dos为何要有记忆体配置的中断指令?
发信站中央大学松涛风情资讯站 (Sat Apr 14 07:30:03 2007)
转信站ptt!ctu-reader!ctu-peer!ctu-gate!news.nctu!news.ncu!news.csie.ncu!Ever
> ==>发信人: [email protected] (), 信区: programming
> http://www.ctyme.com/intr/rb-2980.htm
> DOS 2+ internal - SET CURRENT PROCESS ID (SET PSP ADDRESS)
> AH = 50h
> BX = segment of PSP for new process
> Notes: DOS uses the current PSP address to determine which processes own
> files and memory; it corresponds to process identifiers used by other OSs.
> Under DOS 2.x, this function cannot be invoked inside an INT 28h handler
> without setting the Critical Error flag. Under MS-DOS 3.0+ and DR DOS 3.41+,
> this function does not use any of the DOS-internal stacks and may thus be
> called at any time, even during another INT 21h call. Some Microsoft
> applications such as Quick C 2.51 use segments of 0000h and FFFFh and direct
> access to the SDA (see #01687 at AX=5D06h) to test whether they are running
> under MS-DOS rather than a compatible OS; although one should only call this
> function with valid PSP addresses, any program hooking it should be prepared
> to handle invalid addresses. This function is supported by the OS/2
> compatibility box. This call was undocumented prior to the release of DOS 5.0
> See Also: AH=26h - AH=51h - AH=62h
> Category: DOS Kernel - Int 21h - D
===============================================
MS-DOS 1.0 是 CP/M 80 的 8086 clone 版, CP/M-80 原先是用 PL/M 高阶语言
写的, 8086 CPU 出来後, 高阶语言没有那麽快出来, 所以 IBM 找了当时代理微
电脑所有高阶语言软体销售的 MicroSoft 希望尽快完成 OS , 而 MS-DOS 1.0
版就是用了反组译的 CP/M-80 再用 8086 相当於 8080 指令同功能的一部份指令
做替代, 在 16bit 的 CPU 上只沿用 8bit 部份做模拟(现在较流行的术语), 用
8086 组语就比 Digital Research 早一步做出了 CP/M-80 的 8086 版. 这是一
个典型的 "以快打慢, 趁虚而入".
当时的 Digital Research 已经有 MP/M-80 , 这是 CP/M-80 的 multi-user
版, 而且与 CP/M-80 算是具有相当多的相容性(但还是不完全是, 尤其那个 ^P
screen dump printing 就难隔离老式 CP/M-80 程式), DR 後来推出单用户版的
Concurrent CP/M (CCP/M , 宏碁最早外销 PC 用的 OS , 使用指令式多视窗) 与
MS-DOS 竞争. MS-DOS 2.0 当时最大的改变是使用 UNIX 的 Tree Directory file
但仍与 V1.0 CP/M-86 相容, 同时去做了 Xenix OS.
因为 MS-DOS 本来就来自於 CP/M , 所以 PSP (program segment prefix,
这是 MS 另起的名称)就沿用了大部份的功能, 但 MP/M 在此区块做的记号是 user
number , 所以就用每个载入程式的 segment 做区分, 而 segment 的用法就是原
先 8080/85 时代 Bank Memory (MP/M 在 8085/Z80 CPU 使用的扩大记忆体方法,
每个 user 独立使用一个 Bank, Bank2 就相当於 segment prefix 2000) 的改良
版. 在没有网路时代的 PC , 每个 user 就是每个 user program 也就是每个 user
process , 而每个 User Program 确实也是由 command.com 这个 CLI (CP/M 称为
CCP)载入程式执行(这是通称的 Process, A Running Program)而来. 但 DOS 与
Concurrent DOS (CCP/M 对 DOS File System 相容的 DR OS) 两者的最大不同就是
一个是没有 Multi-Process 能力, 一个有. 只是没有的那个就说是 Single Process
Seriously Operation .
很多多工作业系统, 事实上是先於 MS-DOS , 在多工下早就使用 Process 这个
称呼, 而 Process 执行时不只要占据记忆体还得能分配得到 CPU 执行, 为了在
Single Processor 与 Multi-Processor 的机器都能一致解释与应用(就是 Hardware
Abstraction), 甚至舍弃 Task 而改用 Process , 而 Process 含有 VM 的 Virtual
Processor 概念, 是会有 Processor 去照顾的.
如果要说 PC 用的 DOS 有 Process 的概念与实质的会是 Concurrent DOS ,若
说纯原始的 MS-DOS 就会有误解.
Win3.1 跟 C-DOS/386 比较起来, Window 的胜出其实是很谨慎的处理使用者喜
欢 Graphic Display 及很多 AP 不经 OS 直接使用显示卡(Game)这个事实. 由於 DR
的 MP/M CCP/M C-DOS 跨不过让显示需求与 Real Mode I/O 持续相容的难题, 就被
该冲就冲(CP/M-86), 该缩就缩(Win3.1)的 MicroSoft 给端了. MicroSoft 在 Multi
-Process 的概念与应用上也是很谨慎的在区隔传统主机上 Multi-Processing 的差
异, 为了就是不要引起过度的预期, 以免有不愉快的使用经验. MS-DOS 2.X 时代,
如果 MS 猛宣扬保证是跟传统单用户程式能相容又能有多工效率, 那大概被 UNIX 给
端了(因为 UNIX 下少有单用户的 AP 软体, 不会有那种难替所有 AP 善後的麻烦).
======
MS-DOS 是 Single User , Single Process , Single Thread 的系统,早就发展
出 user space multiple thtreads 的 Micro-Kernel 概念啦. 这样说能被接受吗 ?
--
◎ Origin: 中央松涛站□bbs.csie.ncu.edu.tw From: 140.115.6.234
1F:推 abcdefghi:又来了,讲不出道理,就开始背历史.. 140.113.23.107 04/14 08:23
2F:推 dolphinus:他几时讲的出道理过...218.168.202.230 04/15 00:09