little life

little life
11 little new born guppies in the house

Tuesday, September 16, 2008

SEB070030 Tutorial 05

Magnetic disk

A flat rotating disc covered on one or both sides with some magnetically coated surface that can store encoded information. There are two main types of magnetic disk, which are the hard disk and the floppy disk. Hard disk spins much faster than floppy disk do and has a higher storage density.







The read/read head magnetizes parts of the surface to record information. It glides on a thin cushion of air above the disk and never actually touches the disk. Digital information is stored on magnetic disks in the form of microscopically small, magnetized needles, each of which encodes a single bit of information by being polarized in one direction (representing 1) or the other (representing 0).

Examples
Floppy disk, hard disk, removable cartridge

Advantages

  • Disk drive can rapidly retrieve information from any part of a magnetic disk without regard for the order in which the information was recorded.
  • Because of their random-access capability, disks are the most popular media for storage needs.

Optical disk

Optical disk is an electronic data storage medium that can be written to and read using a low-powered laser beam. It is flat, circular (usually polycarbonate). Data are stored in the pits (or bumps) in its flat surface — sequentially on the continuous, spiral track extending from the innermost track to the outermost track, covering the entire disc surface.






The data are accessed in the disc when a special material (often aluminium) is illuminated with a laser diode. The pits distort the reflected laser light, hence, most optical discs, characteristically have an iridescent appearance created by the grooves of the reflective layer.
Write-once optical discs commonly use an organic dye, and re-writable discs use phase change alloys.

Examples
Compact disk, bluray

Advantages

  • Optical disc offers a number of advantages over magnetic storage media. An optical disc holds much more data. 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.
  • Optical discs are inexpensive to manufacture and data stored on them is relatively impervious to most environmental threats, such as power surges, or magnetic disturbances.


Flash memory



Flash memory is a type of eraseable, non-volatile memory chip. This technology is primarily used in 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.



Advantages

  • Flash memory costs far less than byte-programmable EEPROM.
  • It is non-volatile that no power is needed to maintain the information stored in the chip.
  • It offers fast read access and better kinetic shock resistance than hard disk.
  • In memory cards, it is enormously durable that can withstand extreme of temperature, intense pressure and immersion in water.

Examples
Mini SD card, MP3 player, USB Flash Drive



Magneto-optical disc (MO)

A plastic or glass disk coated with a compound with special optical, magnetic and thermal properties. It uses magnetic fields for data storage and is capable for writing and rewriting data.



The disk is read by bouncing a low-intensity laser off the disk. Originally the laser was infrared, but frequencies up to blue may be possible giving higher storage density. The polarisation of the reflected light depends on the polarity of the stored magnetic field.

Examples
Diskette drive, Rewritable OD 230MB Data Tape Cartridge

Advantages

  • CD-MO is read by a laser beam, which makes it more reliable than a hard disk or a floppy disk. However, a strong magnetic field can corrupt the stored data.
  • Although optical, they appear as hard disk drives to the operating system but need no special filesystem.

Tuesday, September 2, 2008

VIRTUAL MEMORY MANAGEMENT






One of the most important aspects of an operating system is the Virtual Memory Management system. Virtual Memory (VM) allows an operating system to perform many of its advanced functions, such as process isolation, file caching, and swapping.

Virtual memory is a computer system technique which gives an application program the impression that it has contiguous working memory, while in fact it is physically fragmented and may even overflow on to disk storage.

Systems which use this technique make programming of large applications easier and use real physical memory (e.g. RAM) more efficiently than those without virtual memory.

Note that "virtual memory" is not just "using disk space to extend physical memory size". Extending memory is a normal consequence of using virtual memory techniques, but can be done by other means such as overlays or swapping programs and their data completely out to disk while they are inactive.














































Windows OS

Operating System

UNIX/Linux OS

Windows NT needs to maintain a lot
of data. First, it needs to maintain whether each address is mapped to
physical RAM or the data is to be brought in from secondary storage when
a request with the address comes. Maintaining this information for each
byte itself takes a lot of space (actually, more space than the address
space for which the information is to be maintained). So Windows NT breaks
the address space into 4KB pages and maintains this information in page
tables.

As we saw earlier, a page table entry (PTE) consists of the address of
the physical page (if the page is mapped to physical RAM) and attributes
of the page. Since the processor heavily depends on PTEs for address translation,
the structure of PTE is processor dependent.

