Virtual memory Linux. Ներածություն Kernel and user space work with virtual addresses (also called linear addresses) that are mapped to physical addresses.

Презентация:



Advertisements
Похожие презентации
Parachuting, also known as skydiving, is the activity of jumping from enough height to deploy a fabric parachute and land. Parachuting is performed as.
Advertisements

Smart house is very similar to an ordinary house, but it is filled with technology! Please, click here !
Linux Daemons. Agenda What is a daemon What is a daemon What Is It Going To Do? What Is It Going To Do? How much interaction How much interaction Basic.
© 2009 Avaya Inc. All rights reserved. 1 Features of 4 Port Expansion Card (Cont.) Some of the additional features of the 4 Port Expansion Cards are: The.
Lecture # Computer Architecture Computer Architecture = ISA + MO ISA stands for instruction set architecture is a logical view of computer system.
© 2006 Avaya Inc. All rights reserved. Programmable Buttons and features.
INTERNATIONAL SPACE STATION. ARTHUR C. CLARKS THEORY Science fiction author Arthur C. Clark has an interesting theory about new ideas. He thinks they.
Operator Overloading Customised behaviour of operators Chapter: 08 Lecture: 26 & 27 Date:
Secrets Of The Cinema How Can You Make Your Own Film?
Benford Benford's law, also called the first-digit law, states that in lists of numbers from many (but not all) real-life sources of data, the leading.
NEW Business NEW Business. What is business? A business can be defined as an organization that provides goods and services to others who want or need.
© 2006 Cisco Systems, Inc. All rights reserved. MPLS v Complex MPLS VPNs Using Advanced VRF Import and Export Features.
Our City – Kursk. Presentation about the city. Presentation was created by pupil of the 10A class – Losev Vladimir.
Data Types in C. A Data Type A data type is –A set of values AND –A set of operations on those values A data type is used to –Identify the type of a variable.
Combination. In mathematics a combination is a way of selecting several things out of a larger group, where (unlike permutations) order does not matter.
Which has more packaging than NECESSARY ?
Yogesh Mehla Now concept of logic building is not so complex and not so simple. We will not work on how to make logic program in.
Android news (Android новини) section always becomes crowded with the public who are using android device and who are not using android devices. Android.
© 2005 Cisco Systems, Inc. All rights reserved.INTRO v Growing the Network Understanding the Challenges of Shared LANs.
© 2006 Avaya Inc. All rights reserved. Embedded File Management and SD-Card Handling.
Транксрипт:

Virtual memory Linux

Ներածություն Kernel and user space work with virtual addresses (also called linear addresses) that are mapped to physical addresses by the memory management hardware. This mapping is defined by page tables, set up by the operating system. Kernel and user space work with virtual addresses (also called linear addresses) that are mapped to physical addresses by the memory management hardware. This mapping is defined by page tables, set up by the operating system.

Վիրտուալ – ֆիզիկական արտապատկերում #include #include phys_addr = virt_to_phys(virt_addr); virt_addr = phys_to_virt(phys_addr); bus_addr = virt_to_bus(virt_addr); virt_addr = bus_to_virt(bus_addr);

Էջային կազմակերպումը The basic unit of memory is the page. Nobody knows how large a page is, this is architecture-dependent, but typically PAGE_SIZE = 4096 The basic unit of memory is the page. Nobody knows how large a page is, this is architecture-dependent, but typically PAGE_SIZE = 4096

get_free_page The routine __get_free_page() will give us a page. The routine __get_free_page() will give us a page. The routine __get_free_pages() will give a number of consecutive pages. The routine __get_free_pages() will give a number of consecutive pages.

vmalloc The routine vmalloc() has a similar purpose, but has a better chance of being able to return larger consecutive areas, and is more expensive. It uses page table manipulation to create an area of memory that is consecutive in virtual memory, but not necessarily in physical memory. The routine vmalloc() has a similar purpose, but has a better chance of being able to return larger consecutive areas, and is more expensive. It uses page table manipulation to create an area of memory that is consecutive in virtual memory, but not necessarily in physical memory.

Օրինակ 1 #include #include int main() { int n = 0; int n = 0; while (1) while (1) { if (malloc(1<<20) == NULL) if (malloc(1<<20) == NULL) { printf("malloc failure after %d MiB\n", n); return 0; } printf ("got %d MiB\n", ++n); printf ("got %d MiB\n", ++n);}}

Օրինակ 2 #include #include int main () { int n = 0; char *p; int n = 0; char *p; while (1) { while (1) { if ((p = malloc(1<<20)) == NULL) { if ((p = malloc(1<<20)) == NULL) { printf("malloc failure after %d MiB\n", n); printf("malloc failure after %d MiB\n", n); return 0; return 0; } memset (p, 0, (1<<20)); memset (p, 0, (1<<20)); printf ("got %d MiB\n", ++n); printf ("got %d MiB\n", ++n); } }

Օրինակ 3 #include #include #define N int main () { int i, n = 0; int i, n = 0; char *pp[N]; char *pp[N]; for (n = 0; n < N; n++) { for (n = 0; n < N; n++) { pp[n] = malloc(1<<20); if (pp[n] == NULL) pp[n] = malloc(1<<20); if (pp[n] == NULL) break; break; } printf("malloc failure after %d MiB\n", n); printf("malloc failure after %d MiB\n", n); for (i = 0; i < n; i++) { for (i = 0; i < n; i++) { memset (pp[i], 0, (1<<20)); memset (pp[i], 0, (1<<20)); printf("%d\n", i+1); printf("%d\n", i+1); } return 0; return 0;}