操作系统 非连续分配

In this article, we will learn about the different types of memory management techniques and also the pros and cons of different memory management techniques.

在本文中,我们将学习不同类型的内存管理技术 ,以及不同内存管理技术的优缺点。

Memory management

内存管理

Memory is central to the operation of a computer system. It consists of a large array of words or bytes each with its own address. In uniprogramming system, main memory has two parts one for the operating system and another part is for the program currently being executed. In the multiprogramming system, the memory part of the user is further divided into accommodate processes. The task of the subdivision is cannot out by the operating system and is known as memory management.

内存对于计算机系统的运行至关重要。 它由大量的单词或字节组成,每个单词或字节都有自己的地址。 在单编程系统中,主存储器分为两部分,一部分用于操作系统,另一部分用于当前正在执行的程序。 在多程序系统中,用户的存储部分被进一步分为容纳过程。 细分的任务无法由操作系统执行,因此称为内存管理。

Memory management techniques

内存管理技术

The memory management techniques is divided into two parts...

内存管理技术分为两部分...

  1. Uniprogramming:

    单编程:

    In the uniprogramming technique, the RAM is divided into two parts one part is for the resigning the operating system and other portion is for the user process. Here the fence register is used which contain the last address of the operating system parts. The operating system will compare the user data addresses with the fence register and if it is different that means the user is not entering in the OS area. Fence register is also called boundary register and is used to prevent a user from entering in the operating system area. Here the CPU utilization is very poor and hence multiprogramming is used.

    在单编程技术中,RAM分为两部分,一部分用于重新命名操作系统,另一部分用于用户进程。 这里使用了篱笆寄存器,其中包含操作系统部件的最后地址。 操作系统会将用户数据地址与篱笆寄存器进行比较,如果不同,则意味着用户没有进入OS区域。 栅栏寄存器也称为边界寄存器,用于防止用户进入操作系统区域。 在这里,CPU利用率非常差,因此使用了多程序。

  2. Multiprogramming:

    多重编程:

    In the multiprogramming, the multiple users can share the memory simultaneously. By multiprogramming we mean there will be more than one process in the main memory and if the running process wants to wait for an event like I/O then instead of sitting ideal CPU will make a context switch and will pick another process.

    在多重编程中,多个用户可以同时共享存储器。 通过多程序,我们意味着主内存中将有多个进程,并且如果正在运行的进程要等待I / O之类的事件,则与其坐拥理想的CPU,而是进行上下文切换,然后选择另一个进程。

    1. Contiguous memory allocation
    2. Non-contiguous memory allocation

a)连续内存分配 (a) Contiguous memory allocation)

In contiguous memory allocation, all the available memory space remain together in one place. It means freely available memory partitions are not scattered here and there across the whole memory space.

连续内存分配中 ,所有可用内存空间都在一起放在一个位置。 这意味着免费可用的内存分区不会分散在整个内存空间中。

In the contiguous memory allocation, both the operating system and the user must reside in the main memory. The main memory is divided into two portions one portion is for the operating and other is for the user program.

连续内存分配中 ,操作系统和用户都必须驻留在主内存中。 主存储器分为两部分,一部分用于操作,另一部分用于用户程序。

In the contiguous memory allocation when any user process request for the memory a single section of the contiguous memory block is given to that process according to its need. We can achieve contiguous memory allocation by dividing memory into the fixed-sized partition.

连续存储器分配中,当任何用户处理请求该存储器时,根据其需要将连续存储块的单个部分提供给该处理。 通过将内存划分为固定大小的分区,我们可以实现连续的内存分配。

A single process is allocated in that fixed sized single partition. But this will increase the degree of multiprogramming means more than one process in the main memory that bounds the number of fixed partition done in memory. Internal fragmentation increases because of the contiguous memory allocation.

在该固定大小的单个分区中分配一个进程。 但是,这将增加多程序化的程度,这意味着主内存中有多个进程限制了内存中固定分区的数量。 内部碎片的增加是由于连续的内存分配。

→ Fixed sized partition

→固定大小的分区

In the fixed sized partition the system divides memory into fixed size partition (may or may not be of the same size) here entire partition is allowed to a process and if there is some wastage inside the partition is allocated to a process and if there is some wastage inside the partition then it is called internal fragmentation.

在固定大小的分区中,系统将内存划分为固定大小的分区(大小可能相同,也可能不同),此处允许将整个分区分配给一个进程,如果该分区内部有一些浪费,则将其分配给进程分区中的一些浪费,然后称为内部碎片。

Advantage: Management or book keeping is easy.

优点:管理或簿记都很容易。

Disadvantage: Internal fragmentation

缺点:内部碎片化

→ Variable size partition