If a page is not mapped onto physical RAM, Windows NT marks the page as
invalid. Any access to this page causes a page fault, and the page fault
handler can bring in the page from the secondary storage.

To be more specific, when the page contains DLL code or executable module
code, the page is brought in from the DLL or executable file. When the
page contains data, it is brought in from the swap file. When the page
represents a memory-mapped file area, it is brought in from the corresponding
file.

Windows NT needs to keep track of free physical RAM so that it can allocate
space for a page brought in from secondary storage in case of a page fault.
This information is maintained in a kernel data structure called the Page
Frame Database (PFD). The PFD also maintains a First-In-First-Out (FIFO)
list of in-memory pages so that it can decide on pages to throw out in
case of a space crunch.

According to FIFO policy, the oldest data (that is, the data that was
brought in the RAM first) is thrown out whenever there is a space crunch.

Virtual memory management

Virtual memory consists of main memory
and swap space.

The Digital UNIX operating system keeps only a set of the recently used
pages of all processes in main memory and keeps the other pages on disk
in swap space. Virtual memory and the unified buffer cache (UBC) share
all physical memory.

Paging and swapping is used to ensure that the active task has the pages
in memory that are needed for it to execute. Paging is controlled by the
page reclamation code. Swapping is controlled by the task swapping daemon.

Much of the movement of addresses and data among the CPU cache, secondary
and tertiary cache, and physical memory is controlled by the hardware
logic and the Privileged Architecture Library (PAL) code, which is transparent
to the Digital UNIX operating system.

The virtual memory subsystem becomes involved when the CPU's translation
buffer is unable to map a requested virtual address to a physical address
and then traps to the PAL's page lookup code, which is responsible for
monitoring and loading addresses from the page table into the CPU's translation
buffer.

If the requested page has been referenced before, the virtual memory subsystem
loads the address of the requested page into the translation buffer and
performs a disk I/O to copy the contents of the page from swap space into
memory. This is known as a page-in page fault.

The Zoned Buddy Allocator interacts directly with the Memory Managemen
Unit (MMU), providing valid pages when the kernel asks for them. It also
manages lists of pages and keeps track of different categories of memory
addresses.

The Slab Allocator is another layer in front of the Buddy Allocator, and
provides the ability to create cache of memory objects in memory. On x86
hardware, pages of memory must be allocated in 4KB blocks, but the Slab
Allocator allows the kernel to store objects that are differently sized,
and will manage and allocate real pages appropriately.

Finally, a few kernel tasks run to manage specific aspects of the VMM.
Bdflush manages block device pages (disk IO), and kswapd handles swapping
pages to disk.

Pages of memory are either Free (available to allocate), Active (in use),
or Inactive. Inactive pages of memory are either dirty or clean, depending
on if it has been selected for removal yet or not. An inactive, dirty
page is no longer in use, but is not yet available for re-use. The operating
system must scan for dirty pages, and decide to deallocate them. After
they have been guaranteed sync’d to disk, an inactive page my be
“clean,” or ready for re-use.


Windows uses structured exception
handling to report page fault-based invalid accesses as access violation
exceptions. It involves the termination of the running task that caused
the error condition, a notification may be shown to user.

Recent versions of Windows often report such problems with less technical
error messages simply stating something along the lines of this program
must close. Additionally, recent Windows versions also write a minidump
(core dump) describing the state of the crashed process for later analysis
alongside such less-technical error messages.

Of course, since there is generally far less physical memory than there
is virtual memory, part of this mechanism defines what the hardware should
do if a virtual page is accessed but there is no translation defined to
a physical page. In Windows terminology, this is defined to be a page
fault.

When a page fault occurs, the hardware cannot do anything else with the
instruction that caused the page fault and thus it must transfer control
to an operating system routine (this is the page fault handler). The page
fault handler must then decide how to handle the page fault.

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 or page file. 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 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.

If there is pressure on space in RAM, then parts of code and data that
are not currently needed can be ‘paged out’ in order to make
room — the page file can thus be seen as an overflow area to make
the RAM behave as if it were larger than it is.


How it handles page faults

UNIX systems typically use signals,
such as SIGSEGV, to report these error conditions to programs. It involves
the termination of the running process that caused the error condition,
and a notification to the user that the program has malfunctioned. The
operating systems typically report these conditions to the user with error
messages such as "segmentation violation" or "bus error".

