DOC PREVIEW
UMD CMSC 412 - Lecture 14

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

AnnouncementsProject #3Working Sets and Page ReplacementPreventing ThreashingImplementation IssuesSegmentationFile AbstractionFile OperationsFile Operations (cont)File Operations (cont)1CMSC 412 – S02 (lect 14)Announcementsz Midterm #1– Re-grade requests due by end of class todayz Project #3– Is out– Deadline is shortly after midterm #2 (start early)2CMSC 412 – S02 (lect 14)Project #3z What is pageable?– User memory including text, data, and stackz Memory model– Kernel memory in low memory– User memory in high memoryz Paging Bits– cr3 – Page Table Base Register (PTBR)– cr0:31 – Enable Paging bit– cr2 – Address causing page faultz Page Faults– Look in errorCode fields of interrupt3CMSC 412 – S02 (lect 14)Working Sets and Page Replacementz Programs usually display reference locality– temporal locality • repeated access to the same memory location– spatial locality• consecutive memory locations access nearby memory locations– memory hierarchy design relies heavily on locality reference• sequence of nested storage mediaz Working set– set of pages referenced in the last delta referencesSmall Very FastLargeVery SlowWorking Set Size4CMSC 412 – S02 (lect 14)Preventing Threashingz Need to ensure that we can keep the working set in memory– if the working sets of the processes in memory exceed total page frames, then we need to swap a process outz How do we compute the working set?– can approximate it using a reference bit5CMSC 412 – S02 (lect 14)Implementation Issuesz How big should a page be?– want to trade cost of fault vs. fragmentation • cost of fault is: trap + seek + latency + transfer– Does the OS page size have to equal the HW page size?• no, just needs to be a multiple of itz How does I/O relate to paging– if we request I/O for a process, need to lock the page• if not, the I/O device can overwrite the pagez Can the kernel be paged?– most of it can be.– what about the code for the page fault handler?6CMSC 412 – S02 (lect 14)Segmentationz Segmentation is used to give each program several independent protected address spaces– each segment is an independent protected address space– access to segments is controlled by data which describes size, privilege level required to access, protection (whether segment is read-only etc)– segments may or may not overlap• disjoint segments can be used to protect against programming errors• separate code, data stack segments7CMSC 412 – S02 (lect 14)– Disjoint Segments can be used to exploit expanded address space• In 16 bit architectures e.g. (8086 and 80x86 in V86 mode) each segment has only 16 bits of address space• In distributed networks consisting of multiple 32 bit machines, segmentation can be used to support single huge address space– Segments can span identical regions of address space - flat model• Windows NT and Windows ‘95 use 4 Gbyte code segments, stack segments, data segments8CMSC 412 – S02 (lect 14)File Abstractionz What is a file?– A named collection of information stored on secondary storagez Properties of a file– non-volatile– can read, read, or update it– has meta-data to describe attributes of the filez File Attributes– name: a way to describe the file– type: some information about what is stored in the file– location: how to find the file on disk– size: number of bytes– protection: access control • may be different for read, write, execute, append, etc.– time: access, modification, creation– version: how many times has the file changed9CMSC 412 – S02 (lect 14)File Operationsz Files are an abstract data type– interface (this lecture) – implementation (next lecture)z create a file – assign it a name – check permissionsz open– check permissions– check that the file exists– lock the file (if we don’t what to permit other users a the same time)10CMSC 412 – S02 (lect 14)File Operations (cont)z write– indicate what file to write (either name of handle)– provide data to write– specify where to write the data within the file• generally this is implicit (file pointer)• could be explicit (direct access)z read– indicate what file to read (either name of handle)– provide place to put information read– indicate how much to read– specify where to write the data within the file• generally this is implicit (file pointer)• could be explicit (direct access)z fsync (synchronize disk version with in-core version)– ensure any previous writes to the file are stored on disk11CMSC 412 – S02 (lect 14)File Operations (cont)z seek– move the implicit file pointer to a new offset in the filez delete– remove named filez truncate– remove the data in the file from the current position to endz close– unlock the file (if open locked it)– update meta data about time– free system resources (file descriptors, buffers)z read meta data– get file size, time, owner, etc.z update meta data– change file size, time owner,


View Full Document

UMD CMSC 412 - Lecture 14

Documents in this Course
Security

Security

65 pages

Deadlocks

Deadlocks

22 pages

Set 2

Set 2

70 pages

Project 2

Project 2

21 pages

Load more
Download Lecture 14
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 14 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 14 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?