Monday, September 15, 2008

SEB070024-Tutorial 5

STORAGE DEVICES

1. Magnetic Disk




Description:

The primary computer storage device. Like tape, it is magnetically recorded and can be re-recorded over and over. Disks are rotating platters with a mechanical arm that moves a read/write head between the outer and inner edges of the platter's surface. It can take as long as one second to find a location on a floppy disk to as little as a couple of milliseconds on a fast hard disk.

Advantage:

- The ability to write or record and read data very rapidly.
- Data that is no longer needed can be erased to make space available for new data.
- Data can be read directly from any part of the hard disc (random access).
- The access speed is about 1000 KB per second.
- Cheap to buy

Example:

- floppy disk (diskette)
- hard disk
- zip removable disk
- removable cartridge

2. Optical Disk

Description:

A disk drive that uses laser light or electromagnetic waves near the light spectrum as part of the process of reading and writing data. It is a computer's peripheral device, that stores data on optical discs. Some drives can only read from discs, but commonly drives are both readers and recorders. Recorders are sometimes called burners or writers.

Advantage:

- Have a relatively large storage capacity because the optical recording process can form
very small bits on the surface of the disk.
- Provides a minimum of 650 megabytes (MB) of
data storage. A double-layered an
double-sided DVD optical disk holds up to 15.9 gigabytes (GB) of data.
- Storage capacity increases with each new generation of optical media. Emerging
standards, such as blu-ray, offer up to 27 gigabytes (GB) on a single-sided 12-
centimeter disc. In comparison, a diskette, for example, can hold 1.44 megabytes (MB).
- The greater control and focus possible with laser beams (in comparison to tiny magnetic
heads) means that more data can be written into a smaller space.
- By using multiple disk many images can be stored or archived.
- They are relatively tough, data stored on them is relatively impervious to most
environmental threats, such as power surges, or magnetic disturbances as long as
the surface does not get too scratched.
- Inexpensive to manufacture.
- Compact, lightweight, durable and digital.

Example:

- CD
- CD-ROM’s
- DVD
- Blu-ray disk


3. Flash Memory

Description:

Flash memory is non-volatile computer memory that can be electrically erased and reprogrammed. It is a technology that is primarily used in memory cards and USB flash drives for general storage and transfer of data between computers and other digital products. It is a specific type of EEPROM (Electrically Erasable Programmable Read-Only Memory) that is erased and programmed in large blocks; in early flash the entire chip had to be erased at once. Flash memory costs far less than byte-programmable EEPROM and therefore has become the dominant technology wherever a significant amount of non-volatile, solid-state storage is needed.

Advantage:

- Flash memory is non-volatile, which means that no power is needed to maintain the
information stored in the chip.
- Offers fast read access times (although not as fast as volatile
DRAM memory used for
main memory in PCs)
- Better kinetic shock resistance than
hard disks. - When packaged in a "memory card," it
is enormously durable, being able to withstand intense pressure, extremes temperature,
and even immersion in water.

Example:

- USB-drive
- Memory Card
- Smart Card


4. Magneto-Optical Disk


Description:

A magneto-optical drive is a kind of optical disc drive capable of writing and rewriting data upon a magneto-optical disc. Both 130 mm and 90 mm form factors exist. The technology was introduced at the end of the 1980s. Although optical, they appear as hard disk drives to the operating system and do not require a special filesystem (they can be formatted as FAT, HPFS, NTFS, etc.).

Advantage:

- It can be rewritten repeatedly without significant damage to the disk.
- The cases provide dust resistance, and the drives themselves have slots constructed in
such a way that they always appear to be closed.
- Magneto-optical drives by default check information after writing it to the disc, and are
able to immediately report any problems to the operating system.
- Capacities ranged from 128MB to 2.3GB.

Example:

- Quadrilayer
- Magnetic Optical Disk’s

Monday, September 1, 2008

SEB070024-Amali 4

Comparison of how Windows and a UNIX/Linux operating system inplements virtual memory.

New Page 1

