Download Operating System - memory Management Part 6 - Notes and more Study notes Operating Systems in PDF only on Docsity!
MEMORY MANAGEMENT
Buddy system
(^) The "buddy system" allocates memory from a fixed-size segment consisting of physically contiguous pages.
(^) Memory is allocated from this segment using a power- of-2 allocator, which satisfies requests in units sized as a power of 2 (4 KB, 8 KB, 16 KB, and so forth).
(^) A request in units not appropriately sized is rounded up to the next highest power of 2.
(^) For example, if a request for 11 KB is made, it is satisfied with a 16-KB segment.
Buddy system
(^) However, the next-highest power of 2 from 21 KB is 32 KB so either BL or BR is again divided into two 32-KB buddies, CL and CR.
(^) One of these buddies is used to satisfy the 21-KB request.
Buddy system
(^) The obvious drawback to the buddy system is that rounding up to the next highest power of 2 is very likely to cause fragmentation within allocated segments.
(^) For example, a 33-KB request can only be satisfied with a 64-KB segment. In fact, we cannot guarantee that less than 50 percent of the allocated unit will be wasted due to internal fragmentation.
FILE MANAGEMENT
Objectives
(^) To explain the function of file systems
(^) To describe the interfaces to file systems
(^) To discuss file-system design tradeoffs, including access methods, file sharing, file locking, and directory structures
(^) To explore file-system protection
File Concept
(^) Contiguous logical address space
(^) Types:
(^) Data
(^) numeric
(^) character
(^) binary
(^) Program
File Attributes
(^) Name ā only information kept in human-readable form
(^) Identifier ā unique tag (number) identifies file within file system
(^) Type ā needed for systems that support different types
(^) Location ā pointer to file location on device
(^) Size ā current file size
(^) Protection ā controls who can do reading, writing, executing
(^) Time, date, and user identification ā data for protection, security, and usage monitoring
(^) Information about files are kept in the directory structure, which is maintained on the disk
File Operations
(^) File is an abstract data type
(^) Create
(^) Write
(^) Read
(^) Reposition within file
(^) Delete
(^) Truncate
Open(Fi) ā search the directory structure on disk for entry Fi , and move the content of entry to memory
Close (Fi) ā move the content of entry Fi in memory to directory structure on disk
Open File Locking
(^) Provided by some operating systems and file systems
(^) Mediates access to a file
(^) Mandatory or advisory:
(^) Mandatory ā access is denied depending on locks held and requested
(^) Advisory ā processes can find status of locks and decide what to do