flâneur — a map of the web's best reading

Pages | CS 162 HW 4

cs162.org · 895 words · saved by 1 readers

Use the following functions in threads/palloc.h to allocate and deallocate pages in the Pintos kernel. The palloc functions use a bitmap to keep track of which pages are free and which pages are allocated. The flags argument is a bitmask of the following choices. The set of pages is partitioned into two separate pools: a user pool and a kernel pool. Pages in the kernel pool are meant for use inside the kernel (e.g. the stack for kernel threads) and pages in the user pool are meant to be mapped into the virtual address spaces of user processes. The reason for this separation is to prevent failures in the kernel if user programs run out of memory. The PAL_USER flag tells the palloc function to allocate the requested pages from the user pool. Otherwise, it will allocate the requested pages from the kernel pool. If you intend to map a page into the virtual address space of a process, you should allocate it from the user pool using PAL_USER. The pagedir member of struct thread is a pointer

Pages | CS 162 HW 4 Skip to main content Menu Expand (external link) Document Search Copy Copied CS 162 HW 4 Pages Table of contents Allocating pages Mapping a page into a virtual address space Summary and example Allocating pages Use the following functions in threads/palloc.h to allocate and deallocate pages in the Pintos kernel. void * palloc_get_page ( enum palloc_flags ); void * palloc_get_multiple ( enum palloc_flags , size_t page_cnt ); void palloc_free_page ( void * page ); void palloc_free_multiple ( void * pages , size_t page_cnt ); The palloc functions use a bitmap to keep track of

Explore this link on the map →

saved by

related reading