Windows operating system

UNIX/Linux operating system

Hardware Abstraction Layer: All OSes have a layer called the hardware abstraction layer

(HAL) which does the system-dependent work, and thus enables the rest of the kernel to be coded in platform independent fashion. This eases porting it to other platforms.

Copy-on-write: When a page is to be shared, the system uses only one page with both processes sharing that same copy of the page. However, when one of the process does a write onto the page, a private copy is made for that process, which it can then manipulate individually. This gives a lot better efficiency

Shadow paging: A shadow object is created for an original object such that the shadow object has some of its pages modified from the original object, but shares the rest of the pages with the original object. They are formed as a result of Copy-On-Write action.

A Background daemon: There exists a background daemon which is invoked periodically

and performs tasks like page flushing, freeing unused memory, etc.

Memory mapped Files: A file can be mapped onto memory, which then can be used with simple memory read/write instructions.

Inter-Process Communication: The memory mapped files are allowed to be then shared between processes forming a method for interprocess communication.

The system used by Windows in this case it too sophisticated and complicated.

Up to Linux 2.2, the Linux VM had focused on simplicity and low overhead. Hence it was rather quite primitive and had many problems, especially under heavy load

Windows uses clustered demand paging for fetching pages.

Linux uses a demand paged system with no prepaging. using a disk as an extension of RAM so that the effective size of usable memory grows correspondingly.

In Clustered demand paging, the pages are only brought to memory when they are required. Also, instead of bring 1, Windows, often brings a cluster of them of 1-8 pages, depending on the current state of the system.

When a process starts in Unix, not all its memory pages are read in from the disk at once. Instead, the kernel loads into RAM only a few pages at a time. After the CPU digests these, the next page is requested. If it is not found in RAM, a page fault occurs, signaling the kernel to load the next few pages from disk into RAM. This is called demand paging and is a perfectly normal system activity in Unix.

Windows NT and its variants employ a dynamically allocated pagefile for memory management. A pagefile is allocated on disk, for less frequently accessed objects in memory, leaving more RAM available to actively used objects. This scheme suffers from slow-downs due to disk fragmentation, which hampers the speed at which the objects can be brought back into memory when they are needed.

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. This reduces slowdown due to disk fragmentation from general use.

Uses the clock algorithm for the page replacement

Until kernel version 2.2, Linux used NRU algorithm for page replacement, but due to the various shortcomings of the algorithm, they have changed it and implemented an approximate Least Recently Used in 2.4.

The clock algorithm used by Windows is local. When a page fault occurs, and faulting process’s working set is below a minimum threshold, then the page is simply added to the working set. On the

other hand, if the working set is higher than one another threshold, then it reduces the size of working set. Hence the algorithm can be called global. But the system does do some global optimizations too.

For example, it increases the working set of processes that are causing a large number of page faults, and decreasing the working set for those who do not require enough memory.

The aging to effect LRU is brought about by increasing the age (a counter associated with a page) of a page by a constant when the page is found to be referenced during a scan, and, decreased exponentially

(divided by 2) when found not to have been referenced. This method approximates LRU fairly well.

Instead of just working when there is a page fault, just like Unix, Windows has a daemon thread working too, but called in this case as Balance Set Manager. This is invoked every 1 second, and it checks

whether there is enough free memory. If there is not, then it invokes the working set manager. The working set manager maintains to keep the free memory above threshold. It checks the working sets of process from old and big to the young and small. And depending on how many page faults they have generated, it increases or decreases them. If a page’s reference bit is clear, then counter associated with the page

is incremented. If the reference bit is set, the counter

The kernel will write the contents of a currently unused block of memory to the hard disk so that the memory can be used for another purpose. When the original contents are needed again, they are read back into memory. This is all made completely transparent to the user; programs running under Linux only see the larger amount of memory available and don't notice that parts of them reside on the disk from time to time. Of course, reading and writing the hard disk is slower (on the order of a thousand times slower) than using real memory, so the programs don't run as fast. The part of the hard disk that is used as virtual memory is called the swap space.

