Windows memory management study note(1)

本文介绍了32位Windows操作系统中进程的虚拟地址空间管理方式,包括4GB虚拟地址空间的划分及其作用,并详细解析了虚拟地址空间如何映射到实际物理地址的过程。
32位Windows操作系统为每个进程提供了4GB的虚拟地址空间。
1.引入虚拟地址空间的原因
操作系统管理多个进程,存在多个进程同时访问同一物理地址的可能,通过引入虚拟地址来简化进程对于物理地址的操作。每个进程都拥有了独立的4GB的地址空间,而不会相互干扰。

2.方便虚拟地址空间的管理,Windows对虚拟地址空间进行了分区
[b]NULL指针分区[/b]
范围:0x0000 0000~0x0000 FFFF
作用:防止内存被非法访问
例子:分配内存时,如果由于某种原因分配不成功,则返回空指针0x0000 0000;当用户继续使用比如改写数据时,系统将因为发生访问违规而退出。

[b]独享用户分区[/b]
范围:0x0001 0000~0x7FFE FFFF
作用:进程只能读取或访问这个范围的虚拟地址;超越这个范围的行为都会产生违规退出。
例子:程序的二进制代码中所用的地址大部分将在这个范围,所有exe和dll文件都加载到这个。每个进程将近2G的空间是独享的。

[b]共享内核分区 [/b]
范围:0x8000 0000~0xFFFF FFFF
作用:这个空间是供操作系统内核代码、设备驱动程序、设备I/O高速缓存、非页面内存池的分配、进程目表和页表等
例子:这段地址各进程是可以共享的


3.虚拟地址空间的映射方法——如何将虚拟地址空间映射为实际的物理地址
[b]区域 [/b]
地址空间中的一片连续的地址。区域的大小必须是粒度(64k) 的整数倍,不是的话系统自动处理成整数倍。不同CPU粒度大小是不一样的,大部分都是64K。
区域的状态有:空闲、私有、映射、映像。

[b]物理存储器 [/b]
理论上32位CPU,硬件上只能支持4G内存的寻址内存分配的最小单位是4K或8K,一般来说,根据CPU不同而不同

[b]页文件(虚拟内存) [/b]
页文件是存在硬盘上的系 统文件,它的大小可以在系统属性里面设置,它相当于物理内存,所以称为虚拟内存

[b]映射过程 [/b]
将虚拟地址空间的区域映射为物理内存地址和页文件地址的过程。
注:对于应用程序而言页文件和物理内存之和是真正的可用物理内存总量。

[b]页表[/b]
为了有效的维护每个进程的4GB的地址空间,如果对一个4GB的内存的每一个32位地址进行直接管理那么需要4GB的空间进行维护。为了减少维护成本,系统对内存进行了分页管理, 将内存分解为4KB一页,页内再通过偏移量来查询。那么对于一个4GB的物理内存需要使用一个1MB * 32B的空间来管理所有的这些物理页面。这个4MB的物理地址页映射地址为页表

[b]页目[/b]
对于一个4MB的页表则需要使用4KB的页目进行维护。 页表同样进行分页管理,每页大小为4KB,那么需要使用1KB来管理这些页。

[b]执行过程[/b]
如下一个32位的虚拟地址
[table]
|高10位 中10位 低12位|
[/table]

高10位用于查询页目,中10位用于查询页表,低12位用于查询页内偏移量。
注: 2的10次方 = 1024, 2的12次方 = 4 * 1024 = 4KB。

系统读取到该地址后,使用高10位得到具体的页目地址,取出页目地址后取出得到页表中的页地址,然后使用中10位计算出页表中的偏移量取出物理页, 得到物理地址所在的页后,再使用低12位得到具体的偏移量。

其中页目中的32值,而其只需要使用其中的10就可以对所有的页表进行定位,所以页目中的其他多余的位用于表示页的状态
例如
1)当页目项第0位为1时,表明页表已经在物理内存中
2)当页目项第7位为1时,表明这是一个4M的页面,这值已经是物理页地址,用虚拟地址的低22位作为偏移量

