php旧版本windows_Windows的旧版本中如何进行多任务处理?
php舊版本windows
Considering that DOS was a single-tasking OS and the ties it had with early versions of Windows, just how did earlier versions of Windows manage to accomplish multi-tasking? Today’s SuperUser Q&A post looks at the answers to this question.
考慮到DOS是單任務(wù)操作系統(tǒng),并且與早期Windows版本具有聯(lián)系,那么早期Windows版本如何完成多任務(wù)處理? 今天的“超級(jí)用戶問答”帖子著眼于該問題的答案。
Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.
今天的“問答”環(huán)節(jié)由SuperUser提供,它是Stack Exchange的一個(gè)分支,該社區(qū)是由社區(qū)驅(qū)動(dòng)的Q&A網(wǎng)站分組。
Windows 95 screenshot courtesy of Wikipedia.
Windows 95屏幕截圖由Wikipedia提供。
問題 (The Question)
SuperUser reader LeNoob wants to know how older versions of Windows were able to run as multi-tasking systems?:
超級(jí)用戶讀者LeNoob想知道Windows的舊版本如何能夠作為多任務(wù)系統(tǒng)運(yùn)行?
I read that DOS is a single-tasking OS. But if older versions of Windows (also including Windows 95?) were just wrappers for DOS, how could they run as a multi-tasking OS?
我讀到DOS是一個(gè)單任務(wù)操作系統(tǒng)。 但是,如果舊版本的Windows(還包括Windows 95?)只是DOS的包裝,它們?nèi)绾巫鳛槎嗳蝿?wù)OS運(yùn)行?
Good question! How did older versions of Windows manage to run as multi-tasking systems?
好問題! Windows的較早版本是如何設(shè)法作為多任務(wù)系統(tǒng)運(yùn)行的?
答案 (The Answer)
SuperUser contributors Bob and Pete have the answer for us. First up, Bob:
超級(jí)用戶貢獻(xiàn)者Bob和Pete為我們找到了答案。 首先,鮑勃:
Windows 95 was far more than “just a wrapper” for MS-DOS. Quoting Raymond Chen:
Windows 95不僅僅是MS-DOS的“包裝” 。 引用雷蒙·陳:
- MS-DOS served two purposes in Windows 95: 1.) It served as the boot loader. & 2.) It acted as the 16-bit legacy device driver layer. MS-DOS在Windows 95中有兩個(gè)用途:1.)它用作引導(dǎo)加載程序。 &2.)充當(dāng)16位舊式設(shè)備驅(qū)動(dòng)程序?qū)印?
Windows 95 actually hooked/overrode just about all of MS-DOS, keeping it as a compatibility layer while doing all the heavy lifting itself. It also implemented pre-emptive multi-tasking for 32-bit programs.
Windows 95實(shí)際上幾乎鉤住/覆蓋了所有MS-DOS,在進(jìn)行所有繁重的工作時(shí)將其保留為兼容層。 它還為32位程序?qū)崿F(xiàn)了搶先式多任務(wù)處理。
Pre-Windows 95
Windows 95之前
Windows 3.x and older were mostly 16-bit (with the exception of Win32s, a kind of compatibility layer that bridges 16 and 32, but we will ignore that here), were more dependent on DOS, and used only cooperative multi-tasking – that is the one where they do not force a running program to switch out; they wait for the running program to yield control (basically, say “I am done” by telling the OS to run the next program that is waiting).
Windows 3.x和更早的版本大多是16位的(Win32s除外,后者是一種橋接16和32的兼容層,但是在這里我們將忽略它),它們更多地依賴于DOS,并且僅使用協(xié)作式多任務(wù)處理–那就是他們不強(qiáng)迫正在運(yùn)行的程序退出的程序; 他們等待正在運(yùn)行的程序產(chǎn)生控制權(quán)(基本上是通過告訴OS運(yùn)行正在等待的下一個(gè)程序來說“我完成了”)。
- Multi-tasking was cooperative, just like in old versions of MacOS (though unlike Multi-tasking DOS 4.x, which sported pre-emptive multi-tasking). A task had to yield to the OS in order to schedule a different task. The yields were built into certain API calls, notably message processing. As long as a task processed messages in a timely manner, everything was great. If a task stopped processing messages and was busy executing some processing loop, multi-tasking was no more. 就像在舊版本的MacOS中一樣,多任務(wù)是協(xié)作的(盡管與多任務(wù)DOS 4.x不同,后者具有先發(fā)制人的多任務(wù)功能)。 任務(wù)必須屈服于OS才能安排其他任務(wù)。 收益內(nèi)置于某些API調(diào)用中,尤其是消息處理。 只要任務(wù)能夠及時(shí)處理消息,一切就很好。 如果任務(wù)停止處理消息并忙于執(zhí)行某些處理循環(huán),則不再需要多任務(wù)處理。
Windows 3.x Architecture
Windows 3.x體系結(jié)構(gòu)
As for how early Windows programs would yield control:
至于早期的Windows程序如何產(chǎn)生控制權(quán):
- Windows 3.1 uses cooperative multi-tasking – meaning that each application that is in the process of running is instructed to periodically check a message queue to find out if any other application is asking for use of the CPU and, if so, to yield control to that application. However, many Windows 3.1 applications would check the message queue only infrequently, or not at all, and monopolize control of the CPU for as much time as they required. A pre-emptive multi-tasking system like Windows 95 will take CPU control away from a running application and distribute it to those that have a higher priority based on the system’s needs. Windows 3.1使用協(xié)作式多任務(wù)處理-意味著正在運(yùn)行的每個(gè)應(yīng)用程序都被指示定期檢查消息隊(duì)列,以查找是否有其他任何應(yīng)用程序正在請(qǐng)求使用CPU,如果有,則請(qǐng)求控制。該應(yīng)用程序。 但是,許多Windows 3.1應(yīng)用程序只會(huì)很少或根本不檢查消息隊(duì)列,并在所需的時(shí)間內(nèi)獨(dú)占CPU的控制權(quán)。 像Windows 95這樣的搶占式多任務(wù)系統(tǒng)將使CPU失去對(duì)正在運(yùn)行的應(yīng)用程序的控制,并根據(jù)系統(tǒng)的需要將其分配給優(yōu)先級(jí)更高的應(yīng)用程序。
Source
資源
All DOS would see is this single application (Windows or other) running, which would pass control around without exiting. In theory, pre-emptive multi-tasking can possibly be implemented on top of DOS anyway with the use of a real-time clock and hardware interrupts to forcibly give control to the scheduler. As Tonny comments, this was actually done by some OSes running on top of DOS.
DOS只會(huì)看到該單個(gè)應(yīng)用程序(Windows或其他)正在運(yùn)行,它將在不退出的情況下傳遞控制權(quán)。 從理論上講,搶占式多任務(wù)可以通過使用實(shí)時(shí)時(shí)鐘和硬件中斷在DOS之上實(shí)現(xiàn),以強(qiáng)制控制調(diào)度程序。 正如Tonny所言,這實(shí)際上是由一些在DOS之上運(yùn)行的操作系統(tǒng)完成的。
386 Enhanced Mode?
386增強(qiáng)模式?
Note: there have been some comments on 386 enhanced mode of Windows 3.x being 32-bit, and supporting pre-emptive multi-tasking.
注意:關(guān)于Windows 3.x的386增強(qiáng)模式(32位)并支持搶先式多任務(wù)處理,已有一些評(píng)論。
This is an interesting case. To summarise the linked blog post, 386 enhanced mode was basically a 32-bit hypervisor, which ran virtual machines. Inside one of those virtual machines ran Windows 3.x standard mode, which does all the stuff listed above.
這是一個(gè)有趣的案例。 總結(jié)鏈接的博客文章,386增強(qiáng)模式基本上是運(yùn)行虛擬機(jī)的32位管理程序。 在其中一個(gè)虛擬機(jī)中運(yùn)行Windows 3.x標(biāo)準(zhǔn)模式,該模式執(zhí)行上述所有操作。
MS-DOS would also run inside those virtual machines, and apparently they were pre-emptively multi-tasked – so it seems that the 386 enhanced mode hypervisor will share CPU time slices between the virtual machines (one of which ran normal 3.x and others which ran MS-DOS), and each VM will do its own thing – 3.x would cooperatively multi-task, while MS-DOS would be single-tasked.
MS-DOS也將在這些虛擬機(jī)中運(yùn)行,并且顯然它們是搶先式的多任務(wù)處理-因此,似乎386增強(qiáng)模式虛擬機(jī)監(jiān)控程序?qū)⒃谔摂M機(jī)之間共享CPU時(shí)間片(其中一個(gè)運(yùn)行正常的3.x和其他運(yùn)行MS-DOS的計(jì)算機(jī)),則每個(gè)VM都會(huì)做自己的事– 3.x將協(xié)同執(zhí)行多任務(wù),而MS-DOS將是單任務(wù)。
MS-DOS
微軟DOS
DOS itself was single-tasking on paper, but it did have support for TSR programs that would stay in the background until triggered by a hardware interrupt. Far from true multi-tasking, but not fully single-tasked either.
DOS本身只是單任務(wù),但是它確實(shí)支持TSR程序,這些程序?qū)⒁恢痹诤笈_(tái)運(yùn)行,直到被硬件中斷觸發(fā)為止。 遠(yuǎn)非真正的多任務(wù)處理,但也不是完全單任務(wù)處理。
All this talk of bit-ness? I asked about multi-tasking!
所有這些關(guān)于位的話題? 我問了多任務(wù)!
Well, strictly speaking, the bit-ness and multi-tasking are not dependent on each other. It should be possible to implement any multi-tasking mode in any bit-ness. However, the move from 16-bit processors to 32-bit processors also introduced other hardware functionality that could have made pre-emptive multi-tasking easier to implement.
好吧,嚴(yán)格來說,位和多任務(wù)并不相互依賴。 應(yīng)該可以以任何位方式實(shí)現(xiàn)任何多任務(wù)模式。 但是,從16位處理器向32位處理器的遷移還引入了其他硬件功能,這些功能可以使搶先式多任務(wù)更易于實(shí)現(xiàn)。
Also, since 32-bit programs were new, it was easier to get them to work when they were forcibly switched out – which might have broken some legacy 16-bit programs.
另外,由于32位程序是新的,因此在強(qiáng)制退出時(shí)更容易使它們工作-這可能會(huì)破壞某些舊的16位程序。
Of course, this is all speculation. If you really want to know why MS did not implement pre-emptive multi-tasking in Windows 3.x (386 enhanced mode notwithstanding), you will have to ask someone who worked there.
當(dāng)然,這全是猜測(cè)。 如果您真的想知道為什么MS在Windows 3.x中沒有實(shí)施搶先式多任務(wù)處理(盡管有386增強(qiáng)模式),則必須問在那里工作的人。
Also, I wanted to correct your assumption that Windows 95 was just a wrapper for DOS.
另外,我想糾正您的假設(shè),即Windows 95只是DOS的包裝。
Followed by the answer from Pete:
隨后是Pete的回答:
In a modern operating system, the operating system controls all hardware resources, and running applications are kept in sandboxes. An application is not permitted to access memory that the OS has not allocated to that application, and it cannot directly access hardware devices in the computer. If hardware access is required, the application must communicate through device drivers.
在現(xiàn)代操作系統(tǒng)中,操作系統(tǒng)控制所有硬件資源,并且正在運(yùn)行的應(yīng)用程序保存在沙箱中。 不允許應(yīng)用程序訪問操作系統(tǒng)尚未分配給該應(yīng)用程序的內(nèi)存,并且該應(yīng)用程序不能直接訪問計(jì)算機(jī)中的硬件設(shè)備。 如果需要硬件訪問,則應(yīng)用程序必須通過設(shè)備驅(qū)動(dòng)程序進(jìn)行通信。
The OS can enforce this control, because it forces the CPU to enter protected mode.
操作系統(tǒng)可以強(qiáng)制執(zhí)行此控制,因?yàn)樗梢詮?qiáng)制CPU進(jìn)入保護(hù)模式。
DOS, on the other hand, never enters protected mode, but stays in real mode (*see below). In real mode, the running applications can perform anything that it wants to, i.e. access hardware directly. But an application running in real mode can also tell the CPU to enter protected mode.
另一方面,DOS永遠(yuǎn)不會(huì)進(jìn)入保護(hù)模式,而是停留在實(shí)模式( *見下文)。 在實(shí)模式下,正在運(yùn)行的應(yīng)用程序可以執(zhí)行其想要執(zhí)行的任何操作,即直接訪問硬件。 但是,以實(shí)模式運(yùn)行的應(yīng)用程序也可以告訴CPU進(jìn)入保護(hù)模式。
And this last part allows applications like Windows 95 to start a multi-threaded environment even though they were basically launched from DOS.
最后一部分允許Windows 95之類的應(yīng)用程序啟動(dòng)多線程環(huán)境,即使它們基本上是從DOS啟動(dòng)的也是如此。
DOS (Disk Operating System) was, as far as I know, not much more than a file management system. It provided a file system, mechanisms for navigating the file system, a few tools, and the possibility to launch applications. It did also allow for some applications to stay resident, i.e. mouse drivers and EMM emulators. But it did not attempt to control the hardware in the computer the way a modern OS does.
據(jù)我所知,DOS(磁盤操作系統(tǒng))只不過是文件管理系統(tǒng)而已。 它提供了文件系統(tǒng),用于導(dǎo)航文件系統(tǒng)的機(jī)制,一些工具以及啟動(dòng)應(yīng)用程序的可能性。 它還確實(shí)允許某些應(yīng)用程序保持駐留,例如,鼠標(biāo)驅(qū)動(dòng)程序和EMM仿真器。 但是,它沒有像現(xiàn)代OS那樣嘗試控制計(jì)算機(jī)中的硬件。
*When DOS was first created in the 1970s, protected mode did not exist in the CPU. It was not until the 80286 processor in the mid 1980s that protected mode became part of the CPU.
*在1970年代首次創(chuàng)建DOS時(shí),CPU中不存在保護(hù)模式。 直到1980年代中期8080處理器才成為保護(hù)模式的一部分。
Make sure to browse on over to the original thread and read through the lively discussion on this topic using the link below!
確保瀏覽下面的原始主題,并使用下面的鏈接閱讀有關(guān)該主題的生動(dòng)討論!
Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.
有什么補(bǔ)充說明嗎? 在評(píng)論中聽起來不錯(cuò)。 是否想從其他精通Stack Exchange的用戶那里獲得更多答案? 在此處查看完整的討論線程。
翻譯自: https://www.howtogeek.com/187631/how-was-multi-tasking-possible-in-older-versions-of-windows/
php舊版本windows
總結(jié)
以上是生活随笔為你收集整理的php旧版本windows_Windows的旧版本中如何进行多任务处理?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 设备占用_如何查看正在占
- 下一篇: 微信小程序 fire_如何在Fire T