→可变大小的分区

In the variable size partition, the memory is treated as one unit and space allocated to a process is exactly the same as required and the leftover space can be reused again.

在可变大小分区中,内存被视为一个单元,分配给进程的空间与所需的空间完全相同,剩余的空间可再次使用。

Advantage: There is no internal fragmentation.

优点:没有内部碎片。

Disadvantage: Management is very difficult as memory is becoming purely fragmented after some time.

缺点:管理非常困难,因为一段时间后内存将变得完全碎片化。

b)非连续内存分配 (b) Non-contiguous memory allocation)

In the non-contiguous memory allocation the available free memory space are scattered here and there and all the free memory space is not at one place. So this is time-consuming. In the non-contiguous memory allocation, a process will acquire the memory space but it is not at one place it is at the different locations according to the process requirement. This technique of non-contiguous memory allocation reduces the wastage of memory which leads to internal and external fragmentation. This utilizes all the free memory space which is created by a different process.

非连续的内存分配中 ,可用的空闲内存空间分散在各处,并且所有空闲内存空间都不在一个地方。 因此,这很耗时。 在非连续的内存分配中 ,一个进程将获取内存空间,但是根据该进程的要求,它并不位于一个位置,而是位于不同的位置。 这种非连续的内存分配技术可减少内存浪费,从而导致内部和外部碎片。 这将利用由不同进程创建的所有可用内存空间。

Non-contiguous memory allocation is of different types,

非连续内存分配类型不同,

  1. Paging

    分页

  2. Segmentation

    分割

  3. Segmentation with paging

    分页细分

i) Paging

i)分页

A non-contiguous policy with a fixed size partition is called paging. A computer can address more memory than the amount of physically installed on the system. This extra memory is actually called virtual memory. Paging technique is very important in implementing virtual memory. Secondary memory is divided into equal size partition (fixed) called pages. Every process will have a separate page table. The entries in the page table are the number of pages a process. At each entry either we have an invalid pointer which means the page is not in main memory or we will get the corresponding frame number. When the frame number is combined with instruction of set D than we will get the corresponding physical address. Size of a page table is generally very large so cannot be accommodated inside the PCB, therefore, PCB contains a register value PTBR( page table base register) which leads to the page table.

具有固定大小分区的非连续策略称为分页。 一台计算机可以分配的内存量大于系统上实际安装的内存量。 该额外的内存实际上称为虚拟内存。 分页技术对于实现虚拟内存非常重要。 辅助内存分为称为页面的相等大小的分区(固定)。 每个进程将有一个单独的页表。 页表中的条目是一个进程的页数。 在每个条目中,要么我们有一个无效的指针,这意味着该页面不在主内存中,要么我们将获得相应的帧号。 当帧号与集合D的指令组合时,我们将获得相应的物理地址。 页表的大小通常很大,因此无法容纳在PCB内部,因此PCB包含一个指向页表的寄存器值PTBR(页表基址寄存器)。

Advantages: It is independent of external fragmentation.

优点:它独立于外部碎片。

Disadvantages:

缺点:

  1. It makes the translation very slow as main memory access two times.

    由于两次访问主内存,因此转换速度非常慢。

  2. A page table is a burden over the system which occupies considerable space.

    页表是占用相当大空间的系统的负担。

ii) Segmentation

ii)细分

Segmentation is a programmer view of the memory where instead of dividing a process into equal size partition we divided according to program into partition called segments. The translation is the same as paging but paging segmentation is independent of internal fragmentation but suffers from external fragmentation. Reason of external fragmentation is program can be divided into segments but segment must be contiguous in nature.

分段是存储器的程序员视图,在这里,不是将进程划分为相等大小的分区,而是根据程序将其划分为称为段的分区。 转换与分页相同,但分页分段与内部分段无关,但会遭受外部分段。 外部碎片的原因是程序可以分为多个段,但是段本质上必须是连续的。

iii) Segmentation with paging

iii)使用分页进行细分

In segmentation with paging, we take advantages of both segmentation as well as paging. It is a kind of multilevel paging but in multilevel paging, we divide a page table into equal size partition but here in segmentation with paging, we divide it according to segments. All the properties are the same as that of paging because segments are divided into pages.

在使用分页进行分段时,我们同时利用了分段和分页的优势。 这是一种多级分页,但是在多级分页中,我们将页表划分为相等大小的分区,但是在这里,在使用分页进行分段时,我们将其按段进行划分。 所有的属性都与分页的属性相同,因为段被分为页面。

翻译自: https://www.includehelp.com/operating-systems/contiguous-and-non-contiguous-memory-allocation.aspx

操作系统 非连续分配

