Tuesday, September 2, 2008

SEB070017 - TUTORIAL 4



Tutorial 4 - SEB070017


NG
CHI BENG


 



The key to using memory efficiently is virtual
memory management. Consider both Windows  and a UNIX/Linux operating system.
Compare and contrast how each implements virtual memory. Describe how each one
handles page faults, page sizes and how it reconciles thrashing issues. Cite
your sources.



 



 












































Windows


UNIX/Linux


Windows is the most
prominent proprietary operating system


Linux is the most prominent
operating system that is free software


A pagefile is allocated on
disk, for less frequently accessed objects in memory, leaving more RAM
available to actively used objects


Most hard drive
installations of Linux utilize a "swap partition", where the disk space
allocated for paging is separate from general data, and is used strictly for
paging operations


Windows must boot from a
primary partition


Linux can boot from either a
primary partition or a logical partition inside an extended partition


Windows must boot from the
first hard disk.


Linux can boot from any hard
disk in the computer.


Windows allows programs to
store user information (files and settings) anywhere. This makes it
impossibly hard to backup user data files and settings and to switch to a
new computer.


In contrast, Linux stores
all user data in the home directory making it much easier to migrate from an
old computer to a new one. If home directories are segregated in their own
partition, you can even upgrade from one version of Linux to another without
having to migrate user data and settings.


Only those parts of the
program and data that are currently in active use need to be held in
physical RAM. Other parts are then held in a swap file (in Windows
95/98/ME:) or page file (in Windows NT, Windows 2000 and XP: pagefile.sys).
When a program tries to access some address that is not currently in
physical RAM, it generates an interrupt, called a Page Fault. This asks the
system to retrieve the 4 KB page containing the address from the page file
(or in the case of code possibly from the original program file). This — a
valid page fault — normally happens quite invisibly. Sometimes, through
program or hardware error, the page is not there either. The system then has
an ‘Invalid Page Fault’ error. This will be a fatal error if detected in a
program: if it is seen within the system itself (perhaps because a program
sent it a bad request to do something), it may manifest itself as a ‘blue
screen’ failure with a STOP code: consult the page on STOP Messages on this
site.


Pages from a process are swapped


The process becomes runnable and attempts to access a swapped page


The page is faulted back into memory (most likely forcing some other
processes' pages to be swapped out)


A short time later, the page
is swapped out again


Win32-based operating system, such as Windows 9x, NT, ReactOS, use the
system function GetSystemInfo() from kernel32.dll.

#include <stdio.h>

#include <windows.h>



int main()

{

SYSTEM_INFO si;



GetSystemInfo(&si);

printf("The page size for this system is %u bytes\n", si.dwPageSize);



return 0;

}


 


UNIX and POSIX-based systems use the system function sysconf(), as
illustrated in the following example written in the C programming language.


#include <stdio.h>

#include <unistd.h> // sysconf(3)



int main()

{

printf("The page size for this system is %ld bytes\n", sysconf(_SC_PAGESIZE));
//_SC_PAGE_SIZE is OK too.

return 0;

}


 


Windows has two main lines. The older flavors are referred to as "Win9x" and
consist of Windows 95, 98, 98SE and Me. The newer flavors are referred to as
"NT class" and consist of Windows NT3, NT4, 2000, XP and Vista. Going back
in time, Windows 3.x preceded Windows 95 by a few years. And before that,
there were earlier versons of Windows, but they were not popular. Microsoft
no longer supports Windows NT3, NT4, all the 9x versions and of course
anything older. Support for Windows 2000 is partial (as of April 2007).

The flavors of Linux are referred to as distributions (often shortened to "distros").
All the Linux distributions released around the same time frame will use the
same kernel (the guts of the Operating System). They differ in the add-on
software provided, GUI, install process, price, documentation and technical
support. Both Linux and Windows come in desktop and server editions.

The Windows GUI has changed from Windows 3.1 to Windows 95 (drastically) to
Windows 2000 (slightly) to Windows XP (fairly large) and is slated to change
again with the next version of Windows, the one that will replace XP.
Windows XP has a themes feature that offers some customization of the look
and feel of the GUI.

Linux typically provides two GUIs, KDE and Gnome. See
a screen shot of

Lycoris

and

Lindows
in
action from the Wal-Mart web site. The

lynucs.org

web site has examples of many substantially different Linux GUIs. Of the
major Linux distributions, Lindows has made their user interface look more
like Windows than the others. Here is a

screen sho
t
of Linux made to look like Windows XP. Then too, there is

XPde for Linux

which really makes Linux look like Windows. Quoting their web site "It's
a desktop environment (XPde) and a window manager (XPwm) for Linux. It tries
to make easier for Windows XP users to use a
Linux box." 

 


References:


1.http://en.wikipedia.org/wiki/Comparison_of_Windows_and_Linux#Installation


2.


http://rangit.com/operating-systems/8-major-differences-between-linux


 

-
and-windows/


3. http://www. aumha.
org/win5/a/ xpvm.php


4.


http://www.michaelhorowitz.com/Linux.vs.Windows.html


5. www. how stuff works. com


 

No comments: