Tuesday, January 15, 2008

Assignment # 4

1. The major difference between deadlock, starvation and race is that in deadlock, the problem occurs when the jobs are processed. Starvation, however is the allocation of resource that prevents one job to be executed. Race occurs before the process has been started.

2. Example of Deadlock: When two person are about to buy one product at the time.

Example of Starvation: When one person borrowed a pen from his classmate and his

classmate get his pen back.

Example of Race: When two guys have the same girlfriend.

3. Four necessary condition needed for the deadlock from exercise #2:

  • if the product is only one.
  • if the two person needed that one product urgently.
  • if there's other alternative products available.
  • if the two person are brand concious and the product happen to be what they like.



a. Deadlock will not happen because there are two traffic lights that control the traffic. But when some motorist don't follow the traffic lights, deadlock can occur because there's only one bridge to drive through.

b. Deadlock can be detected when there will be a huge bumper to bumper to the traffic and there will be accident that will happen.

c. The solution to prevent deadlock is that, the traffic lights should be accurate and motorist should follow it. In order to have a nice driving through the bridge.


Thursday, December 13, 2007

Assignment # 3

pg. 104
question # 4
a. What is the cause of thrashing?
-The thrashing is caused by mainly by the file indexing in vista and not with your page file. Indexing usually happens in the first 15mins after you boot up - its normal.Your pagefile seems very large - try to make it a fixed size of about 1024Mb on a second HD if possible. Have you inserted a spare USB memory stick for readyboost - it helps reduce thrashing later on.

b. How does the operating sytem detect thrashing?
-An operating system would have no idea that thrashing is happening. The OS would be responsible for making use of virtual memory to make up for the lack of physical RAM during a particular computing session, but would have no concept that this is causing issues with hardware.

c. Once thrashing is detected, what can the operating system do to eliminate it?
-Thrashing is usually a symptom of low memory in your system. To minimize it, try adding more memory to your computer or try to cut down on use interface elements that use extra memory like complicated background images and detailed icons.

pg. 56
question # 1-3

a. Multiprogramming. Why is it used?

-Multiprogramming makes effifcient use of the CPU by overlapping the demands for the CPU and its I/O devices from various users. It attempts to increase CPU utilization by always having something for the CPU to execute.

b. Internal fragmentation. How does it occur?

-Internal fragmentation is the space wasted inside of allocated memory blocks because of restriction on the allowed sizes of allocated blocks. Allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used.

c. External fragmentation. How does it occur?

-the external fragmentation is to create a minimum swap file size that somewhat exceeds the usual size of your swap file. If your swap file exceeds the minimum, external fragmentation will occur. Setting a maximum that may be exceed is ill advised as it can crash your system if it is exceeded.

d. Compaction. Why is it needed?

e. Relocation. How often should it be performed?

- Relocation is the process of replacing symbolic references or names of libraries with actual usable addresses in memory before running a program. It is typically done by the linker during compilation, although it can be done at run-time by a loader. Compilers or assemblers typically generate the executable with zero as the lower-most, starting address. Before the execution of object code, these addresses should be adjusted so that they denote the correct runtime addresses.

2. Describe the major disadvantages for each of the four memory allocation schemes presented in the chapter.
- The major disadvantage only 1 job per partition and waste of main storage.

3. Describe the major advantages for each of the memory allocation schemes presented in the chapter.
-The major advantage of this is operating system is easy to implement.

Thursday, November 29, 2007

Assignment 2

Virtual Memory- A program instruction on an Intel 386 or later CPU can address up to 4GB of memory, using its full 32 bits. This is normally far more than the RAM of the machine. (The 32nd exponent of 2 is exactly 4,294,967,296, or 4 GB. 32 binary digits allow the representation of 4,294,967,296 numbers — counting 0.) So the hardware provides for programs to operate in terms of as much as they wish of this full 4GB space as Virtual Memory, those parts of the program and data which are currently active being loaded into Physical Random Access Memory (RAM). The processor itself then translates (‘maps’) the virtual addresses from an instruction into the correct physical equivalents, doing this on the fly as the instruction is executed. The processor manages the mapping in terms of pages of 4 Kilobytes each - a size that has implications for managing virtual memory by the system.
THRASHING - Like all virtual memory management systems, performance degradation experienced from paging delays is directly related to the amount of real memory installed in the machine. 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. However, you can cause thrashing to occur if, for example, you create a 38 page (6000K) SuperPaint document and attempt to work with it.

Windows Operating System..

To implement virtual memory management, 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 FIFO list of in-memory pages so that it can decide on pages to throw out in case of a space crunch.

Unix Operating System..

Virtual memory is used to enlarge the available address space beyond the physical address space. 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.


Tuesday, November 20, 2007

Assignment No. 1

The most important program that runs on a computer. Every general-purpose computer must have an operating system to run other programs. Operating systems perform basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as disk drives and printers. Operating systems provide a software platform on top of which other programs, called application programs, can run. The application programs must be written to run on top of a particular operating system. Your choice of operating system, therefore, determines to a great extent the applications you can run. For PCs, the most popular operating systems are DOS, OS/2, and Windows, but others are available, such as Linux. In this article, the author wrote a brief summary of the operating system and explain it well.
2. The two reason why regional bank might buy six server computer instead of one super computer are:
  • Because six server computers can manipulate more data at the same time.
  • Because six server computers can perform faster than one super computer.