The kernel receives 5 kinds of page faults -1. The page referenced is not committed.

2. A protection violation has occurred.

3. A shared page has been written.

4. The stack needs to grow.

5. The page referenced is committed but

not currently mapped in.

The first two are irrecoverable errors. The third indicates an attempt to write to read-only page. Copy that page somewhere else and make the new one read/write. This is how copy-on-write works. The fourth needs to be responded by finding an extra page.

When a page fault occurs, the processor's memory management unit (MMU) signals the kernel through an exception and asks it to handle the fault: this can either result in a resolved page fault or in an error. Assuming that all memory accesses are correct (and hence there are no errors), the kernel needs to bring the requested page into memory.

Windows uses structured exception handling to report page fault-based invalid accesses as access violation exceptions

UNIX systems typically use signals, such as SIGSEGV, to report these error conditions (page faults) to programs. UNIX operating systems typically report these conditions to the user with error messages such as "segmentation violation", or "bus error".

Windows divides the list of pages into four lists:-

1. Modified Page List

2. Stand-bye Page list

3. Free Page list

4. Zeroed Page List

The first is list of dirty pages, stand-bye is a list of clean pages, are currently associated with a process. Whereas Free Pages are those clean pages which are not even associated with some process. The Zeroed list is the list of zeroed out pages, if needed. The transitions between these lists is handled by working set manager and some other daemon thread such as - swapper thread, mapped page write and

modified page writer.

Linux 2.4 divides the virtual pages into 4 lists

1. Active list

2. Inactive-dirty list

3. Inactive-clean list

4. Free list

To separate the pages which were chosen for eviction, the inactive-dirty list was made. Normally, the active pages are on the list 1. But as time passes, if some of the pages are not active, then their age decreases and goes down to 0, which indicates it is a candidate for eviction. Such pages are moved from list 1 to list 2.

All the three systems distribute the process virtual address space in a similar manner. Higher part of it is used by the kernel, while the process can use the lower part. The kernel part of the space of all process

usually point to the same kernel code. So while switching a process, we need to switch the page table entries of the lower part, while the upper part can remain the same. In Windows, 2GB are kept for both process and kernel.

In Linux 3GB is kept for the process and 1 GB given to the kernel,

Windows NT provides a page-based virtual memory management scheme that allows applications to realize a 32-bit linear address space for 4 gigabytes (GB) of memory. As a result, each application has its own private address space from which it can use the lower 2 GB—the system reserves the upper 2 GB of every process's address space for its own use.

The Unix kernel divides the memory into manageable chunks called pages. A single page of memory is usually 4096 or 8192 bytes (4 or 8KB). Memory pages are laid down contiguously across the physical and virtual memory.

Windows NT's memory management system virtualizes memory such that to each application it appears as though there is 2 GB of memory available, regardless of how much physical memory actually exists. In order to do this, Windows NT must manage memory in the background without regard to the instantaneous requests that each application makes. In fact, the memory manager in Windows NT is a completely independent process consisting of several threads that constantly manage available resources.

Paging: When a process starts in Unix, not all its memory pages are read in from the disk at once. Instead, the kernel loads into RAM only a few pages at a time. After the CPU digests these, the next page is requested. If it is not found in RAM, a page fault occurs, signaling the kernel to load the next few pages from disk into RAM. This is called demand paging and is a perfectly normal system activity in Unix. (Just so you know, it is possible for you, as a programmer, to read in entire processes if there is enough memory available to do so.)





Reference:

http://www.answers.com/topic/page-fault
http://msdn.microsoft.com/en-us/library/ms810616.aspx
http://en.wikipedia.org/wiki/Comparison_of_Windows_and_Linux
http://www.inf.fu-berlin.de/lehre/SS01/OS/Lectures/Lecture14.pdf
http://ldp.linux.no/LDP/sag/html/vm-intro.html
http://www.uwsg.iu.edu/UAU/memory/pageswap.html

Monday, August 4, 2008

