virtual-memory

Where is the heap?

六月ゝ 毕业季﹏ 提交于 2021-02-17 06:20:09
问题 I understand that in Linux the mm_struct describes the memory layout of a process. I also understand that the start_brk and brk mark the start and end of the heap section of a process respectively. Now, this is my problem: I have a process, for which I wrote the source code, that allocates 5.25 GB of heap memory using malloc . However, when I examine the process's mm_sruct using a kernel module I find the value of is equal to 135168. And this is different from what I expected: I expected brk

How do Operating Systems prevent programs from accessing memory?

心已入冬 提交于 2021-02-08 19:16:17
问题 My understanding currently is, I can write an operating system in C I can write a program for that operating system in C When I write an operating system I can see all of the memory When I write a program the operating system hides memory from other programs from me. Whenever a program runs inside an OS it appears to the program as if the memory it is allocated is all the memory the computer has How does the CPU / OS achieve this? Is this something purely implemented on the software level? Or

How do Operating Systems prevent programs from accessing memory?

别等时光非礼了梦想. 提交于 2021-02-08 19:12:53
问题 My understanding currently is, I can write an operating system in C I can write a program for that operating system in C When I write an operating system I can see all of the memory When I write a program the operating system hides memory from other programs from me. Whenever a program runs inside an OS it appears to the program as if the memory it is allocated is all the memory the computer has How does the CPU / OS achieve this? Is this something purely implemented on the software level? Or

How do Operating Systems prevent programs from accessing memory?

百般思念 提交于 2021-02-08 19:05:54
问题 My understanding currently is, I can write an operating system in C I can write a program for that operating system in C When I write an operating system I can see all of the memory When I write a program the operating system hides memory from other programs from me. Whenever a program runs inside an OS it appears to the program as if the memory it is allocated is all the memory the computer has How does the CPU / OS achieve this? Is this something purely implemented on the software level? Or

How do Operating Systems prevent programs from accessing memory?

我怕爱的太早我们不能终老 提交于 2021-02-08 19:05:11
问题 My understanding currently is, I can write an operating system in C I can write a program for that operating system in C When I write an operating system I can see all of the memory When I write a program the operating system hides memory from other programs from me. Whenever a program runs inside an OS it appears to the program as if the memory it is allocated is all the memory the computer has How does the CPU / OS achieve this? Is this something purely implemented on the software level? Or

What is the page size for 32 and 64 bit versions of windows Os?

非 Y 不嫁゛ 提交于 2021-02-08 14:11:34
问题 I want to know the default page size for virtual memory in windows Os for both 32 and 64 bit versions. For ex: the page size of Linux (x86) is 4 Kb . 回答1: call GetSystemInfo or better GetNativeSystemInfo and look for dwPageSize member of SYSTEM_INFO structure. however now under windows in both x86 and x64 page size is 0x1000 or 4Kb 来源: https://stackoverflow.com/questions/44520047/what-is-the-page-size-for-32-and-64-bit-versions-of-windows-os

Is virtual memory used when using Port-mapped I/O?

谁都会走 提交于 2021-02-07 12:56:25
问题 If I have a Memory-mapped I/O device, and I want to write to a register for this device located at address 0x16D34 , the 0x16D34 address is actually a virtual address, and the CPU will translate it to a physical address first, and then write the data to the physical address. But what about Port-mapped I/O devices (for example: a serial port), so if I want to write to a register for a serial port located at address 0x3F8 , is the 0x3F8 address a physical address or a virtual address? Edit: I

Should I always use size_t when indexing arrays?

安稳与你 提交于 2021-02-07 11:24:35
问题 Do I need to use size_t always when indexing an array even if the array is not big enough to exceed the size of an int? It's not a question about when I should use size_t . I just want to know if, for example, a program having 2GB of available memory (all of these fields can be indexed by an int32) but with this memory being (virtual memory) assigned to the "fields" 14GB - 16GB of the computer's RAM. Would it always fail when indexing the memory if I used an int32 instead of a size_t (or an

Base address at which the linux kernel is loaded

若如初见. 提交于 2021-02-07 06:36:31
问题 I have a couple of doubts about how the kernel is loaded into memory. Upon inspecting /proc/kallsyms I'm able to find the address of various symbols in the kernel. $ cat /proc/kallsyms | head -n 10 00000000 t __vectors_start 80008240 T asm_do_IRQ 80008240 T _stext 80008240 T __exception_text_start 80008244 T do_undefinstr 80008408 T do_IPI 8000840c T do_DataAbort 800084a8 T do_PrefetchAbort 80008544 t gic_handle_irq 800085a0 T secondary_startup Is there any way I can find the base address at

Linux mapping virtual memory range to existing virtual memory range?

拜拜、爱过 提交于 2021-02-06 13:47:45
问题 In Linux, is there a way (in user space) to map a virtual address range to the physical pages that back an existing virtual address range? The mmap() function only allows one to map files or "new" physical pages. I need to be able to do something like this: int* addr1 = malloc(SIZE); int* addr2 = 0x60000; // Assume nothing is allocated here fancy_map_function(addr1, addr2, SIZE); assert(*addr1 == *addr2); // Should succeed assert(addr1 != addr2); // Should succeed 回答1: I was curious so I