Categories
Computer Technologies and O/S

FIT9018: Week 5

5th Week Lecture – Virtual Memory

Andy Cheng’s lecture this week was a whirlwind tour over the definition and major issues of Virtual Memory.

source: http://en.wikipedia.org/wiki/File:Virtual_memory.svg

Virtual Memory enables programs running on an O/S to interact with what to them is a contiguous memory source. That is, program instructions and resources can be loaded to Virtual Memory addresses and a program can easily access them with logical addresses. The illustration above shows a simplified concept of Virtual Memory.

There are two major implementations for Virtual Memory:

Paging

  • Programs/Data divided into ‘Pages’, physical Memory is divided into “Frames”. Paging eliminates external fragmentation but allows for internal fragmentation (when fixed partitioning)
  • Page size vairies but will be a power of 2 (512kb, 1024kb). Page size can be Fixed or Dynamic, Dynamic can eliminate internal fragmentation but increases external and is more difficult to implement.
    • Internal fragmentation – unallocated memory within the Frames (if program/data pages don;’t fit the frame perfectly)
    • External fragmentation – unallocated memory outside of the Frames
  • Page Table – is an index for Logical Addresses and Physical Addresses for Pages. (each process has its own Page Table), page_number : page_offset are the Logical information items that a Program needs to find a resource in memory. page Tables usually also include where the physical address is and the last modified time of each page.
    • Caching (more specifically translation lookaside buffer) improves Paging performance. Cache enables memory locations to be searched simultaneously (larger bus?), it is limited in size (due to cost) and only holds active pages.
  • PAGE FAULT –  page not found in memory, Page Swapping needs to be conducted with secondary memory to continue. Page Replacement Algorithms can decrease the need to refer to secondary memory which is significantly slower than RAM.

Segmentation

  • Similar to paging, reflect Logical divisions in programs and data. segment_no : offset, SEGMENT TABLE, each segment may vary in size depending on its function.

Virtual Memory works well because prgrams tend to process with a characteristic known as locality, meaning that the process certain code blocks at one point in time and move on to other block after (allowing for blocks to be Page Swapping to be batched in some senses). The Working Set =the minimum number of pages that meet the locality requirement (The amount of primary memory, measured in pages, that is
required for a program to make effective progress without excessive paging). If the number of pages allocated to a process falls below the Working Set, thrashing will occur, meaning that the CPU will not be utilized efficiently due to excessive page swapping.
Global, Local and Crucial Pages were introduced also, Global pages can be swapped with resources for any process, Local frames are owned by a process (cg_hunkmegs in quakelive modifies the number of these allocated to itself??).


5th Week Tutorial – Adding user, groups and permissions in Unix-Like OS.

Pearl of the week, introduction to some more shell commands some of the most useful were:

find // search for specific files (criteria)
grep // search files for lines $grep "needle" /etc/*.php
ls -l | wc -l // piping
locate // find files, -c for count (good for case of searching for files types.)

Next came adding new users and groups:

sudo groupadd group1 // create group
sudo useradd -g week5 -d /home/stevem -m -s /bin/bash -c "DALDLA" username //To add user

I did have some issue with the new users being added to the correct group and adding existing user to a group as their secondary group. I will do some experimenting on my own system to confirm that is was something I did or was doing wrong during the tut.

*After some playing around I found that adding an existing user to another group, even making the other group the existing user’s primary will not enable access for the user to the group’s files/folders. Have emailed Andy in regards to this.

Leave a Reply

Your email address will not be published. Required fields are marked *