Page 260 - DCAP103_Principle of operating system
P. 260
Unit 7: Secondary Storage Structure
Notes
Figure 7.8: The Swaptab and Swapmap Structures
swaptab entry swapmap
st_swpmp
st_free sm_next
sm_next
sm_next
swpdbd
dbd_swptb dbd_swpmp
(14 bits) (14 bits)
dbd_type (4 bits)= DBD_BSTORE
Table 7.5: Swap Table Entry (struct swaptab)
Element Meaning
st_free Index to the first free page in the chunk. Each entry maps to a
4KB-age of swap.
st_next Index to next swaptab entry for same device or file-system swap;
at end of list, st_next is – 1.
st_flags ST_INDEL: File-system swap flag, indicating chunk is being
deleted; do not allocate pages from it. Set only by the realswapoff
( ) routine.
ST_FREE: File-system swap flag, indicating chunk may be
deleted, because none of its pages are in use. In the case of
remote swap, the chunk should not be deleted immediately; set
st_free_time to current time plus 30 minutes has elapsed, the
chunk can be freed. If the chunk is needed during the interim,
the flag can be cleared using.
chunk_release( ). called from lsync( ). ST_INUSE: swaptab entry
is being changed.
st_dev, Pointers to swdevt entry that references the
st_fsp swaptab entry.
st_nfpgs Number of free pages in this (swchunk) swaptab entry.
st_swpmp Pointer to swapmap [ ] array that defines this swchunk of swap
pages.
st_free_time Indicates when remote fs chunk can be freed (see explanation
of ST_FREE flag).
LOVELY PROFESSIONAL UNIVERSITY 253