操作系统 非连续分配_操作系统中的连续和非连续内存分配相关推荐

  1. java 判断非ascii字符_文件名中的JavaMail和非ASCII字符

    我可以在 JavaMail中发送具有非ascii文件名的附件,但我无法下载它们.我特意为那些文件名包含非ascii字符的附件获取java.io.FileNotFoundException. 仅供参考: ...

  2. 【VS开发】【编程开发】【C/C++开发】结构体中的数组与指针的内存分配情况说明...

    [VS开发][编程开发][C/C++开发]结构体中的数组与指针的内存分配情况说明 标签:[VS开发] [编程开发] 主要是疑惑在结构体定义的数组的内存空间与指针动态分配的内存空间,在地址上连续性.以及 ...

  3. 在malloc函数中为什么常用sizeof来设定内存分配的大小?

    在malloc函数中为什么常用sizeof来设定内存分配的大小? 例子:为40个整数变量分配内存并赋值,然后系统在收回这些内存. #include<stdlib.h> #include&l ...

  4. c语言字符指针分配内存,内存分配函数及使用注意事项,C语言内存分配函数完全攻略...

    C 语言主要提供 malloc.realloc.calloc.alloca 与 aligned_alloc 等内存分配函数来实现对内存的分配功能. 1)malloc 函数原型如下: void * ma ...

  5. java动态分区分配_操作系统动态分区分配算法课程设计java版解析.doc

    湖 南 文 理 学 院 实 验 报 告 课程名称 操作系统课程设计 实验名称 存储管理--动态分区分配算法的模拟 成绩 学生姓名 曹乐 专业 计算机 班级.学号 13101 18 同组者姓名 实验日期 ...

  6. java动态分区分配_操作系统 动态分区分配算法课程设计 java版.pdf

    操作系统 动态分区分配算法课程设计 java版 湖 南 文 理 学 院 实 验 报 告 课程名称 操作系统课程设计 实验名称 存储管理--动态分区分配算法的模拟 成绩 学生姓名 曹乐 专业 计算机 班 ...

  7. 操作系统hpf算法事例_操作系统调度算法是什么

    操作系统调度算法是什么 导读:小编根据大家的需要整理了一份关于<操作系统调度算法是什么>的内容,具体内容:学习操作系统的朋友们肯定遇到过调度算法,目的是控制资源使用者的数量,选取资源使用者 ...

  8. java正则表达式非贪婪_正则表达式中的贪婪与非贪婪匹配模式

    1.首先看看下面的例子: try{ str=" abcdefg abcdefghijkl "; re1=str.match(/ [\W\w]+?/ig); alert(" ...

  9. C#中字符“.NET研究”串的内存分配与驻留池

    刚开始学习C#的时候,就听说CLR对于String类有一种特别的内存管理机制:有时候,明明声明了两个String类的对象,但是他们偏偏却指向同一个实例.如下: String s1 = "He ...

最新文章

  1. cryptojs php 互通_关于PHP7和CryptoJS的AES加密方式互通
  2. special-symbols in package(data.table)
  3. git和码云的使用以及搭建git服务器
  4. 接口映射的实现及原理
  5. flashbackup闪回数据库
  6. 【OpenCV 例程200篇】31. 图像金字塔(cv2.pyrDown)
  7. 纯Java文件操作工具,支持文件、文件夹的复制、删除、移动
  8. 当SDN 遇到物联网
  9. Ubuntu完美安装QQ
  10. Centos7 更换阿里yum源
  11. wps页眉怎么设置不同页码_WPS中怎么给单独一页设置页眉?
  12. 【Unity Shader】 Alpha测试
  13. Microsoft Edge浏览器网页改为纯黑色(将浏览器网页底色改为黑色)
  14. docker防止fork炸弹
  15. Unity3D学习笔记6——GPU实例化(1)
  16. 信而泰测试仪之 TeleATT软件 模拟 路由性能测试
  17. Nexus Windows中搭建Nexus仓库
  18. Column 'id' in where clause is ambiguous
  19. 结构体练习——青蛙吃蚊子
  20. 计算机音乐谱子十年,陈奕迅《十年》简谱

热门文章

  1. orcle mysql 查询_Oracle与Mysql的高级查询与难点sql
  2. java中怎么获取配置文件的值_java如何获取配置文件的值
  3. python3学习笔记 雨痕_Python 3 学习笔记:数字和布尔
  4. RNN,LSTM,GRU的理解
  5. CentOS7下Hive的安装配置
  6. Cheerleaders【容斥】
  7. telnet 功能启用并测试端口是否正常
  8. JMS(Java消息服务)与消息队列ActiveMQ基本使用(一)
  9. Office快捷键大全之三(Access快捷键下篇)
  10. Apache多站点配置详解