Pages | CS 162 HW 4
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
- Syscall implementation | CS 162 HW 4cs162.org
- Implementation requirements | CS 162 Project 2cs162.org
- Virtual memory layout | Pintos Documentationcs162.org
- Introduction to Paging | Writing an OS in Rustos.phil-opp.com
- Cache and TLB Flushing Under Linux — The Linux Kernel documentationdocs.kernel.org
- Page (computer memory) - Wikipediaen.wikipedia.org
- Memory Allocation in Go | Melatoninghiant3223.github.io
- CS111 Assignment 6: Virtual Memoryweb.stanford.edu
- CS111 Section 7: Demand Pagingweb.stanford.edu
- The "Basics" | Putting the "You" in CPUcpu.land
- User threads | CS 162 Project 2cs162.org
- The thread struct | Pintos Documentationcs162.org