If the faulting virtual address is invalid this means that the process
has attempted to access a virtual address that it should not have. Maybe
the application has gone wrong in some way, for example writing to random
addresses in memory. In this case the operating system will terminate
it, protecting the other processes in the system from this rogue process.


If the faulting virtual address was valid but the page that it refers
to is not currently in memory, the operating system must bring the appropriate
page into memory from the image on disk. Disk access takes a long time,
relatively speaking, and so the process must wait quite a while until
the page has been fetched.

If there are other processes that could run, then the operating system
will select one of them to run. The fetched page is written into a free
physical page frame and an entry for the virtual page frame number is
added to the process' page table. The process is then restarted at the
machine instruction where the memory fault occurred. This time the virtual
memory access is made, the processor can make the virtual to physical
address translation and so the process continues to run.

Linux uses demand paging to load executable images into a process's virtual
memory. Whenever a command is executed, the file containing it is opened
and its contents are mapped into the process's virtual memory. This is
done by modifying the data structures describing this process' memory
map and is known as memory mapping. However, only the first part of the
image is actually brought into physical memory. The rest of the image
is left on disk. As the image executes, it generates page faults and Linux
uses the process's memory map in order to determine which parts of the
image to bring into memory for execution.


The page file is a hidden file in
the file type of pagefile.sys.

Windows divides up all the physical memory in the system into a series
of pages (on the x86 architecture this is normally 4kb but driver writers
should use the manifest constant PAGE_SIZE).

It also divides up the virtual address space into a series of comparably
sized pages as well. Finally, Windows and the underlying hardware platform
agree upon a means to tell the hardware how to translate the address of
a virtual page into a corresponding physical page.

It is regenerated at each boot, which is no need to be included in backup.


Page File

OS divides its main memory into pages
to allow better utilization of memory.

A page is a fixed length block of main memory, which is contiguous in
physical and also virtual memory addressing.The blocks of pages are examined
in a cyclical manner; a different block of pages is examined each time
an attempt is made to shrink the memory map.


If the amount of real memory installed
is less than the required amount of memory for the task at hand, a phenomenon
called "thrashing" can occur.

This is exhibited when the machine spends most of its time moving pages
to and from disk versus doing real work.

In our current working environment, the amount of memory required to use
the standard applications is less than 2MB.

To prevent thrashing, a process must be provided with as many frames as
it needs. The number of frames it needs can be determined with several
techniques, including the working-set strategy. This approach defines
the locality model process execution

Paging supervisor creates and manages the page tables. If the dynamic
address translation hardware raises a page fault interrupt, the paging
supervisor searches the page file for the page containing the required
virtual address, reads it into real physical memory, updates the page
tables to reflect the new location of the virtual address and finally
tells the dynamic address translation mechanism to start the search again.


Thrashing issues reconciliation

In the case of thrashing, pages are
constantly being written to and read back from disk. This causes the operating
system to be too busy to perform enough real work.

If, for example, physical page frame number 1 is being regularly accessed
then it is not a good candidate for swapping to hard disk. The set of
pages that a process is currently using is called the working set. An
efficient swap scheme would make sure that all processes have their working
set in physical memory.

The page fault handler then determines what must be done to resolve this
page fault. It can find where the desired page resides on disk and read
it in (this is normally the case if the page fault is for a page of code);
determine that the desired page is already in RAM (but not allocated to
the current process) and direct the MMU to point to it; point to a special
page containing nothing but zeros and later allocate a page only if the
page is ever written to (this is called a copy on write page, and is often
used for pages containing zero-initialized data)

Tuesday, August 5, 2008

SEB070030 Tutorial 3

what is OPERATING SYSTEM?

The operating system is the core software component of your computer. It performs many functions and is, in very basic terms, an interface between your computer and the outside world. In the section about hardware, a computer is described as consisting of several component parts including your monitor, keyboard, mouse, and other parts.

20 CORE FUNCTIONS of OS

* Creating abstraction to hide hardware (Device management)
An operating system transforms the physical world of devices into virtual world that is the result of abstractions built by the operating system.

* Device management
An operating system controls peripheral devices, such as printer, by sending them commands in their own language with the software routine namely “driver”.

* To allocate resources to processes (Resources management)
An operating system controls or manages processes (the active agents) to access resources (passive entities).

