什么内存地址空间,有哪几种? [英] What memory address spaces are there?

查看:154
本文介绍了什么内存地址空间,有哪几种?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经使用什么样的内存地址空间的形式?

What forms of memory address spaces have been used?

今天,大平面的虚拟地址空间是常见的。从历史上看,更复杂的地址空间已被使用,诸如一对基地址和偏移量,一对一段号和偏移量,一个字地址加上一些指数为一个字节或其他子对象,等

Today, a large flat virtual address space is common. Historically, more complicated address spaces have been used, such as a pair of a base address and an offset, a pair of a segment number and an offset, a word address plus some index for a byte or other sub-object, and so on.

随着时间的时候,各种各样的回答和评论断言,C / C ++指针基本上都是整数。这是C / C ++的型号不正确,因为各种各样的地址空间的无疑是一些关于指针操作的C规则的原因。例如,如果不定义指针算法超出数组简化为一个基数和偏差模式指针的支持。在指针转换限制简化地址加额外的数据模型的支持。

From time to time, various answers and comments assert that C/C++ pointers are essentially integers. That is an incorrect model for C/C++, since the variety of address spaces is undoubtedly the cause of some of the C rules about pointer operations. For example, not defining pointer arithmetic beyond an array simplifies support for pointers in a base and offset model. Limits on pointer conversion simplify support for address-plus-extra-data models.

这是反复出现的说法促使这个问题。我找了有关各种地址空间信息,以说明一C / C ++指针不一定是简单的整数,并且在指针操作的C / C ++的限制是合理的给出的各种机器来予以支持。

That recurring assertion motivates this question. I am looking for information about the variety of address spaces to illustrate that a C/C++ pointer is not necessarily a simple integer and that the C/C++ restrictions on pointer operations are sensible given the wide variety of machines to be supported.

有用的信息可能包括:


  • 计算机体系结构与不同地址空间以及空间的描述的例子。

  • 仍然在机器使用的各种地址空间的例子目前正在生产。

  • 引用文档或解释,尤其是网址。

  • 在地址空间如何激励C / C ++指针的规则制定。

这是一个广泛的问题,所以我愿意就其管理的建议。我会很高兴地看到在一个包容性的普遍答案协作编辑。然而,实至名归,可能无法获奖的声誉。我建议了投票权多有益的贡献。

This is a broad question, so I am open to suggestions on managing it. I would be happy to see collaborative editing on a single generally inclusive answer. However, that may fail to award reputation as deserved. I suggest up-voting multiple useful contributions.

推荐答案

几乎任何你能想象可能已被使用。该
第一大部分是字节寻址之间(所有现代
体系结构)和字寻址(pre-IBM 360 / PDP-11,但
我觉得现代的Unisys大型机仍在字解决)。在
字寻址,的char * 无效* 往往会比大
一个为int * ;即使他们没有更大的字节选择
将在高阶位,这是必须为0,或
除字节的任何其他将被忽略。 (在PDP-10,
例如,如果 P 的char * (INT)P< (INT)(P + 1)
通常是假的,即使 INT 的char * 有同样的
大小。)

Just about anything you can imagine has probably been used. The first major division is between byte addressing (all modern architectures) and word addressing (pre-IBM 360/PDP-11, but I think modern Unisys mainframes are still word addressed). In word addressing, char* and void* would often be bigger than an int*; even if they were not bigger, the "byte selector" would be in the high order bits, which were required to be 0, or would be ignored for anything other than bytes. (On a PDP-10, for example, if p was a char*, (int)p < (int)(p+1) would often be false, even though int and char* had the same size.)

其中字节寻址的机器,主要的变体被分割
和非节段结构。两者都仍然很大US $ p $垫
今天,虽然在英特尔32位的情况下,(一分段
具有48位地址架构),一些更广泛
使用的操作系统(Windows和Linux),人为地限制用户
流程单个段,模拟平面寻址。

Among byte addressed machines, the major variants are segmented and non-segmented architectures. Both are still wide spread today, although in the case of Intel 32bit (a segmented architecture with 48 bit addresses), some of the more widely used OSs (Windows and Linux) artificially restrict user processes to a single segment, simulating a flat addressing.

虽然我没有最近的经验,我希望更
各种嵌入式处理器。特别是,在过去,人们
经常是为嵌入式处理器采用哈佛
建筑,其中code和数据都在独立的地址
空间(使一个函数指针和数据指针,转换为
足够大的整数类型,可以比较相同)。

Although I've no recent experience, I would expect even more variety in embedded processors. In particular, in the past, it was frequent for embedded processors to use a Harvard architecture, where code and data were in independent address spaces (so that a function pointer and a data pointer, cast to a large enough integral type, could compare equal).

这篇关于什么内存地址空间,有哪几种?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