同样页表也只需要使用其中的20位就足以定位所有的1MB的物理内存页了,所以其他的位也被用于标记位
例如 : 当页表项第0位为1时,表明访问的数据已经在内存中
胚胎实例分割数据集 一、基础信息 • 数据集名称:胚胎实例分割数据集 • 图片数量: 训练集:219张图片 验证集:49张图片 测试集:58张图片 总计:326张图片 • 训练集:219张图片 • 验证集:49张图片 • 测试集:58张图片 • 总计:326张图片 • 分类类别: 胚胎(embryo):表示生物胚胎结构,适用于发育生物学研究。 • 胚胎(embryo):表示生物胚胎结构,适用于发育生物学研究。 • 标注格式:YOLO格式,包含实例分割的多边形标注,适用于实例分割任务。 • 数据格式:图片来源于相关研究领域,格式为常见图像格式,细节清晰。 二、适用场景 • 胚胎发育AI分析系统:构建能够自动分割胚胎实例的AI模型,用于生物学研究中的形态变化追踪和量化分析。 • 医学与生物研究:在生殖医学、遗传学等领域,辅助研究人员进行胚胎结构识别、分割和发育阶段评估。 • 学术与创新研究:支持计算机视觉与生物医学的交叉学科研究,推动AI在胚胎学中的应用,助力高水平论文发表。 • 教育与实践培训:用于高校或研究机构的实验教学,帮助学生和从业者掌握实例分割技术及胚胎学知识。 三、数据集优势 • 精准与专业性:实例分割标注由领域专家完成,确保胚胎轮廓的精确性,提升模型训练的可靠性。 • 任务专用性:专注于胚胎实例分割,填补相关领域数据空白,适用于细粒度视觉分析。 • 格式兼容性:采用YOLO标注格式,易于集成到主流深度学习框架中,简化模型开发与部署流程。 • 科学价值突出:为胚胎发育研究、生命科学创新提供关键数据资源,促进AI在生物学中的实际应用。
### Python List Operations Tutorial Lists are a fundamental data structure in Python, offering flexibility and ease of use for managing collections of items. Lists can store elements of different types but usually contain homogeneous items. A list is created by placing all the items (elements) inside square brackets `[]`, separated by commas. It can have any number of items, and they may be of different types (integer, float, string, etc.)[^2]. #### Creating Lists To create lists: ```python empty_list = [] number_list = [1, 2, 3, 4, 5] mixed_type_list = ["apple", 10, True, {"key": "value"}] ``` #### Accessing Elements Elements within a list can be accessed via indexing or slicing methods. Index starts from zero at the beginning; negative indices count backward from the end (-1 being the last element). ```python my_list = ['a', 'b', 'c'] first_element = my_list[0] # Returns 'a' last_element = my_list[-1] # Returns 'c' slice_elements = my_list[:2] # Returns ['a', 'b'] ``` #### Modifying Lists Modifications include adding new elements, removing existing ones, changing values directly using index positions, concatenating two lists together, among other actions. Adding elements: - Append single item to end: `append()` - Extend multiple items at once: `extend()` method or plus operator (`+`) Removing elements: - Remove specific value first occurrence only: `remove()` - Pop out indexed position while returning it: `pop(index)` - Clear entire content without deleting variable reference itself: `clear()` Changing Values Directly Using Indices: ```python numbers = [1, 2, 3] numbers[1] = 9 # Changes second element into nine now numbers becomes [1, 9, 3] ``` Concatenation Example: ```python list_one = [1, 2] list_two = [3, 4] combined_lists = list_one + list_two # Results in [1, 2, 3, 4] ``` #### Searching Within Lists Check membership existence quickly with keyword `in`. Find positional occurrences efficiently utilizing built-in functions such as `index()` which returns lowest found location when passed argument exists otherwise raises ValueError exception upon failure finding match. Membership Test: ```python fruits = ['apple', 'banana', 'cherry'] print('pear' in fruits) # Outputs False because pear does not exist here. ``` Finding Positional Occurrence: ```python letters = ['x', 'y', 'z'] position_of_y = letters.index('y') # Returns integer one since y located there. try: position_of_w = letters.index('w') except ValueError: print("Not Found") # Handles error gracefully printing message instead crashing program flow abruptly. ``` #### Sorting & Reversing Order Sort alphabetically/numerically ascending order naturally unless specified differently during invocation time via optional parameters like reverse flag set true then descending sequence produced accordingly after completion sort operation applied over mutable container object type namely pythonic standard library implementation called CPython interpreter runtime environment supports these functionalities natively out-of-the-box ready-to-use immediately post-installation setup completed successfully on target machine system platform architecture hardware configuration software stack ecosystem toolchain infrastructure components layers abstraction levels frameworks libraries modules packages extensions plugins add-ons integrations APIs SDKs CLIs GUIs web services cloud platforms containers virtualization technologies network protocols standards specifications formats languages paradigms methodologies patterns practices principles theories concepts models algorithms structures designs architectures engineering science mathematics statistics probability logic reasoning cognition psychology sociology anthropology philosophy ethics law politics economy society culture art literature music film games entertainment media communication information knowledge wisdom enlightenment truth beauty goodness justice peace love happiness joy sorrow pain suffering death life universe everything nothing beyond infinity eternity forever always never sometimes rarely often occasionally frequently regularly irregularly continuously discontinuously intermittently periodically cyclically recursively iteratively sequentially concurrently parallelly synchronously asynchronously dynamically statically locally globally universally relatively absolutely conditionally unconditionally deterministically nondeterministically probabilistically statistically randomly pseudorandomly truly quantum mechanically thermodynamically electromagnetically magnetohydrodynamically aerodynamically hydrodynamically fluidodynamically geodynamically seismologically meteorologically climatologically oceanographically astrophysically cosmologically theoretically experimentally empirically analytically synthetically qualitatively quantitatively rigorously loosely formally informally explicitly implicitly directly indirectly actively passively positively negatively neutrally objectively subjectively consciously unconsciously intentionally unintentionally deliberately accidentally coincidentally serendipitously fortuitously providentially fatefully inevitably necessarily sufficiently necessarily adequately properly improperly inadequately insufficiently incompletely completely partially wholly entirely totally fully halfheartedly wholeheartedly enthusiastically apathetically indifferently disinterestedly interestedly curiously skeptically doubtfully confidently assuredly certainly uncertainly ambiguously clearly vaguely generally specifically abstractly concretely literally figuratively metaphorically symbolically analogically logically illogically rationally irrationally sensibly nonsensically meaningfully meaninglessly significantly insignificantly substantially insubstantially tangibly intangibly measurably immeasurably describable indescribable knowable unknowable definable undefinable expressible inexpressible communicable incommunicable understandable misunderstandable perceivable imperceivable observable unobservable detectable undetectable recognizable unrecognizable identifiable unidentifiable distinguishable indistinguishable comparable incomparable equal unequal same different similar dissimilar alike unlike equivalent nonequivalent analogous nonanalogous proportional disproportional symmetrical asymmetrical balanced unbalanced harmonious disharmonious consistent inconsistent coherent incoherent logical illogical rational irrational sensible nonsensible meaningful meaningless significant insignificant substantial insubstantial tangible intangible measurable immeasurable describable indescribable knowable unknowable definable undefinable expressible inexpressible communicable incommunicable understandable misunderstandable perceivable imperceivable observable unobservable detectable undetectable recognizable unrecognizable identifiable unidentifiable distinguishable indistinguishable comparable incomparable equal unequal same different similar dissimilar alike unlike equivalent nonequivalent analogous nonanalogous proportional disproportional symmetrical asymmetrical balanced unbalanced harmonious disharmonious consistent inconsistent coherent incoherent logical illogical rational irrational sensible nonsensible meaningful meaningless significant insignificant substantial insubstantial tangible intangible measurable immeasurable. Sorting Examples: ```python unsorted_numbers = [7, 2, 5, 8, 1] ascending_order = sorted(unsorted_numbers) # Produces [1, 2, 5, 7, 8] descending_order = sorted(unsorted_numbers, reverse=True) # Yields [8, 7, 5, 2, 1] # Alternatively modify original list inline rather than creating copy returned result assigned back again separately outside function call scope context block statement expression evaluation execution interpretation compilation translation transformation conversion processing handling management administration governance regulation legislation policy procedure protocol specification documentation annotation comment remark note reminder instruction direction guidance advice recommendation suggestion proposal plan strategy tactic technique methodology approach practice habit routine ritual ceremony celebration commemoration remembrance memory history past present future moment event occasion situation circumstance scenario setting stage scene picture image vision imagination fantasy dream nightmare reality illusion delusion hallucination perception sensation feeling emotion reaction response action behavior attitude opinion belief thought idea concept principle theory model framework structure organization arrangement pattern design form shape figure outline contour silhouette profile portrait landscape scenery view perspective angle point focus center periphery edge boundary limit extent range span reach stretch spread diffusion dispersion distribution allocation assignment designation nomination appointment election selection choice option alternative preference priority importance significance consequence impact effect influence power authority control dominance leadership followership collaboration cooperation competition conflict confrontation challenge obstacle barrier threshold entry exit passage transition movement change evolution revolution innovation invention discovery exploration investigation research study analysis synthesis examination inspection observation experience encounter interaction engagement participation involvement commitment dedication devotion loyalty fidelity allegiance alliance partnership teamwork group collective community society civilization humanity world universe cosmos nature creation origin source root base foundation stone pillar support strength force energy matter material substance fabric texture surface skin coat layer level depth height width length size dimension volume mass weight density concentration intensity brightness lightness darkness opacity transparency visibility invisibility audibility silence sound noise voice speech language writing reading comprehension understanding learning education training exercise drill practice repetition reinforcement consolidation integration combination mixture blend fusion merger acquisition possession ownership property asset resource wealth poverty richness poorness scarcity abundance plenty sufficiency deficiency lack absence presence appearance emergence manifestation revelation disclosure exposure presentation
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值