Главная / Дошкольное образование / Аппликация, лепка

ghfgngnf

Скачать
16.22 КБ, 756456.docx Автор: Мускатин Дмитрий Александрович, 31 Мар 2015

On all computer systems memory is a scarce resource. No matter how much memory is available,

it never seems to be enough. It doesn’t seem so long ago that 256MB of RAM was considered suffi- cient, but now 2GB of RAM is commonplace as a sensible minimum requirement even for desktop systems, with servers usefully having significantly more. From the earliest versions of the operating system, UNIX-style operating systems have had a very clean approach to managing memory, which Linux, because it implements the X/Open specifica- tion, has inherited. Linux applications, except for a few specialized embedded applications, are never permitted to access physical memory directly. It might appear so to the application, but what the application is seeing is a carefully controlled illusion. Linux provides applications with a clean view of a huge directly addressable memory space. Additionally, it provides protection so that different applications are protected from each other, and it allows applications to apparently access more memory than is physically present in the machine, provided the machine is at least well configured and has sufficient swap space. www.it-ebooks.info Simple Memory Allocation You allocate memory using the malloc call in the standard C library: #include <stdlib.h> void *malloc(size_t size); Notice that Linux (following the X/Open specification) differs from some UNIX implementations by not requiring a special malloc.h include file. Note also that the size parameter that specifies the number of bytes to allocate isn’t a simple int , although it’s usually an unsigned integer type. You can allocate a great deal of memory on most Linux systems. Let’s start with a very simple program, but one that would defeat old MS-DOS-based programs, because they cannot access memory outside the base 640K memory map of PCs. Try It Out Simple Memory Allocation Type the following program, memory1.c : #include <unistd.h> #include <stdlib.h> #include <stdio.h>On all computer systems memory is a scarce resource. No matter how much memory is available, it never seems to be enough. It doesn’t seem so long ago that 256MB of RAM was considered suffi- cient, but now 2GB of RAM is commonplace as a sensible minimum requirement even for desktop systems, with servers usefully having significantly more. From the earliest versions of the operating system, UNIX-style operating systems have had a very clean approach to managing memory, which Linux, because it implements the X/Open specifica- tion, has inherited. Linux applications, except for a few specialized embedded applications, are never permitted to access physical memory directly. It might appear so to the application, but what the application is seeing is a carefully controlled illusion. Linux provides applications with a clean view of a huge directly addressable memory space. Additionally, it provides protection so that different applications are protected from each other, and it allows applications to apparently access more memory than is physically present in the machine, provided the machine is at least well configured and has sufficient swap space. www.it-ebooks.info Simple Memory Allocation You allocate memory using the malloc call in the standard C library: #include <stdlib.h> void *malloc(size_t size); Notice that Linux (following the X/Open specification) differs from some UNIX implementations by not requiring a special malloc.h include file. Note also that the size parameter that specifies the number of bytes to allocate isn’t a simple int , although it’s usually an unsigned integer type. You can allocate a great deal of memory on most Linux systems. Let’s start with a very simple program, but one that would defeat old MS-DOS-based programs, because they cannot access memory outside the base 640K memory map of PCs. Try It Out Simple Memory Allocation Type the following program, memory1.c : #include <unistd.h> #include <stdlib.h> #include <stdio.h> On all computer systems memory is a scarce resource. No matter how much memory is available, it never seems to be enough. It doesn’t seem so long ago that 256MB of RAM was considered suffi- cient, but now 2GB of RAM is commonplace as a sensible minimum requirement even for desktop systems, with servers usefully having significantly more. From the earliest versions of the operating system, UNIX-style operating systems have had a very clean approach to managing memory, which Linux, because it implements the X/Open specifica- tion, has inherited. Linux applications, except for a few specialized embedded applications, are never permitted to access physical memory directly. It might appear so to the application, but what the application is seeing is a carefully controlled illusion. Linux provides applications with a clean view of a huge directly addressable memory space. Additionally, it provides protection so that different applications are protected from each other, and it allows applications to apparently access more memory than is physically present in the machine, provided the machine is at least well configured and has sufficient swap space. www.it-ebooks.info Simple Memory Allocation You allocate memory using the malloc call in the standard C library: #include <stdlib.h> void *malloc(size_t size); Notice that Linux (following the X/Open specification) differs from some UNIX implementations by not requiring a special malloc.h include file. Note also that the size parameter that specifies the number of bytes to allocate isn’t a simple int , although it’s usually an unsigned integer type. You can allocate a great deal of memory on most Linux systems. Let’s start with a very simple program, but one that would defeat old MS-DOS-based programs, because they cannot access memory outside the base 640K memory map of PCs. Try It Out Simple Memory Allocation Type the following program, memory1.c : #include <unistd.h> #include <stdlib.h> #include <stdio.h>


Автор: Мускатин Дмитрий Александрович
Похожие материалы