📜  多道程序和多任务的区别

📅  最后修改于: 2022-05-13 01:56:11.777000             🧑  作者: Mango

多道程序和多任务的区别

多道程序和多任务都与操作系统概念有关

CPU 是一个超快的设备,让它一直被一个任务占用从来都不是一个好主意。考虑到 CPU 速度和 IO 速度之间的巨大差异,引入了许多概念,如多道程序、多任务、多线程等,以提高 CPU 利用率。

多编程:-
多道编程通过组织作业(代码和数据)来提高 CPU 利用率,以便 CPU 始终有一个要执行。这个想法是在主内存中保留多个作业。如果一个作业被 IO 占用,则 CPU 可以分配给其他作业。



多任务处理:-
多任务是多道程序的逻辑扩展。多任务处理是一个操作系统到CPU的机器上同时执行多个任务的能力这些多个任务共享公共资源(如 CPU 和内存)。在多任务系统中,CPU 通过在多个作业之间切换来执行多个作业,通常使用很小的时间量,并且切换发生得如此之快,以至于用户感觉就像在同时与每个正在执行的任务进行交互。

注意: 1. 多任务系统中的任务不是整个应用程序,但当一个进程被划分为子任务时,它可以指一个“执行线程”。

2. 多编程多任务操作系统是分时系统。

多道程序和多任务之间的区别

Sr.no Multiprogramming Multi-tasking 
1. Both of these concepts are for single CPU. Both of these concepts are for single CPU. 
2.Concept of Context Switching is used.Concept of Context Switching and Time Sharing is used.
3.In multiprogrammed system, the operating system simply switches to, and executes, another job when current job needs to wait. The processor is typically used in time sharing mode. Switching happens when either allowed time expires or where there other reason for current process needs to wait (example process needs to do IO).
4.Multi-programming increases CPU utilization by organising jobs .In multi-tasking also increases CPU utilization, it also increases responsiveness.
5.The idea is to reduce the CPU idle time for as long as possible.The idea is to further extend the CPU Utilization concept by increasing responsiveness Time Sharing.

大多数现代操作系统都使用具有更复杂设置的多任务处理。