SEB070024-Tutorial 3



The 20 Core Functions of an Operating System are:

1. Processor management
OS assigns processor to the different tasks being performed by the computer system.
2. Memory management
The OS allocates main memory and other storage areas to the system programmes as well as
user programmes and data.
3. Input/output management
co-ordination and assignment of the different output and input device while one or more
programmes are being executed.

4. File management
The storage of file of various storage devices to another. It also allows all files to be easily
changed and modified through the use of text editors or some other files manipulation
routines.
5. Establishment and enforcement of a priority system.
OS determines and maintains the order in which jobs are to be executed in the computer
system first.

6. Automatic transition from job to job as directed by special control statements.

7. Interpretation of commands and instructions.

8. Running applications.
These programs load and run applications such as word processors and spreadsheets. Most
OS support multitasking, or the ability to run more than one application at a time. When a
user requests a program, the OS locates the application and loads it into the primary memory
or RAM of the computer. As more programs are loaded, the OS must allocate the computer
resources.
9. Coordination and assignment of compilers, assemblers, utility programs, and other
software to the various user of the computer system.

10. Communication with the hardware
operating system provides for some type of error handling and error notification. If a piece
of hardware is not functioning properly, the operating system tries to fix the problem or tries
to communicate with the device a few more times. If it is still unable to communicate with the
device, it provides an error screen notifying the user of the problem.
11. Provides Netwoking capabilities.
Enables a computer to connect to each other for a network.OS provides a medium which
enables data transaction and operation between systems.
12. Recognizes input from the keyboard and sends the output to the display screen of the
computer.
13. An operating system also establishes data security and integrity
Enables users access to files and directories are controlled.

14. Creates a user interface
that is a visual representation of the computer on the monitor that makes sense to the
people using the computer.
15. The OS provides a structure for access to application via user interface that enables
user to determine the available installed programs and run, use, and shut down the
program of their choice.
16. Enables user to manipulate programs and data when the users add, move and delete
the installed programs and data.

17. Control on the computer hardware.
The OS sits between the programs and the basic output system (BIOS). The BIOS controls
the hardware. All programs that need hardware resources must go through the OS. The OS
can either access the hardware through the BIOS or through the device drivers

18. If the BIOS is unable to talk with the hardware, the operating system talks to the
hardware directly. For this capability, it needs some additional programming. Device
drivers provide the code necessary for the operating system to communicate with
specific hardware. Device drivers are written specifically for a particular operating
system, usually by the hardware manufacturer.

19. Backing store management.
The OS controls the transfer of data from secondary storage (e.g. disk) to memory and back
again. It also maintains a directory of the disk so that files and free space can be quickly
located.
20. It schedules the activities of the CPU and resources and make job more efficient and to
prevent deadlock .

Tuesday, July 15, 2008

SEB070024/tutorial2

Tutorial 1
definations

1. Application software
A subclass of computer program that employs the capabilities of a computer directly &
throughly to a task that the users wish to perform.
eg: listen to music using Windows Media Player.

2. Communication devices
A terminal used to send voice, video, text, mobile phones, wireless PDA's & personal
computer equiped with microphones, speakers & cameras are all considered communication
devices.

3. Computer
A machine that manipulates data according to a list of instructions.

4. Desktop computer
A personal PC in a form intended for a regular use at a single location.

5. Embedded computer
A special purpose computer system designed to form one or few dedicated functions often
related with the real time computing constants.
eg: MP3, traffic light, camera, microwave, etc

6. Graphical user interphase
Enables us to manage files like icons we see on the desktop. It's user friendly.
eg: The scrol down key.

7. Hardware
Mechanical electronic component of the computer.
eg: monitor, mouse, motherboard, etc.

8. Internet
A worldwide publicly accessible series of interconnected networks that transmit data by
packet switching using the standard Internet Protocol (IP)

9. Installing
Adding a program or software onto the mechanical devices.

10. Networks
Method of sharing infomation between 2 systems.
eg: Jaring, Maxis, TM-net, etc.