* Process management
An operating system controls the loading and running of programs
An operating system controls the order and time in which programs are run and is more sophisticated in daily work.

* Provides a set of libraries
These libraries or functions are used by programs to perform specific tasks. Especially, in interfacing with computer system components

* File management
An operating system allows user to save files to a back store
It also contains commands such as “copy” and “rename”. These commands are accepted are executed by the command processor or command line interpreter in the operating system. For example, DOS operating system.

* Memory management
An operating system allocates or creates a virtual memory for program.
It organizes the memory usage between programs so that the program data is loaded into pages of memory.

* Time management
An operating system organizes processing time between programs an users.

* Network management
An operating system establishes internet connection and monitors the connection and interaction among two or more computers.

* Multi-threading
An operating system provides multi-threading processes that split task into smaller task, named threads. This thread allows smoother operations.

* User management
An operating system allows more than one user to log in into a computer.
The operating system has user account database which contains user right, default home directory, and user passwords.

* Central processing unit (CPU) management
An operating system allows allocation of resources among different application.

* Input/Output management
An operating system allows process-device synchronization via I/O buffers.

* Maintaining computer performance
An operating system provides system tools (programs) used to monitor computer performance, debug problems, or maintain parts of the system.

* Provides graphical user interfaces
An operating system allows interfacing functions work along with its other operating functions smoothly which are mostly transparent to the user.
GUI allows users to enter commands by pointing or clicking at the objects on the computer screen.

* Multi-processing Management
An operating system allows multitasking, which is the ability to execute multiple programs simultaneously on individual processors.

* Organization of program priority
An operating system manages the priorities between programs and users. So that, all the programs can run smoothly.

* Critical event management
An operating system informs user by displaying specific issue error messages if there is any error in running task.
It deals with errors and user instructions.

* Security
An operating system maintains the computer security by controlling the accessibility rights of users.

* Recovery and backup
An operating system provides recovery and backup routines to re-start the event(s) if there is any system failure.

Tuesday, July 15, 2008

SEB070030 Tutorial 1

Tutorial 1

Applications software (also called end-user software)
A subclass of computer software (as opposed to system software) for carrying out a specialized task by using the capabilities of a computer directly to a performed task.

For example, database programs, electronic mail, word processors, media players, and spreadsheets.

Communication Device
Any hand-held or wearable machine or component that attaches to a computer that assists in data transmission.

For example, modems, cables, and ports.
Most of communication devices require a program (device driver) that acts as a translator to convert the general commands from application into specific commands that the device understands.

Computer
A programmable electronic and digital machine that can perform complex procedures and respond to a specific set of instructions or prerecorded list of instructions (program) precisely and reliably. It can store and retrieve large amounts of data in a well-defined manner.


All general computers require these hardware components:

  • Memory(ram, magnetic disk, magnetic tape)
  • Mass storage device (disk drives and tape drives)
  • Input device (keyboard, mouse)
  • Output device (display screen, printer, microphone)
  • Central processing unit (CPU)

Desktop computer
A personal computer small enough to fit conveniently in one’s workplace. ‘Desktop’ refers specifically to a horizontally-oriented case, it usually have the display screen placed on top to save space on the desktop.

Embedded computer
A specialized computer that is part of a larger system or machine built into a product, usually acts as part of a complete device including hardware and mechanical parts. It only performs the simple or very complex programs needed to work one or a few dedicated functions.

Examples, intelligent controllers for televisions, automobile engines, trains, cameras, cell phones, and personal digital assistants (PDAs)

Graphical User Interface (GUI)
A program interface that takes advantage of the computer’s graphics capabilities to make the program easier to use. It can make the user free from learning complex command languages and easier to move data from one application to another

Example: Microsoft Windows feature the following basic components.
· pointer · icon · desktop · windows· menus ·


Hardware
The physical mechanical, magnetic, electronic, and electrical components (electronic circuits and I/O devices) from which a computer is constructed.

Examples: mouse, keyboard

Internet
A global network connecting millions of computer. It is decentralized by design that transmits data, news and opinion by packet switching using the standard Internet Protocol (IP).

Installing
In computer terminology, putting software on computer or adding hardware components to a computer (installing hardware).

Network
A collection of connected or linked computer systems with the ability to communicate with each other.

Examples: local-area networks (LANs)

fiRst

My 1st blog ...
Just created account blog in lab..
In class SHES2300 OS.. hehe..