C

mmap (memory-mapped files)

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

mmap() e „lidh“ një skedar me memorien, që ta lexosh si të ishte një varg, dhe sistemi i ngarkon vetë faqet që të duhen. Shumë i shpejtë për skedarë të mëdhenj; përdoret edhe nga databazat.

EnglishEN

mmap() “maps” a file into memory, so you read it as if it were an array, and the system loads the pages you need by itself. Very fast for big files; databases use it too.

Si ta mendosh

Si ta kesh librin të hapur mbi tavolinë në vend që t'i kopjosh faqet.

Lexoje në anglisht

Like having the book open on the table instead of copying out the pages.

Shembull kodic

int fd = open("te_dhenat.bin", O_RDONLY);
struct stat st; fstat(fd, &st);
char *p = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);

Terma të lidhur